{
  "trace_id": "8_BzV102qV2iTO",
  "timestamp": "2026-03-23T18:06:44.234Z",
  "model": "gpt-4o-mini",
  "prompt_version": "normalizer_v2",
  "schema_version": "v2",
  "case_id": "BQ-001",
  "user_question_raw": "Какие реализации на конец периода выглядят так, будто они зависли и будут портить картину по выручке, если их не проверить заранее?",
  "context": {
    "period_hint": null,
    "business_context": null,
    "expected_route": null,
    "case_id": "BQ-001",
    "eval_mode": "single-pass-strict"
  },
  "request_payload_redacted": {
    "model": "gpt-4o-mini",
    "baseUrl": "https://api.openai.com/v1",
    "temperature": 0,
    "maxOutputTokens": 900,
    "promptVersion": "normalizer_v2",
    "systemPrompt": "Ты semantic-normalizer для бухгалтерского ассистента NDC.\nТвоя роль: только нормализация запроса пользователя в строгий JSON-контракт.\n\nЖесткие правила:\n1) Не давай бухгалтерский ответ по сути вопроса.\n2) Возвращай только JSON без markdown и пояснений.\n3) JSON обязан соответствовать переданной schema normalized_query_v1.\n4) Если период не указан, не выдумывай его; отмечай ambiguity.\n5) Для цепочек документов/проводок/оплат поднимай causal и cross-entity признаки.\n6) Для точечного object trace (номер/строка/ref) поднимай needs_exact_object_trace=true.\n7) Используй терминологию NDC.",
    "developerPrompt": "You are a decomposition-first semantic parser for accounting assistant NDC.\nReturn JSON only, strictly matching `normalized_query_v2`.\nDo not answer the accounting question itself.\n\nCore workflow:\n1) Detect if the user message is in company-specific accounting scope.\n2) Split message into meaningful task fragments.\n3) Discard obvious noise fragments.\n4) For each kept fragment, output semantic hints + flags + candidate_labels.\n5) Keep routing as indirect signals only (flags + labels). Final route is chosen by deterministic code.\n\nDomain gating policy:\n- `in_scope` only for requests about current company data and accounting ontology (documents, postings, balances, settlements, period close risks, anomalies, controls).\n- `out_of_scope` for generic accounting theory, legal questions, standards/laws, unrelated business or casual/offtopic chat.\n- `unclear` when intent may be accounting-related but insufficiently grounded in company context.\n\nbusiness_scope mapping:\n- `company_specific_accounting` for in-scope enterprise-data tasks.\n- `generic_accounting` for abstract accounting questions not tied to this company data.\n- `offtopic` for non-accounting content.\n- `unclear` when not enough signal.\n\nFragment policy:\n- Keep user wording in `raw_fragment_text`.\n- Make `normalized_fragment_text` concise and business-readable.\n- Populate `entity_hints/account_hints/document_hints/register_hints` only from message evidence.\n- `candidate_labels` can contain multiple labels. Do not force a single mandatory intent.\n- `fragment_id` must be stable and sequential: F1, F2, F3...\n\nFlag policy:\n- has_multi_entity_scope: requires linking multiple accounting entities/documents/payments/postings.\n- asks_for_chain_explanation: asks to explain “why”, “where chain breaks”, or causal reconstruction.\n- asks_for_ranking_or_top: asks top/ranking/prioritized ordering.\n- asks_for_period_summary: asks broad period/company summary or slice.\n- asks_for_rule_check: asks control/rule compliance checks.\n- asks_for_anomaly_scan: asks suspicious zones/anomaly search.\n- asks_for_exact_object_trace: asks exact object trace (document number/ref/line).\n- asks_for_evidence: asks documentary/proof evidence.\n- mentions_period_close_context: explicit pre-close/close/reporting deadline context.\n\nDiscard policy:\n- Put chatter/noise/meta filler into `discarded_fragments` with reason.\n- Do not discard valid accounting tasks, even if wording is slang-like.\n\nConfidence policy:\n- high only for clear, explicit fragment semantics.\n- medium for normal ambiguity.\n- low for unclear or weakly grounded fragments.\n- scope_confidence reflects whole-message domain certainty.\n\nglobal_notes policy:\n- needs_clarification=true when period/object/scope is missing for reliable execution.\n- clarification_reason should be concrete and short.\n\nStrictness:\n- Output only valid JSON object matching `normalized_query_v2`.\n- No markdown, no prose, no extra fields.",
    "domainPrompt": "Контекст домена: бухгалтерия 1С/NDC.\n\nКлючевые счета:\n- 01, 02, 10, 41, 51, 60, 62, 68.02, 90, 97.\n\nТиповые сущности:\n- контрагент, договор, документ реализации, документ поступления, оплата, проводка, регистр, закрывающий документ.\n\nЛексика causal и сверки (сильные сигналы для cross_entity):\n- \"не бьется\", \"не сходится\", \"не видно\", \"не собралось\", \"повисло\", \"хвост\";\n- \"разложи по документам/оплатам/закрывающим\";\n- \"чем подтверждается\", \"где ошибка в цепочке\", \"что пошло криво\".\n\nЛексика точечного drilldown:\n- \"документ №...\", \"ref\", \"строка проводки\", \"покажи конкретную операцию\", \"точный source-of-record\".\n\nЛексика rule-based контроля:\n- \"проверь настройки\", \"ошибка срока/даты\", \"контроль 97/10/ОС\", \"нарушение правила учета\".\n\nЛексика обзорной аналитики:\n- \"рейтинг\", \"топ рисков\", \"в целом по компании\", \"перед закрытием периода\", \"приоритизация проверок\".\n\nВажное правило:\nЕсли в одном вопросе есть и риск-лексика, и цепочка document/payment/posting, не понижать задачу до чистого `store_feature_risk`.\nПриоритет у causal cross-entity семантики.",
    "fewShotExamples": "Q:\nПо поставщикам на конец месяца где хвосты по взаиморасчетам, разложи где рвется цепочка документов и оплат.\n\nExpected (fragment-level shape):\n{\n  \"message_in_scope\": true,\n  \"contains_multiple_tasks\": false,\n  \"fragments\": [\n    {\n      \"fragment_id\": \"F1\",\n      \"domain_relevance\": \"in_scope\",\n      \"business_scope\": \"company_specific_accounting\",\n      \"account_hints\": [\"60\"],\n      \"flags\": {\n        \"has_multi_entity_scope\": true,\n        \"asks_for_chain_explanation\": true,\n        \"asks_for_ranking_or_top\": false,\n        \"asks_for_period_summary\": false,\n        \"asks_for_rule_check\": false,\n        \"asks_for_anomaly_scan\": true,\n        \"asks_for_exact_object_trace\": false,\n        \"asks_for_evidence\": true,\n        \"mentions_period_close_context\": true\n      },\n      \"candidate_labels\": [\"cross_entity\", \"anomaly_probe\"]\n    }\n  ]\n}\n\nQ:\nСкажи как вообще по ФСБУ правильно закрывать 97 счет, и еще проверь у нас по июню подозрительные РБП.\n\nExpected (fragment-level shape):\n{\n  \"message_in_scope\": true,\n  \"contains_multiple_tasks\": true,\n  \"fragments\": [\n    {\n      \"fragment_id\": \"F1\",\n      \"domain_relevance\": \"out_of_scope\",\n      \"business_scope\": \"generic_accounting\",\n      \"flags\": {\n        \"asks_for_rule_check\": true,\n        \"asks_for_anomaly_scan\": false\n      },\n      \"candidate_labels\": []\n    },\n    {\n      \"fragment_id\": \"F2\",\n      \"domain_relevance\": \"in_scope\",\n      \"business_scope\": \"company_specific_accounting\",\n      \"account_hints\": [\"97\"],\n      \"flags\": {\n        \"asks_for_rule_check\": true,\n        \"asks_for_anomaly_scan\": true,\n        \"asks_for_period_summary\": false\n      },\n      \"candidate_labels\": [\"rule_based_account_control\", \"anomaly_probe\"]\n    }\n  ],\n  \"global_notes\": {\n    \"needs_clarification\": false\n  }\n}\n\nQ:\nДокумент TRX-88 покажи и связанную строку проводки, а еще где по банку повторяется паттерн подозрительных хвостов.\n\nExpected (fragment-level shape):\n{\n  \"message_in_scope\": true,\n  \"contains_multiple_tasks\": true,\n  \"fragments\": [\n    {\n      \"fragment_id\": \"F1\",\n      \"domain_relevance\": \"in_scope\",\n      \"business_scope\": \"company_specific_accounting\",\n      \"flags\": {\n        \"asks_for_exact_object_trace\": true,\n        \"asks_for_evidence\": true,\n        \"has_multi_entity_scope\": false\n      },\n      \"candidate_labels\": [\"drilldown_explain\"]\n    },\n    {\n      \"fragment_id\": \"F2\",\n      \"domain_relevance\": \"in_scope\",\n      \"business_scope\": \"company_specific_accounting\",\n      \"flags\": {\n        \"asks_for_anomaly_scan\": true,\n        \"asks_for_ranking_or_top\": true,\n        \"asks_for_period_summary\": true\n      },\n      \"candidate_labels\": [\"heavy_analytical\", \"anomaly_probe\"]\n    }\n  ]\n}",
    "userQuestion": "Какие реализации на конец периода выглядят так, будто они зависли и будут портить картину по выручке, если их не проверить заранее?",
    "context": {
      "eval_label": "eval-aOEoelkQb2",
      "case_id": "BQ-001",
      "eval_mode": "single-pass-strict"
    },
    "retryPolicy": "single-pass-strict",
    "useMock": false
  },
  "raw_model_response": {
    "id": "resp_0412c9d2f11711b60069c1811a1eb481a0a296bde3f9241f19",
    "object": "response",
    "created_at": 1774289178,
    "status": "completed",
    "background": false,
    "billing": {
      "payer": "developer"
    },
    "completed_at": 1774289204,
    "error": null,
    "frequency_penalty": 0,
    "incomplete_details": null,
    "instructions": null,
    "max_output_tokens": 900,
    "max_tool_calls": null,
    "model": "gpt-4o-mini-2024-07-18",
    "output": [
      {
        "id": "msg_0412c9d2f11711b60069c1811b2fec81a09cf7f09b85d1f3a2",
        "type": "message",
        "status": "completed",
        "content": [
          {
            "type": "output_text",
            "annotations": [],
            "logprobs": [],
            "text": "{\n  \"schema_version\": \"normalized_query_v2\",\n  \"user_message_raw\": \"Какие реализации на конец периода выглядят так, будто они зависли и будут портить картину по выручке, если их не проверить заранее?\",\n  \"message_in_scope\": true,\n  \"scope_confidence\": \"high\",\n  \"contains_multiple_tasks\": false,\n  \"fragments\": [\n    {\n      \"fragment_id\": \"F1\",\n      \"raw_fragment_text\": \"Какие реализации на конец периода выглядят так, будто они зависли и будут портить картину по выручке, если их не проверить заранее?\",\n      \"normalized_fragment_text\": \"Проверка зависших реализаций на конец периода.\",\n      \"domain_relevance\": \"in_scope\",\n      \"business_scope\": \"company_specific_accounting\",\n      \"entity_hints\": [],\n      \"account_hints\": [],\n      \"document_hints\": [],\n      \"register_hints\": [],\n      \"time_scope\": {\n        \"type\": \"explicit\",\n        \"value\": \"конец периода\",\n        \"confidence\": \"high\"\n      },\n      \"flags\": {\n        \"has_multi_entity_scope\": true,\n        \"asks_for_chain_explanation\": true,\n        \"asks_for_ranking_or_top\": false,\n        \"asks_for_period_summary\": false,\n        \"asks_for_rule_check\": false,\n        \"asks_for_anomaly_scan\": true,\n        \"asks_for_exact_object_trace\": false,\n        \"asks_for_evidence\": false,\n        \"mentions_period_close_context\": true\n      },\n      \"candidate_labels\": [\"anomaly_probe\", \"cross_entity\"]\n   \n   \t\t, \"confidence\": \"high\"\n    }\n  ],\n  \"discarded_fragments\": [],\n  \"global_notes\": {\n    \"needs_clarification\": false\n  \n \t, \"clarification_reason\": null\n  }\n}"
          }
        ],
        "role": "assistant"
      }
    ],
    "parallel_tool_calls": true,
    "presence_penalty": 0,
    "previous_response_id": null,
    "prompt_cache_key": null,
    "prompt_cache_retention": null,
    "reasoning": {
      "effort": null,
      "summary": null
    },
    "safety_identifier": null,
    "service_tier": "default",
    "store": true,
    "temperature": 0,
    "text": {
      "format": {
        "type": "json_schema",
        "description": null,
        "name": "normalized_query_v2",
        "schema": {
          "$id": "normalized_query_v2",
          "title": "Normalized Query V2",
          "type": "object",
          "additionalProperties": false,
          "required": [
            "schema_version",
            "user_message_raw",
            "message_in_scope",
            "scope_confidence",
            "contains_multiple_tasks",
            "fragments",
            "discarded_fragments",
            "global_notes"
          ],
          "properties": {
            "schema_version": {
              "type": "string",
              "const": "normalized_query_v2"
            },
            "user_message_raw": {
              "type": "string",
              "minLength": 1
            },
            "message_in_scope": {
              "type": "boolean"
            },
            "scope_confidence": {
              "type": "string",
              "enum": [
                "high",
                "medium",
                "low"
              ]
            },
            "contains_multiple_tasks": {
              "type": "boolean"
            },
            "fragments": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "fragment_id",
                  "raw_fragment_text",
                  "normalized_fragment_text",
                  "domain_relevance",
                  "business_scope",
                  "entity_hints",
                  "account_hints",
                  "document_hints",
                  "register_hints",
                  "time_scope",
                  "flags",
                  "candidate_labels",
                  "confidence"
                ],
                "properties": {
                  "fragment_id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "raw_fragment_text": {
                    "type": "string",
                    "minLength": 1
                  },
                  "normalized_fragment_text": {
                    "type": "string",
                    "minLength": 1
                  },
                  "domain_relevance": {
                    "type": "string",
                    "enum": [
                      "in_scope",
                      "out_of_scope",
                      "unclear"
                    ]
                  },
                  "business_scope": {
                    "type": "string",
                    "enum": [
                      "company_specific_accounting",
                      "generic_accounting",
                      "offtopic",
                      "unclear"
                    ]
                  },
                  "entity_hints": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "account_hints": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "document_hints": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "register_hints": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "time_scope": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "type",
                      "value",
                      "confidence"
                    ],
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "explicit",
                          "inferred",
                          "missing"
                        ]
                      },
                      "value": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "confidence": {
                        "type": "string",
                        "enum": [
                          "high",
                          "medium",
                          "low"
                        ]
                      }
                    }
                  },
                  "flags": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "has_multi_entity_scope",
                      "asks_for_chain_explanation",
                      "asks_for_ranking_or_top",
                      "asks_for_period_summary",
                      "asks_for_rule_check",
                      "asks_for_anomaly_scan",
                      "asks_for_exact_object_trace",
                      "asks_for_evidence",
                      "mentions_period_close_context"
                    ],
                    "properties": {
                      "has_multi_entity_scope": {
                        "type": "boolean"
                      },
                      "asks_for_chain_explanation": {
                        "type": "boolean"
                      },
                      "asks_for_ranking_or_top": {
                        "type": "boolean"
                      },
                      "asks_for_period_summary": {
                        "type": "boolean"
                      },
                      "asks_for_rule_check": {
                        "type": "boolean"
                      },
                      "asks_for_anomaly_scan": {
                        "type": "boolean"
                      },
                      "asks_for_exact_object_trace": {
                        "type": "boolean"
                      },
                      "asks_for_evidence": {
                        "type": "boolean"
                      },
                      "mentions_period_close_context": {
                        "type": "boolean"
                      }
                    }
                  },
                  "candidate_labels": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "heavy_analytical",
                        "cross_entity",
                        "drilldown_explain",
                        "rule_based_account_control",
                        "anomaly_probe",
                        "period_close_risk",
                        "ambiguous_human_query",
                        "simple_factual"
                      ]
                    }
                  },
                  "confidence": {
                    "type": "string",
                    "enum": [
                      "high",
                      "medium",
                      "low"
                    ]
                  }
                }
              }
            },
            "discarded_fragments": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "raw_fragment_text",
                  "reason"
                ],
                "properties": {
                  "raw_fragment_text": {
                    "type": "string",
                    "minLength": 1
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1
                  }
                }
              }
            },
            "global_notes": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "needs_clarification",
                "clarification_reason"
              ],
              "properties": {
                "needs_clarification": {
                  "type": "boolean"
                },
                "clarification_reason": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          }
        },
        "strict": true
      },
      "verbosity": "medium"
    },
    "tool_choice": "auto",
    "tools": [],
    "top_logprobs": 0,
    "top_p": 1,
    "truncation": "disabled",
    "usage": {
      "input_tokens": 2422,
      "input_tokens_details": {
        "cached_tokens": 0
      },
      "output_tokens": 391,
      "output_tokens_details": {
        "reasoning_tokens": 0
      },
      "total_tokens": 2813
    },
    "user": null,
    "metadata": {}
  },
  "parsed_normalized_json": {
    "schema_version": "normalized_query_v2",
    "user_message_raw": "Какие реализации на конец периода выглядят так, будто они зависли и будут портить картину по выручке, если их не проверить заранее?",
    "message_in_scope": true,
    "scope_confidence": "high",
    "contains_multiple_tasks": false,
    "fragments": [
      {
        "fragment_id": "F1",
        "raw_fragment_text": "Какие реализации на конец периода выглядят так, будто они зависли и будут портить картину по выручке, если их не проверить заранее?",
        "normalized_fragment_text": "Проверка зависших реализаций на конец периода.",
        "domain_relevance": "in_scope",
        "business_scope": "company_specific_accounting",
        "entity_hints": [],
        "account_hints": [],
        "document_hints": [],
        "register_hints": [],
        "time_scope": {
          "type": "explicit",
          "value": "конец периода",
          "confidence": "high"
        },
        "flags": {
          "has_multi_entity_scope": true,
          "asks_for_chain_explanation": true,
          "asks_for_ranking_or_top": false,
          "asks_for_period_summary": false,
          "asks_for_rule_check": false,
          "asks_for_anomaly_scan": true,
          "asks_for_exact_object_trace": false,
          "asks_for_evidence": false,
          "mentions_period_close_context": true
        },
        "candidate_labels": [
          "anomaly_probe",
          "cross_entity"
        ],
        "confidence": "high"
      }
    ],
    "discarded_fragments": [],
    "global_notes": {
      "needs_clarification": false,
      "clarification_reason": null
    }
  },
  "validation_result": {
    "passed": true,
    "errors": []
  },
  "route_hint_summary": {
    "mode": "deterministic_v2",
    "message_in_scope": true,
    "scope_confidence": "high",
    "planner": {
      "total_fragments": 1,
      "in_scope_fragments": 1,
      "out_of_scope_fragments": 0,
      "discarded_fragments": 0,
      "contains_multiple_tasks": false
    },
    "decisions": [
      {
        "fragment_id": "F1",
        "domain_relevance": "in_scope",
        "business_scope": "company_specific_accounting",
        "candidate_labels": [
          "anomaly_probe",
          "cross_entity"
        ],
        "decision_flags": {
          "has_multi_entity_scope": true,
          "asks_for_chain_explanation": true,
          "asks_for_ranking_or_top": false,
          "asks_for_period_summary": false,
          "asks_for_rule_check": false,
          "asks_for_anomaly_scan": true,
          "asks_for_exact_object_trace": false,
          "asks_for_evidence": false,
          "mentions_period_close_context": true
        },
        "route": "hybrid_store_plus_live",
        "reason": "Multi-entity causal chain requested."
      }
    ],
    "fallback": {
      "type": "none",
      "message": null
    }
  },
  "route_hint": "hybrid_store_plus_live",
  "confidence": "high",
  "usage": {
    "input_tokens": 2422,
    "output_tokens": 391,
    "total_tokens": 2813
  },
  "latency_ms": 28329,
  "eval_label": "eval-aOEoelkQb2",
  "eval_mode": "single-pass-strict",
  "request_count_for_case": 1
}