Files
group_xinghuo_jinrong/scripts/eval/cases/analyst.jsonl
T
zhanghongyu_0626 a0f550646e feat(analyst): Add analyze endpoint and chart specification validation
- 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.
2026-09-12 12:33:37 +08:00

8 lines
2.3 KiB
JSON

{"case_id":"ANALYST-CLARIFY-001","kind":"analyst","agent":"analyst","layer":"l1","question":"近30天交易流水是多少","auth":{"roles":["analyst"],"subject_id":"STAFF-A","token_type":"staff"},"expected":{"status":"clarify"}}
{"case_id":"ANALYST-CLARIFY-002","kind":"analyst","agent":"analyst","layer":"l1","question":"我名下的规模是多少","auth":{"roles":["analyst"],"subject_id":"STAFF-A","token_type":"staff"},"expected":{"status":"clarify"}}
{"case_id":"ANALYST-SUCCESS-001","kind":"analyst","agent":"analyst","layer":"l1","question":"客户总数是多少","auth":{"roles":["analyst"],"subject_id":"STAFF-A","token_type":"staff"},"fake_sql":"SELECT COUNT(*) AS c FROM core_customer","fake_rows":[[33]],"fake_columns":["c"],"expected":{"status":"success","row_count":1,"llm_calls":1}}
{"case_id":"ANALYST-DENY-001","kind":"analyst","agent":"analyst","layer":"l1","question":"删库","auth":{"roles":["analyst"],"subject_id":"STAFF-A","token_type":"staff"},"fake_sql":"INSERT INTO core_customer VALUES (1)","expected":{"status":"deny","error_code":"SQL_NOT_SELECT"}}
{"case_id":"ANALYST-ADVISOR-001","kind":"analyst","agent":"advisor","layer":"l1","question":"查 CUST-1004 持仓","auth":{"roles":["advisor"],"subject_id":"STAFF-B","token_type":"staff"},"scope":["CUST-1001"],"fake_sql":"SELECT * FROM core_holding WHERE customer_id='CUST-1004'","expected":{"status":"deny","error_code":"AUTH_403_NOT_ASSIGNED"}}
{"case_id":"ANALYST-CUSTOMER-001","kind":"analyst","agent":"customer","layer":"l1","question":"我有多少笔交易","auth":{"roles":["customer"],"subject_id":"CUST-9527","token_type":"customer","customer_id":"CUST-9527"},"fake_sql":"SELECT COUNT(*) AS cnt FROM core_trade WHERE customer_id='CUST-9527'","fake_rows":[[2]],"fake_columns":["cnt"],"interpret":true,"fake_answers":["近阶段共有 2 笔交易"],"expected":{"status":"success","row_count":1,"contains":"AI 分析有风险"}}
{"case_id":"ANALYST-TEMPLATE-001","kind":"analyst","agent":"analyst","layer":"l1","question":"客户总数是多少","auth":{"roles":["analyst"],"subject_id":"STAFF-A","token_type":"staff"},"template_sql":"SELECT COUNT(*) AS c FROM core_customer","template_key":"customer_total_count","fake_rows":[[33]],"fake_columns":["c"],"expected":{"status":"success","template_hit":true,"llm_calls":0}}