Skip to main content
The Verdict object from @outputai/evals provides helpers for returning evaluation results from your workflow evaluators. There are three categories: deterministic assertions for programmatic checks, manual verdicts for custom logic, and LLM result wrappers for judge output.

Deterministic Assertions

These helpers compare values and return an EvaluationBooleanResult with confidence: 1.0. The reasoning is auto-generated based on the comparison result — you don’t need to write it yourself.

Verdict.equals

Strict equality check (===).
Uses === comparison, so Verdict.equals(1, '1') will fail. Objects are compared by reference, not by deep equality — use for primitives.

Verdict.closeTo

Checks if a number is within a tolerance of an expected value.
Passes when Math.abs(actual - expected) <= tolerance. The tolerance is inclusive. Use this for floating-point comparisons where exact equality is unreliable.

Verdict.gt

Strict greater-than (>).

Verdict.gte

Greater-than-or-equal (>=).
Common use: checking minimum lengths or scores from ground truth.

Verdict.lt

Strict less-than (<).

Verdict.lte

Less-than-or-equal (<=).

Verdict.inRange

Inclusive range check — both boundaries are included.
Equivalent to actual >= min && actual <= max.

Verdict.contains

Substring search using String.includes().
Case-sensitive. An empty needle always passes.

Verdict.matches

Regular expression test using RegExp.test().

Verdict.includesAll

Checks that an array contains every expected element.
Order doesn’t matter. Uses === for element comparison, so this works best with primitives (strings, numbers).

Verdict.includesAny

Checks that an array contains at least one expected element.
The success message shows which elements were found.

Verdict.isTrue

Strict boolean check against true.
Uses strict equality (===). Truthy values like 1 or "true" will fail — only boolean true passes.

Verdict.isFalse

Strict boolean check against false.
Uses strict equality. Falsy values like 0 or "" will fail — only boolean false passes.

Manual Verdicts

When no deterministic helper fits your logic, construct verdicts directly. These return EvaluationVerdictResult with the verdict value 'pass', 'partial', or 'fail'.

Verdict.pass

Returns a pass verdict with confidence: 1.0.

Verdict.partial

Returns a partial verdict with caller-specified confidence. Use when the result is in between pass and fail.
You can attach structured feedback to explain specific issues:
Feedback objects accept these fields:

Verdict.fail

Returns a fail verdict with confidence: 0.0. The reasoning is required — you must explain why the evaluation failed.

Using Manual Verdicts in Evaluators

Manual verdicts are useful when your check logic doesn’t map cleanly to a single assertion:
tests/evals/evaluators.ts

LLM Result Wrappers

When you call the LLM yourself (instead of using the judge functions), these wrappers convert raw LLM output into evaluation results. All set confidence: 0.9 to reflect the inherent uncertainty of LLM-generated judgments.

Verdict.fromJudge

Wraps an LLM verdict into an EvaluationVerdictResult.

Verdict.score

Wraps a numeric score into an EvaluationNumberResult.

Verdict.label

Wraps a classification label into an EvaluationStringResult.

Confidence Levels

What’s Next