Skip to main content
Judge uses a separate model to assess quality that is hard to express with an exact Match, such as factual consistency, summary faithfulness, or clarity of explanation. Its three factories return pure managed ScoreMatch values from niceeval/expect. They do not read a context or register an Assertion. Register a Judge Match against explicit input and output with check; the measurement is a finite number in [0, 1].

Three Judge factories

For one Turn, pass its frozen input and assistant output to turn.check:
Use root-level t.check when material comes from files, several turns, or another custom source:
Read files as strings through the public Sandbox API first. Judge Matches accept only their criterion or reference text. Authors always register explicit { input, output } material through check, and model selection comes from the resolved Eval configuration.

Declare capability and configure it

Only an Eval that declares judge can register Judge Matches:
  • judge: true declares the capability and inherits fields from the Experiment and project configuration.
  • judge: { ... } both declares the capability and overrides fields from the Experiment and project configuration.
  • Creating a Judge Assertion without a judge declaration immediately reports an authoring error.
Field precedence is the Eval object, then the Experiment, then project configuration. When unspecified, baseUrl is the OpenAI-compatible endpoint, apiKeyEnv is OPENAI_API_KEY, and timeoutMs is 180000 milliseconds. The Runner freezes the resolved configuration once and uses the same configuration for fingerprinting, preflight, and the actual evaluator.

Thresholds and scores

Pass-style Evals call .atLeast(n) on the Judge ScoreMatch before registration. This forms the thresholded local condition. The returned Assertion handle’s parameterless .gate() includes that condition in the Verdict.
.orStop() is an async barrier on the same handle. If the value is below the threshold, it stops the current continuation. The Attempt still receives a failed Verdict after a normal stop. Score-style Evals call .score(n) on the registered handle. A measurement m contributes m * n. If control flow also needs a threshold, form it on the Match before registration.
Both configurations run the Judge evaluator once and write one AssertionResult. A Judge Assertion without .score() saves only the evaluation by default.

Configuration, preflight, and failures

When no model or key is available, NiceEval does not make a network preflight request. The Judge Assertion is unavailable and retains the reason judge-model-unresolved or judge-key-unresolved. If an Assertion configured with a score or .orStop() is unavailable, score grading cannot rank it; a pass-style Attempt is errored. When both a model and key exist, the Runner checks the endpoint before dispatch. A real preflight failure is a setup error and does not fabricate an AssertionResult. A transport failure after the model request starts is an ordinary unavailable. An invalid response, a non-finite score, or a score outside the range is errored; NiceEval does not clamp it to a usable score. The Judge’s reason goes in the general explanation. evidence stores only trimmed and redacted evaluation material.

Reading results

niceeval view, fixed query operations, and failure feedback create summaries from the same sealed Assertion results. Failed and unavailable entries appear first. Configured measurements display their actual value and required threshold. Judge has no special Assertion-result or display branch.