| # SQLAssistant-H_A2A Evaluation Scripts |
| |
| This directory contains evaluation scripts for the SQLAssistant-H_A2A project, which analyzes the execution trajectories and performance metrics of different AI models. |
|
|
| ## Files |
|
|
| ### Configuration |
| - `reference_trajectory.yaml` - Reference trajectory configuration defining the expected execution path for the SQLAssistant workflow |
|
|
| ### Evaluation Scripts |
| - `evaluate_trajectory-Filter_Tools-mix.py` - Main trajectory evaluation script that computes 6 trajectory metrics |
| - `evaluate_success.py` - Success rate analysis based on required tool execution |
| - `evaluate_scores.py` - Score statistics collection from execution logs |
| - `analyze_retry_patterns.py` - RETRY pattern analysis including business retries and orchestrator retries |
|
|
| ## Trajectory Metrics |
|
|
| The evaluation framework computes the following 6 metrics: |
|
|
| 1. **Exact Match** - Predicted trajectory must exactly match the reference trajectory |
| 2. **In-Order Match** - Reference trajectory must be a subsequence of predicted trajectory |
| 3. **Any-Order Match** - Predicted trajectory must contain all necessary actions (order-agnostic) |
| 4. **Precision** - Ratio of correct actions in predicted trajectory |
| 5. **Recall** - Ratio of reference actions covered by predicted trajectory |
| 6. **Single-Tool Use** - Usage rate of specific tools |
|
|
| Additional diversity metrics: |
| - **Unique Path Ratio** - Number of unique trajectories / total samples |
| - **Path Entropy** - Shannon entropy of trajectory distribution |
|
|
| ## Usage |
|
|
| ### Trajectory Evaluation |
| ```bash |
| python3 evaluate_trajectory-Filter_Tools-mix.py --config reference_trajectory.yaml |
| ``` |
|
|
| Options: |
| - `--config` - Path to reference trajectory configuration file (YAML format) |
| - `--base-dir` - RESULTS directory path (defaults to two levels up from script location) |
| - `--output` - Output CSV file path |
| - `--diagnose-failures` - Diagnose any_order_match failure reasons and generate report |
|
|
| ### Success Rate Analysis |
| ```bash |
| python3 evaluate_success.py |
| ``` |
|
|
| Success criterion: Whether the `get_database_schema` tool was executed (required for understanding database structure). |
|
|
| ### Score Statistics |
| ```bash |
| python3 evaluate_scores.py |
| ``` |
|
|
| Collects and analyzes scores from execution logs. |
|
|
| ### Retry Pattern Analysis |
| ```bash |
| python3 analyze_retry_patterns.py |
| ``` |
|
|
| Analyzes two types of retries: |
| 1. **Orchestrator RETRY** - Framework-level retries (e.g., `[SPAN] crew_execution (retry N)`) |
| 2. **BUSINESS-RETRY** - Business logic retries (e.g., `[SPAN] generate_sql (business_retry N)`) |
|
|
| ## Models Evaluated |
|
|
| - GPT-5 |
| - GPT-4o-mini |
| - DeepSeek-V3-1 |
| - DeepSeek-R1 |
| - Gemini-2.5-flash |
| - Gemini-2.5-flash-nothinking |
| - Qwen3-235b |
|
|
| ## Project Structure |
|
|
| The SQLAssistant-H_A2A project uses a hybrid architecture combining: |
| - **CrewAI** for SQL generation stage |
| - **LangGraph** for compliance checking stage |
| - **AutoGen** for result interpretation stage |
| |
| ### Workflow Stages |
| |
| 1. **Generate SQL** - CrewAI-based SQL generation with two agents: |
| - Expert SQL Query Generator |
| - Senior SQL Code Reviewer |
| |
| 2. **Check Compliance** - LangGraph orchestration for compliance validation |
| |
| 3. **Interpret Results** - AutoGen-based result interpretation and SQL execution |
| |
| ## Output Files |
| |
| - `evaluation_results.csv` - Trajectory evaluation results for all models |
| - `success_rate.csv` - Success rate summary |
| - `success_detailed_results.json` - Detailed success analysis |
| - `score_summary.csv` - Score statistics summary |
| - `score_analysis.json` - Detailed score analysis |
| - `retry_summary.csv` - Retry pattern summary |
| - `retry_analysis.json` - Detailed retry analysis |
| - `error_by_agent.csv` - Error statistics by agent |
| - `business_retry_chapters.csv` - Business retry location statistics |
| - `any_order_match_failures.csv` - Failure diagnosis (if enabled) |
|
|
| ## Requirements |
|
|
| - Python 3.x |
| - pandas |
| - PyYAML |
| - pathlib |
| - collections |
| - json |
| - csv |
| - re |
| - math |
|
|