| # Complete Reference Trajectory Configuration - MarkdownValidator Project | |
| # | |
| # Version: Ideal trajectory based on code design (applicable to all models) | |
| # Principle: Only includes steps explicitly required by code design, not based on test statistics | |
| # | |
| # Code Design Analysis: | |
| # 1. Single Agent executing single Task: | |
| # - Requirements Manager: Uses markdown_validation_tool to analyze Markdown file and generate JSON report | |
| # | |
| # 2. Tool Usage Analysis: | |
| # - markdown_validation_tool defined via @tool decorator | |
| # - Tool specifically configured for Requirements Manager | |
| # - tasks.yaml requires calling this tool to validate file | |
| # - Tool invocation is necessary step to complete task | |
| # | |
| # 3. Execution Flow: | |
| # - Process.sequential: Sequential execution (though only one Task) | |
| # - Agent executes Task, uses LLM to decide tool invocation, then uses LLM to generate final JSON | |
| # | |
| # 4. Differences from Other Projects: | |
| # - Only 1 Agent, 1 Task, 1 Tool | |
| # - Simpler, more direct execution flow | |
| # - Focus is on correct tool usage and JSON format output | |
| # Project name | |
| project_name: "MarkdownValidator" | |
| # Trajectory extraction type configuration | |
| # Per user requirements, focus on: SPAN, Chain, AGENT, LLM, Tool | |
| # Ignore: Task Created, Crew Created and other non-core content | |
| extract_types: | |
| - "SPAN" # Level 1: Top-level execution span | |
| - "Chain" # Level 2: Crew execution chain | |
| - "AGENT" # Level 3: Agent execution | |
| - "LLM" # Level 4: LLM invocation | |
| - "Tool" # Level 4: Tool invocation | |
| # Reference Trajectory (Ground Truth) - Based on Code Design | |
| # | |
| # Graphical Structure (Ideal Execution Path): | |
| # | |
| # [SPAN] markdown_validation | |
| # └─ [Chain] Crew***.kickoff | |
| # └─ [AGENT] Requirements Manager ← Task: syntax_review_task | |
| # ├─ [LLM] * ← Decide to use tool for validation | |
| # ├─ [Tool] markdown_validation_tool ← Call PyMarkdown to validate file | |
| # └─ [LLM] * ← Process validation results and generate JSON output | |
| # | |
| # Design Rationale: | |
| # - crew.py: Defines 1 Agent (Requirements_Manager) and 1 Task (syntax_review_task) | |
| # - tasks.yaml: Explicitly requires using markdown_validation_tool and outputting JSON format report | |
| # - main.py line 270: SPAN name is "markdown_validation" | |
| # - agents.yaml: Agent role is "Requirements Manager" | |
| # - markdownTools.py: Tool name is "markdown_validation_tool" | |
| # | |
| # Ideal Trajectory Explanation: | |
| # - Requirements Manager: 2 LLM calls + 1 tool call | |
| # 1. First LLM: Analyze task, decide to use tool | |
| # 2. Tool call: markdown_validation_tool validates file | |
| # 3. Second LLM: Process tool results, generate JSON format report | |
| # - This trajectory represents ideal, no-retry, no-redundancy execution path | |
| # | |
| # Notes: | |
| # - "LLM: *" represents any LLM model (wildcard match) | |
| # - Agent name is "Requirements Manager" (role field, with space) | |
| # - Tool name is "markdown_validation_tool" (function name) | |
| # - Actual execution may include more LLM calls (thinking, planning, etc.), which is normal | |
| reference_trajectory: | |
| # Level 1: SPAN | |
| - "SPAN: markdown_validation" | |
| # Level 2: Chain (wildcard handling for UUID) | |
| - "Chain: Crew***.kickoff" | |
| # Task: syntax_review_task | |
| # Requirements Manager validates Markdown file and generates report | |
| - "Agent: Requirements Manager" | |
| - "LLM: *" # First call: decide to use tool | |
| - "Tool: markdown_validation_tool" # Call validation tool | |
| - "LLM: *" # Second call: generate JSON report | |
| # Target tools list (for single-tool use metric) | |
| # Only includes actual tool calls, used to detect tool usage | |
| target_tools: | |
| - "Tool: markdown_validation_tool" | |
| # Models to evaluate | |
| models: | |
| - "GPT-5" | |
| - "GPT-4o-mini" | |
| - "DeepSeek-V3-1" | |
| - "DeepSeek-R1" | |
| - "Gemini-2.5-flash" | |
| - "Gemini-2.5-flash-nothinking" | |
| - "Qwen3-235b" | |
| # Usage Instructions | |
| # | |
| # 1. Trajectory Hierarchy: | |
| # - Level 1: SPAN (markdown_validation) | |
| # - Level 2: Chain (Crew***.kickoff, wildcard handles UUID) | |
| # - Level 3: AGENT (Requirements Manager, exact match) | |
| # - Level 4: LLM (wildcard matches any model) | |
| # - Level 4: Tool (markdown_validation_tool, exact match) | |
| # | |
| # 2. Wildcard Handling: | |
| # - Crew_<UUID>.kickoff -> Crew***.kickoff (evaluate_trajectory.py auto-handles) | |
| # - LLM: * -> Matches any model name (e.g., gpt-4o-mini, deepseek-r1, etc.) | |
| # | |
| # 3. Exact Match Requirements: | |
| # - SPAN name: "markdown_validation" (exact match) | |
| # - Chain name: "Crew***.kickoff" (wildcard match) | |
| # - AGENT name: "Requirements Manager" (exact match with agent.yaml role) | |
| # - LLM name: "LLM: *" (wildcard matches any model) | |
| # - Tool name: "markdown_validation_tool" (exact match with tool function name) | |
| # | |
| # 4. Evaluation Metrics Meaning: | |
| # - Exact Match: Requires trajectory to be completely identical (including LLM call count) | |
| # - In-order Match: Allows extra calls, but core steps must appear in order | |
| # - Any-order Match: Just needs to contain all necessary steps (ignores order) | |
| # - Precision: Proportion of correct steps in predicted trajectory | |
| # - Recall: Proportion of reference trajectory steps covered | |
| # - Single-tool Use: Detects markdown_validation_tool usage | |
| # - unique_path_ratio: Path diversity (unique complete trajectories / samples) | |
| # - path_entropy: Path entropy (Shannon entropy based on trajectory frequency, normalized 0-1) | |
| # | |
| # 5. Run Command: | |
| # cd /Users/wzr/TOSEM-2025/RESULTS/RQ-Failure_Breakdown/MarkdownValidator | |
| # python3 evaluate_trajectory.py --config reference_trajectory.yaml | |
| # | |
| # 6. Design Notes: | |
| # - This reference trajectory represents ideal execution path | |
| # - Requirements Manager: 2 LLM calls + 1 tool call | |
| # * First LLM: Analyze task and decide to use tool | |
| # * Tool call: Validate Markdown file | |
| # * Second LLM: Process results and generate JSON output | |
| # - Total: 2 LLM calls + 1 tool call | |
| # - In-order Match and Any-order Match metrics better suited for evaluating actual performance | |
| # | |
| # 7. Differences from Actual Trajectories: | |
| # - Actual trajectories may include more LLM calls (thinking, planning, execution, summary, etc.) | |
| # - Some models may call validation tool multiple times (retry or extra checks) | |
| # - These differences don't represent errors, but different model execution strategies | |
| # - Exact Match scores may be low, focus on In-order Match and Recall | |
| # | |
| # 8. Project Characteristics: | |
| # - Simple structure: 1 Agent, 1 Task, 1 Tool | |
| # - Clear task: Validate Markdown and generate JSON report | |
| # - Tool usage is required (tasks.yaml explicitly requires) | |
| # - Suitable for evaluating model tool invocation capability and JSON generation quality | |