Add training and planning eval exports

This commit is contained in:
wuyang6
2026-05-11 14:50:00 +08:00
parent 8cca3793e0
commit be731caed7
15 changed files with 1074 additions and 4 deletions
+98
View File
@@ -547,4 +547,102 @@ def build_data_agent_tools(handlers: Mapping[str, ToolHandler]) -> list[AgentToo
},
handler=resolve_handler(handlers, 'data_agent_export_dataset_records', 'data-agent'),
),
AgentTool(
name='data_agent_export_training_jsonl',
description=(
'Convert canonical data-agent records into training JSONL. Each line has system, instruction, '
'and output. The instruction contains 知识注入, 系统状态, 对话历史, 当前query, and function sections.'
),
parameters={
'type': 'object',
'properties': {
'records': {
'oneOf': [
{'type': 'array'},
{'type': 'string'},
],
'description': 'Canonical records as an array, or a JSON string containing the array. Provide exactly one of records or records_path.',
},
'records_path': {
'type': 'string',
'description': 'Path to records JSON/JSONL. Prefer this when records are large. Provide exactly one of records or records_path.',
},
'output_path': {
'type': 'string',
'description': 'Optional requested path. Runtime normalizes to current session output/training.jsonl.',
},
'session_num': {
'type': 'integer',
'minimum': 1,
'description': 'Max history queries to include. Defaults to 5.',
},
'session_time_minutes': {
'type': 'integer',
'minimum': 1,
'description': 'Max adjacent history gap in minutes. Defaults to 5.',
},
'context_fields': {
'type': 'array',
'items': {'type': 'string'},
'description': 'Context fields to inject. Defaults to ["location", "rag"].',
},
'system_prompt': {
'type': 'string',
'description': 'Defaults to 你是小爱同学,中文智能语音助手。',
},
'require_validation_ok': {'type': 'boolean'},
'overwrite': {'type': 'boolean'},
},
},
handler=resolve_handler(handlers, 'data_agent_export_training_jsonl', 'data-agent'),
),
AgentTool(
name='data_agent_export_planning_eval_csv',
description=(
'Convert canonical data-agent records into evaluation CSV with columns: request_id, newPrompt, '
'query, 类别真实标签, code标签, complex. newPrompt uses the same prompt body as training instruction.'
),
parameters={
'type': 'object',
'properties': {
'records': {
'oneOf': [
{'type': 'array'},
{'type': 'string'},
],
'description': 'Canonical records as an array, or a JSON string containing the array. Provide exactly one of records or records_path.',
},
'records_path': {
'type': 'string',
'description': 'Path to records JSON/JSONL. Prefer this when records are large. Provide exactly one of records or records_path.',
},
'output_path': {
'type': 'string',
'description': 'Optional requested path. Runtime normalizes to current session output/eval_planning.csv.',
},
'session_num': {
'type': 'integer',
'minimum': 1,
'description': 'Max history queries to include. Defaults to 5.',
},
'session_time_minutes': {
'type': 'integer',
'minimum': 1,
'description': 'Max adjacent history gap in minutes. Defaults to 5.',
},
'context_fields': {
'type': 'array',
'items': {'type': 'string'},
'description': 'Context fields to inject. Defaults to ["location", "rag"].',
},
'complex_default': {
'type': 'boolean',
'description': 'Default complex column value. Defaults to false.',
},
'require_validation_ok': {'type': 'boolean'},
'overwrite': {'type': 'boolean'},
},
},
handler=resolve_handler(handlers, 'data_agent_export_planning_eval_csv', 'data-agent'),
),
]