Assertions
Use Python’sassert statement to validate your outputs:
Multiple Assertions
Chain assertions to check multiple conditions:Comparing to Reference
Usectx.reference for expected output comparisons:
With Cases
Assertions work naturally with case-based tests:How Assertions Become Scores
When an assertion fails:- The eval doesn’t crash - it’s caught gracefully
- A failing score is created with the assertion message as notes
- Your
ctx.inputandctx.outputare preserved for debugging
store() for Explicit Scoring
Usestore(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:Score Structure Reference
Each score has:Every score must have at least one of
value or passed.
