Files
group_xinghuo_jinrong/tests/eval/test_l2_api_eval.py
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

31 lines
1.0 KiB
Python

from __future__ import annotations
from scripts.eval.l2_api_eval import build_environment, run_l2_contract
def test_l2_contract_passes():
report = run_l2_contract()
assert report["total"] == 5
assert report["passed"] == 5
assert report["failed"] == 0
assert report["cleanup"] == "in_memory_disposed"
def test_l2_environment_restores_module_globals():
from scripts.eval import l2_api_eval
originals = {
"chat_repo": l2_api_eval.chat_mod._repo,
"chat_session_repo": l2_api_eval.chat_mod._session_repo,
"redis_gateway": l2_api_eval.redis_gateway._gateway,
"llm": l2_api_eval.agent_service._llm,
}
environment = build_environment(chunks=["eval"])
environment.close()
assert l2_api_eval.chat_mod._repo is originals["chat_repo"]
assert l2_api_eval.chat_mod._session_repo is originals["chat_session_repo"]
assert l2_api_eval.redis_gateway._gateway is originals["redis_gateway"]
assert l2_api_eval.agent_service._llm is originals["llm"]