Assertions
Write checks the way you would in pytest. In TypeScript, usenode:assert or any library that throws an error named AssertionError, such as chai.
default_score_key (pass unless you change it), and its notes are the assertion message, or the source line for a bare assert.
In Python, this works only when the eval takes an
EvalContext parameter. In an eval without one, a failed assertion is recorded as an error instead.error, not as a score.
Explicit scores
Usestore() for numeric scores, partial credit, or several independent metrics:
key and at least one of passed or value, plus optional notes. True/False and bare numbers are accepted as shorthand and use the default key. Storing a score with an existing key replaces the old one.
You can mix assertions and explicit scores: assert the must-haves and store the metrics. Once any score is stored, an eval that finishes cleanly doesn’t also get the automatic pass score.
When a result passes
A result passes when all three of these are true:- It has no error.
- It has at least one pass/fail score.
- Every pass/fail score passed.
passed alongside value to set a threshold. This rule is used everywhere: run totals, pass@k, the UI and the passed column in SQL queries.
Evaluators
An evaluator is a function that runs after the eval body and adds scores. It receives the finished result and returns a score, a list of scores, orNone to add nothing. It can be async. Use evaluators for checks you want on many evals: format, length, safety, or an LLM judge.
- Evaluators also run when an assertion failed, so you still get their scores. They don’t run on results that errored.
- A score returned without a key gets the key
pass. - If an evaluator raises, the result is recorded as an error.
- Evaluators set on an eval replace evaluators from file defaults instead of adding to them.

