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#
| Level | Supported | Notes |
|---|---|---|
| Span | Yes | Evaluate any span output against expected values. |
Input Requirements#
The exact_match evaluator requires two inputs:
| Field | Type | Description |
|---|---|---|
output | string | The actual output to evaluate |
expected | string | The expected value to match against |
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 a Score object with the following properties:
| Property | Value | Description |
|---|---|---|
label | True or False | Whether the strings match |
score | 1.0 or 0.0 | Numeric score (1.0 = match, 0.0 = no match) |
kind | "code" | Indicates this is a code-based evaluator |
direction | "maximize" | Higher scores are better |
Usage Examples#
The exact_match evaluator is not available as a built-in for TypeScript. You can create an equivalent code evaluator using createEvaluator:
Implementing Case-Insensitive Matching#
If you need case-insensitive matching, normalize your inputs first:
Or create a custom evaluator with normalization:
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

