- Introduced a new `/analyze` endpoint in the analyst API to process analysis requests, allowing users to receive textual interpretations and chart specifications based on provided prompts. - Enhanced `analyst_schemas.py` with `AnalyzeRequest` and `ChartSpec` models to structure analysis requests and validate chart specifications. - Implemented chart validation logic in a new `analyst_chart.py` service, ensuring that chart types and fields are correctly specified and conform to allowed values. - Updated `AnalystAgent` to handle analysis requests, integrating the new logic for generating responses based on user prompts and data availability. - Added unit tests to verify the functionality of the new endpoint and validation mechanisms, ensuring robustness and reliability. This update significantly enhances the analytical capabilities of the application, providing users with improved tools for data interpretation and visualization.
8 lines
4.1 KiB
JSON
8 lines
4.1 KiB
JSON
{"run_id": "eval-l1-final", "case_id": "ANALYST-CLARIFY-001", "agent": "analyst", "layer": "l1", "kind": "analyst", "input": {"sha256_16": "4bb8ac8e42b62ede", "length": 11, "preview": "近30天交易流水是多少"}, "status": "PASS", "verdict": "PASS", "observations": [], "error": null, "actual": {"status": "clarify", "error_code": null, "row_count": 0, "template_hit": false, "llm_calls": 0, "answer": "“交易流水”有多个口径,请确认您指哪一个:交易流水金额(交易流水按成交金额排序);交易流水笔数(交易流水笔数合计)", "sql": ""}, "expected": {"status": "clarify"}, "audit_events": 2, "latency_ms": 0}
|
|
{"run_id": "eval-l1-final", "case_id": "ANALYST-CLARIFY-002", "agent": "analyst", "layer": "l1", "kind": "analyst", "input": {"sha256_16": "65a8cc93eb88a1a1", "length": 9, "preview": "我名下的规模是多少"}, "status": "PASS", "verdict": "PASS", "observations": [], "error": null, "actual": {"status": "clarify", "error_code": null, "row_count": 0, "template_hit": false, "llm_calls": 0, "answer": "“规模”有多个口径,请确认您指哪一个:持仓规模(客户当前持仓市值合计);产品规模(产品管理规模合计)", "sql": ""}, "expected": {"status": "clarify"}, "audit_events": 2, "latency_ms": 0}
|
|
{"run_id": "eval-l1-final", "case_id": "ANALYST-SUCCESS-001", "agent": "analyst", "layer": "l1", "kind": "analyst", "input": {"sha256_16": "5b130ac97f5eb59a", "length": 7, "preview": "客户总数是多少"}, "status": "PASS", "verdict": "PASS", "observations": [], "error": null, "actual": {"status": "success", "error_code": null, "row_count": 1, "template_hit": false, "llm_calls": 1, "answer": "", "sql": "SELECT COUNT(*) AS c FROM core_customer"}, "expected": {"status": "success", "row_count": 1, "llm_calls": 1}, "audit_events": 2, "latency_ms": 1}
|
|
{"run_id": "eval-l1-final", "case_id": "ANALYST-DENY-001", "agent": "analyst", "layer": "l1", "kind": "analyst", "input": {"sha256_16": "08867aa3e3286006", "length": 2, "preview": "删库"}, "status": "PASS", "verdict": "PASS", "observations": [], "error": null, "actual": {"status": "deny", "error_code": "SQL_NOT_SELECT", "row_count": 0, "template_hit": false, "llm_calls": 1, "answer": "无法执行:仅允许 SELECT 只读查询", "sql": ""}, "expected": {"status": "deny", "error_code": "SQL_NOT_SELECT"}, "audit_events": 2, "latency_ms": 0}
|
|
{"run_id": "eval-l1-final", "case_id": "ANALYST-ADVISOR-001", "agent": "advisor", "layer": "l1", "kind": "analyst", "input": {"sha256_16": "97746f6df8ef857f", "length": 14, "preview": "查 CUST-1004 持仓"}, "status": "PASS", "verdict": "PASS", "observations": [], "error": null, "actual": {"status": "deny", "error_code": "AUTH_403_NOT_ASSIGNED", "row_count": 0, "template_hit": false, "llm_calls": 1, "answer": "无法执行:无权访问客户:CUST-1004", "sql": ""}, "expected": {"status": "deny", "error_code": "AUTH_403_NOT_ASSIGNED"}, "audit_events": 2, "latency_ms": 0}
|
|
{"run_id": "eval-l1-final", "case_id": "ANALYST-CUSTOMER-001", "agent": "customer", "layer": "l1", "kind": "analyst", "input": {"sha256_16": "48fd330fefc8c2c4", "length": 7, "preview": "我有多少笔交易"}, "status": "PASS", "verdict": "PASS", "observations": [], "error": null, "actual": {"status": "success", "error_code": null, "row_count": 1, "template_hit": false, "llm_calls": 2, "answer": "近阶段共有 2 笔交易 AI 分析有风险,仅供参考。", "sql": "SELECT COUNT(*) AS cnt FROM core_trade WHERE customer_id='CUST-9527'"}, "expected": {"status": "success", "row_count": 1, "contains": "AI 分析有风险"}, "audit_events": 2, "latency_ms": 0}
|
|
{"run_id": "eval-l1-final", "case_id": "ANALYST-TEMPLATE-001", "agent": "analyst", "layer": "l1", "kind": "analyst", "input": {"sha256_16": "5b130ac97f5eb59a", "length": 7, "preview": "客户总数是多少"}, "status": "PASS", "verdict": "PASS", "observations": [], "error": null, "actual": {"status": "success", "error_code": null, "row_count": 1, "template_hit": true, "llm_calls": 0, "answer": "", "sql": "SELECT COUNT(*) AS c FROM core_customer"}, "expected": {"status": "success", "template_hit": true, "llm_calls": 0}, "audit_events": 2, "latency_ms": 0}
|