# 数据源字段说明 ## main:`arch-flat-nlp-log-f-*` 适合拿最终线上请求结果。 常用字段: | 字段 | 含义 | | --- | --- | | `request_id` | 请求 id,和 product-data 的 `request_id` 对齐。 | | `timestamp` | 请求时间戳。 | | `query` | 当前 query。 | | `domain` | 最终 domain。 | | `func` / `func_name` | 最终 function 或函数名。 | | `session_id` | 会话 id,可用于后续重建多轮。 | | `device_id` | 设备 id。 | | `device` | 设备 JSON,包含设备类型、经纬度等。 | | `text` / `display_text` / `to_speak` | 小爱回复文本,可作为上一轮 tts。 | | `intention` | 传统意图结果。 | | `intention.intent_arbitrator_info` | 中控仲裁信息,含 `llm_agent_info`、`score_domains`、`hit_rules` 等。 | | `llm_*` | 大模型分类相关字段,覆盖情况取决于链路。 | 适合筛选: - `query` 包含/正则。 - `domain`、`func`、`func_name`。 - `session_id`、`device_id`、设备类型。 - `intention.intent_arbitrator_info.llm_agent_info.agentType`。 ## pre_processing:`pre-processing*` 适合拿前处理和规划模型判断过程。 常用字段: | 路径 | 含义 | | --- | --- | | `requestId` | 请求 id。 | | `timestamp` | 前处理日志时间戳。 | | `responseBoby.nodes.0.core.query.query` | 当前 query。注意字段名是 `responseBoby`。 | | `responseBoby.nodes.0.core.dispatch_large_model_result.code` | 前处理最终 code。 | | `responseBoby.nodes.0.core.dispatch_large_model_result.dispatchLargeModelInput.promptModel` | planning 模型 prompt。 | | `responseBoby.nodes.0.core.dispatch_large_model_result.dispatchLargeModelInput.hitRuleList` | 触发规则。 | | `responseBoby.nodes.0.core.dispatch_large_model_result.planningDebugInfo.planningOriginalResult` | planning 模型原始输出。 | | `responseBoby.nodes.0.core.excellent_domains_result` | 候选 domain 及旧意图结果。 | | `responseBoby.nodes.0.properties.0.debug.domain_infos` | 前处理召回 domain 列表。 | | `responseBoby.nodes.0.properties.0.debug.promptString` | agent LLM prompt。 | | `responseBoby.nodes.0.properties.0.debug.planningPrompt` | planning prompt。 | | `responseBoby.nodes.0.properties.0.agentLLMIntent` | agent LLM 判定。 | 适合筛选: - `query` 包含/正则。 - `planningOriginalResult` 包含某标签或 function。 - `promptModel` 包含某上下文、历史或 query 结构。 - `excellent_domains_result[*].domain` 包含某候选 domain。 - `domain_infos[*].domain` 包含某召回 domain。 ## join 规则 两张表通过: ```text main.request_id == pre_processing.requestId ``` 精确查询时优先使用 keyword 字段: ```text main.request_id.keyword pre_processing.requestId.keyword ``` join 后优先使用: - query:优先 `pre_processing` 的 query,缺失时用 `main.query`。 - timestamp:优先 `main.timestamp`,缺失时用 `pre_processing.timestamp`。 - tts:优先 `main.to_speak`,再 `main.text` 或 `display_text`。 - label 参考:模型输出用 `pre_processing.planning_result`,线上最终结果用 `main.domain` / `main.func`。 ## 转 canonical record 的字段映射 `build_online_records.py` 固定执行以下映射,模型不要手写转换逻辑: | canonical 字段 | 来源 | | --- | --- | | `source.type` | 固定 `online` | | `source.request_id` | 主表 `request_id` 或前处理表 `requestId` | | `source.timestamp` | 优先主表 `timestamp`,缺失时用前处理表 `timestamp` | | `turn.query` | 优先前处理 `responseBoby.nodes.0.core.query.query`,缺失时用主表 `query` | | `turn.timestamp` | 同 `source.timestamp` | | `prev_session` | 主表同 `session_id` 且 timestamp 早于当前请求的最多 10 轮,按时间升序排列 | | `prev_session[].query` | 主表历史轮 `query` | | `prev_session[].tts` | 主表历史轮 `to_speak/text/display_text`,没有时保留空字符串 | | `prev_session[].timestamp` | 主表历史轮 `timestamp` | | `context` | 先置 `{}`,后续由专用工具补充 | | `label.dataset_label` | 用户输入的批次标签 | | `label.target` | 用户输入 `target`;否则依次用前处理 `code`、`planningOriginalResult`、主表 `llm_agent_info.agentType`、主表 `domain` 推断 | | `dimensions.complex` | 用户输入,默认 false | | `meta` | 保存 `session_id/device_id/device/main_domain/main_func/planning_result/planning_code/hit_rules/candidate_domains/target_source` | ## 按 rid 转数据的固定流程 当用户说“把这个 rid 的数据拉下来作为测试数据”时: 1. 如果用户没给日期,先用近 48 小时查;查不到就问用户日期,不要继续生成空数据。 2. 调用 `build_online_records.py`,传 `request_ids`、`dataset_label`、必要时传 `target/complex/date`。 3. 检查返回的 `summaries[].target_source` 和 `prev_session_count`。 4. 展示 query、target、target_source、prev_session_count 给用户确认。 5. 产物默认在当前会话 `output/records.jsonl` 和 `output/records.csv`。