The Example: Email Response Quality
Weβll build an evaluation system for an AI that generates customer service email responses. Our goal is to measure:- Politeness: Is the tone professional and courteous?
- Completeness: Does it address all customer questions?
- Accuracy: Is the information correct?
Step 1: Create a Simple Dataset
First, letβs create a small dataset with 3 test cases. Each case has an input (customer email) and expected qualities.- Python
- TypeScript
- Created a dataset named
email-responses-v1 - Added 3 test cases covering different scenarios (damaged product, password help, frustrated customer)
- Each case has input data and expected qualities we want to verify
Step 2: Run Your First Evaluation
Now letβs run our AI model on each test case and evaluate the results.- Python
- TypeScript
- Created a dataset run to track this specific evaluation
- Generated AI responses for each test case
- Recorded outputs so we can score them
Step 3: Score the Results
Now weβll add scores to evaluate quality. Weβll use both automated and manual scoring.Option A: LLM-as-a-Judge (Automated)
Use another LLM to evaluate the responses:- Python
- TypeScript
Option B: Custom Scoring (Rule-Based)
Create simple rules to check specific criteria:- Python
- TypeScript
Step 4: View Results in the Platform
Now go to the ABV platform to see your results:- Navigate to Evaluations β Datasets
- Find your dataset:
email-responses-v1 - Click on the run: βInitial evaluationβ
- Review scores for each test case
- Overall score statistics (average, min, max)
- Individual test case results
- Scores breakdown by dimension (politeness, completeness)
- Comments explaining each score
Step 5: Iterate and Improve
Based on the results, letβs improve our AI and re-evaluate:- Python
- TypeScript
What Youβve Learned
Congratulations! Youβve completed a full evaluation workflow: β Created a dataset with realistic test cases β Ran evaluations on your AI outputs β Applied scores using both LLM-as-a-Judge and custom rules β Viewed results in the ABV platform β Iterated by running a second evaluation with improvementsRelated Topics
Expand Your Dataset
- Add 10-20 more test cases covering edge cases
- Include examples from production errors
- Balance positive and negative examples
Advanced Scoring
- Use LLM-as-a-Judge with custom criteria
- Add Human Annotation for nuanced scoring
- Create Custom Scores for domain-specific metrics
Automation
- Set up Remote Dataset Runs to run nightly
- Use Prompt Experiments for A/B testing
- Track Scores Data Model over time
Integration
- Link evaluations to production traces
- Export data for model fine-tuning
- Build custom dashboards tracking quality metrics
Common Questions
How many test cases should I have?
How many test cases should I have?
Start with 10-20 high-quality test cases covering key scenarios. Add more as you find gaps. Quality > quantityβfocus on representative, real-world examples.
Should I use LLM-as-a-Judge or custom scoring?
Should I use LLM-as-a-Judge or custom scoring?
Use both! Custom scoring is fast and deterministic for clear criteria (e.g., βcontains word Xβ). LLM-as-a-Judge is better for nuanced qualities like tone or helpfulness.
How often should I run evaluations?
How often should I run evaluations?
- During development: Every time you change prompts or models
- In production: Daily or weekly automated runs
- For experiments: Before and after each change to measure impact
Can I evaluate production traces?
Can I evaluate production traces?
Yes! You can score production traces directly without creating datasets. This is called βonline evaluation.β See Evaluations Overview for details.
Troubleshooting
Dataset not showing up?- Wait a few seconds for the data to sync
- Check your API key permissions
- Verify youβre looking in the correct project
- Ensure observations are created before scoring
- Check that score values are between 0 and 1
- Verify your scoring function returns the correct format
- Both runs must be on the same dataset
- Scores must have the same names across runs
- Allow time for score aggregation to complete
Complete Example Code
Want the full working example? Hereβs everything in one place:- Python
- TypeScript
Youβre now ready to build comprehensive evaluation systems for your LLM applications! π