Skip to main content
A scorer receives a case’s input, output, expected, and metadata, and returns a metric. There are two kinds: code scorers, which you write as a function, and LLM-as-a-judge scorers, which grade the output with a model.

Code scorers

Any function is a scorer. The metric takes the function’s name.
Return a boolean, a number, or any of the return values below. A boolean passes or fails on its own value; a number is averaged until you give it a threshold.

Adding a threshold

Wrap the function in Scorer.code to give a numeric metric a pass mark, so the platform can mark each score as passing or failing and compare runs.
  • key identifies the scorer. Use the same key in Python and TypeScript for the same scorer.
  • threshold and direction decide whether a numeric score passes.
  • The metric takes the scorer’s name. If you return a Score with a different name, give it that scorer’s name too — otherwise the threshold can’t be matched to it.

LLM-as-a-judge

For a judge, the model and the prompt are the scorer. Write the prompt with {{input}}, {{output}}, and {{expected}} placeholders, filled in per case.
rubric="…" is a shorthand when you only need a single grading instruction.

Building the prompt from the case

To fill in your own placeholders, pass a function that returns the template values. It returns variables for the prompt, never a score.
Pass complete= (Python) / complete: (TypeScript) — a function taking the model and messages and returning a string — to stub the model call, so judges run in tests and CI without an API key.

What a scorer can return

  • a boolean or number,
  • a ScoreScore(name, value, comment=None, metadata=None),
  • a list of Scores, or a {metric: value} map, for a scorer that emits several metrics,
  • a DeferredScore — a score awaiting human or async review. It’s recorded as pending, never as a zero.

Next steps

Running Evals

Point a task and your scorers at a dataset and run the eval.

Reading Results

Per-metric averages, pass rates, and case status.