Skip to main content
EZVals uses assertions as the primary way to score evaluations. If you’ve written pytest tests, you already know how to score in EZVals.

Assertions

Use Python’s assert statement to validate your outputs:
When assertions pass, your eval passes. When they fail, the assertion message becomes the failure reason in your results.

Multiple Assertions

Chain assertions to check multiple conditions:

Comparing to Reference

Use ctx.reference for expected output comparisons:

With Cases

Assertions work naturally with case-based tests:

How Assertions Become Scores

When an assertion fails:
  1. The eval doesn’t crash - it’s caught gracefully
  2. A failing score is created with the assertion message as notes
  3. Your ctx.input and ctx.output are preserved for debugging
When all assertions pass, a passing score is automatically added.

store() for Explicit Scoring

Use store(scores=...) when you need more control than assertions provide:
  • Numeric scores (confidence values, similarity scores)
  • Multiple named metrics per evaluation
  • Non-binary scoring (partial credit)

Numeric Scores

Multiple Named Metrics

Combining Assertions and store()

You can use both in the same eval:

Evaluators (Post-Processing)

Evaluators are functions that run after the eval completes and add additional scores:
Evaluators are useful for reusable checks across many evals.

Score Structure Reference

Each score has:
Every score must have at least one of value or passed.

When to Use What