Skip to content

FactualityJudgeOptions

FactualityJudgeOptions<TInput, TOutput, THarness> = JudgeContext<TInput, TOutput, THarness> & object

Matcher context accepted by FactualityJudge().

optional expected?: FactualityJudgeExpected

Expert answer or reference facts. Overrides the judge config default.

TInput = any

TOutput extends JsonValue | undefined = any

THarness extends Harness<TInput, TOutput> | undefined = any

import { aiSdkJudgeHarness } from "@vitest-evals/harness-ai-sdk";
import { openai } from "@ai-sdk/openai";
import { expect } from "vitest";
import { FactualityJudge } from "vitest-evals";
const judgeHarness = aiSdkJudgeHarness({
model: openai("gpt-4.1-mini"),
});
await expect(result).toSatisfyJudge(FactualityJudge(), {
expected: "Paris is the capital of France.",
judgeHarness,
});