FactualityJudgeOptions
FactualityJudgeOptions<
TInput,TOutput,TMetadata,THarness> =JudgeContext<TInput,TOutput,TMetadata,THarness> &object
Matcher context accepted by FactualityJudge().
Type Declaration
Section titled “Type Declaration”expected?
Section titled “expected?”
optionalexpected?:FactualityJudgeExpected
Expert answer or reference facts. Defaults to metadata.expected.
Type Parameters
Section titled “Type Parameters”TInput
Section titled “TInput”TInput = any
TOutput
Section titled “TOutput”TOutput extends JsonValue | undefined = JsonValue | undefined
TMetadata
Section titled “TMetadata”TMetadata extends HarnessMetadata = HarnessMetadata
THarness
Section titled “THarness”THarness extends Harness<TInput, TOutput, TMetadata> | undefined = Harness<TInput, TOutput, TMetadata> | undefined
Example
Section titled “Example”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,});