This guide describes the audience and explanation type capabilities in the prompt testing framework.
The prompt testing system supports testing prompts across different audiences and explanation types, matching the capabilities in the main explain API.
- beginner: Simple language, technical terms defined, step-by-step explanations
- experienced: Assumes assembly knowledge, focuses on compiler behavior, optimizations, and architectural details
- assembly: Focus on assembly instructions and their purpose
Test cases can now specify audience and explanation type:
cases:
- id: example_beginner_assembly
audience: beginner # Optional, defaults to "beginner"
explanation_type: assembly # Optional, defaults to "assembly"
expected_topics_by_audience: # Optional audience-specific expectations
beginner: [basic_concepts, simple_terms]
experienced: [compiler_behavior, register_usage, microarchitecture, advanced_optimizations]
# ... rest of test caseuv run prompt-test run --prompt current --audience beginneruv run prompt-test run --prompt current --explanation-type optimizationuv run prompt-test run --prompt current --audience experienced --explanation-type optimizationThe automatic scorer now adjusts expectations based on audience:
-
Clarity scoring:
- Beginners: Shorter sentences, fewer technical terms, more explanatory language
- Experienced: Can handle longer sentences and more technical terminology
-
Length scoring:
- Different target lengths for each audience
- Adjusted by explanation type (source mapping needs more space)
-
Topic coverage:
- Uses audience-specific expected topics when available
The prompt templates now include audience and explanation variables:
system_prompt: |
You are an expert in {arch} assembly code and {language}...
Target audience: {audience}
{audience_guidance}
Explanation type: {explanation_type}
{explanation_focus}
# ... rest of prompt
user_prompt: "Explain the {arch} {explanation_type_phrase}."- Existing test cases without audience/explanation fields default to "beginner" and "assembly"
- The v1_baseline.yaml prompt remains unchanged for comparison purposes
See test_cases/audience_variations.yaml for examples demonstrating different audience and explanation type combinations.
The system now uses just two audience levels:
- beginner: For users new to assembly language
- experienced: For users with assembly and compiler knowledge
This simplified approach allows focus on perfecting explanations for these two clear segments while maintaining the technical infrastructure for future expansion.