Overview
The exact_match evaluator is a simple code-based evaluator that checks if the output exactly equals the expected value. It performs a strict string comparison with no normalization.This evaluator is only available as a built-in for Python. For TypeScript, see the usage example below showing how to create an equivalent evaluator using
createEvaluator.When to Use
Use the exact_match evaluator when you need to:- Validate exact outputs - Check that responses match expected values character-for-character
- Evaluate classification tasks - Verify categorical outputs match expected labels
- Test deterministic outputs - Validate outputs that should be identical every time
- Quick sanity checks - Fast evaluation without LLM costs
This is a code-based evaluator that performs direct string comparison. For semantic similarity or fuzzy matching, consider using an LLM-based evaluator instead.
Supported Levels
Input Requirements
The exact_match evaluator requires two inputs:Important Notes
- No normalization: The comparison is case-sensitive and whitespace-sensitive
- String comparison: Both inputs are compared as strings
- No partial matching: The entire string must match exactly
Output Interpretation
The evaluator returns aScore object with the following properties:
Usage Examples
- Python
- TypeScript
Implementing Case-Insensitive Matching
If you need case-insensitive matching, normalize your inputs first:Using with Phoenix
Evaluating Traces
Run evaluations on traces collected in Phoenix and log results as annotations:Running Experiments
Use the exact_match evaluator in Phoenix experiments:API Reference
- Python: exact_match
Related
- Matches Regex Evaluator - For pattern-based matching

