Evaluator configuration reference
All twelve built-in evaluators: typed configs, required inputs, defaults, results and validation.
Use EvaluationEvaluatorVersion for a complete version, or EvaluationEvaluatorConfig<"exact_match"> for one config. Configs reject unknown options. Creating an evaluator or version does not execute it: attach its version ID to an evaluator column, configure config.inputMapping, then prepare and execute a run. Input schemas below use the registry's canonical names; required inputs must be bound. Optional inputs can be omitted. See binding guide.
Version-wide fields: required type, category, inputSchema, outputType, config; optional scope defaults to output, scoreDirection defaults to none. inputSchema entries require key and type; required defaults true. Types are any, string, number, boolean, json, object, array, messages. any/json accept JSON values including null; dataset columns still enforce their own declared types. Category is deterministic, semantic, llm or human. Scope labels do not add span/session execution to the output-based runner.
Every config allows optional description (up to 2,000 characters). Named model/route options need a nonempty identifier. Judges select either a model or a route; setting both is rejected by TypeScript and API validation. Defaults below distinguish omitted runtime options from dashboard/template presets. Existing versions retain their stored settings; no hidden defaults change text comparison semantics.
| Type / purpose | Required config | Optional config and defaults | Canonical inputs | Result / common errors |
|---|---|---|---|---|
exact_match: structural equality | caseSensitive, trimWhitespace, normalizeWhitespace: explicit booleans | Compatibility aliases trim, case_sensitive; optional fixed expected. Template preset: false, true, false. | actual:any, expected:any | Boolean value/pass; arrays ordered, objects compare keys recursively. Wrong flag type rejected. |
contains: substring present | Same explicit text flags | Same aliases and fixed expected; same template preset | actual:string, expected:string | Boolean; nonstring inputs fail with INPUT_TYPE_MISMATCH. |
not_contains: substring absent | Same explicit text flags | Same aliases and fixed expected; same template preset | actual:string, expected:string | Inverts successful contains comparison, preserves evaluator errors. |
regex: safe RE2 regular expression | pattern (1-1,000 characters) | flags, default empty | actual:string | Boolean; invalid flags, lookaround and backreferences rejected; large inputs fail with REGEX_INPUT_TOO_LARGE. |
json_schema: validate JSON | schema: JSON Schema object | None beyond description | actual:json | Boolean; strings are JSON-parsed, invalid JSON produces false/invalid_json. Invalid schema rejected; schema/input limits apply. |
numeric: finite scalar comparison | For operator: "between", both min and max | operator defaults eq; other operators neq, gt, gte, lt, lte, ==, =, !=, >, >=, <, <=. Scalar config expected, value, threshold optional. Template preset uses gte. | actual:number, expected:number | Value is actual number; pass compares against expected. between is inclusive and requires min ≤ max. Nonfinite values rejected. |
custom_expression: bounded declarative comparison | expression: EvaluationExpression | None beyond description | actual:any, expected:any; custom declared inputs allowed | Boolean. Operators eq, neq, gt, gte, lt, lte, contains, starts_with, ends_with, exists, and, or, not. Max depth 8, nodes 100; unknown inputs/operators rejected. No JS execution. |
cosine_similarity: compare embedded texts | embeddingModel or compatibility alias model | threshold defaults 0.8, range −1…1 | actual:string, reference:string | Numeric cosine, pass ≥ threshold. Physical embedding model only; routes rejected. Provider/dimension failures produce failed scores. Incurs embedding calls. |
llm_judge: rubric-based judging | Nonempty rubric; one of judgeModel, model, judgeRoute, route | scoreMin:1, scoreMax:5, passThreshold:4, temperature:0, reasoningRequired:false; storeExplanation retained as display preference | actual:any; optional input, context, reference | Numeric or boolean score/pass with reasoning. Threshold must lie inside increasing scale. Invalid judge JSON fails score. Incurs chat call. |
reference_judge: judge against reference | Same judge config | Same judge defaults | actual:any, reference:any; optional input, context | Same judge score/error behavior; reference required. |
pairwise_judge: compare same-case targets | Judge rubric/model selection; tieBehavior: "allow" or "force_choice"; outputLabels: exactly three strings for A/B/tie | Judge temperature/reasoning options; template tie preset allow, labels ["A","B","tie"] | candidateA:any, candidateB:any; optional input, reference, context | Winner label/pass; fixed A/B randomization avoids position bias. Force-choice forbids tie. Baseline/candidate columns must exist. |
human_review: assigned review | Nonempty question, responseType: "pass_fail", "rating", "choice" or "text"; choice requires ≥2 choices | instructions, assignedReviewerIds, requireComment:false, requireCommentOnFailure:false; rating defaults ratingMin:1, ratingMax:5; optional passThreshold, ratingLabels | actual:any; optional reference, input, context | Pending score/assignment until authorized review. Completed generation does not mean review completed. Template preset requires comment on failure. |
Numeric config comparison values are fallbacks, in order: bound expected/reference/value, config expected, then numeric value/threshold. If using a fixed threshold or range instead of a row value, declare expected optional in inputSchema and omit its binding. Number inputs accept only finite numbers at the binding layer; do not rely on numeric-string coercion from direct evaluator internals.
Human review choices can be strings or { value?, label?, passed? } objects. ratingLabels accepts an array or number-keyed string map. Supported stored aliases min/max, scaleLabels, labels, rubric remain representable; canonical question and responseType are still required on public writes. assignedReviewerIds are user/member identifiers and do not grant permissions. Runtime checks assignments separately.
Minimal SDK creation examples for every type
This function creates one version of each supported evaluator. It makes no inference calls. Supply configured Gateway model names/routes for the semantic/judge configs. For an executable suite, bind the canonical input keys from the table. Default input type any is used only where multiple JSON shapes are supported; text/number bindings remain strict.
import { Nirmos, type EvaluationEvaluatorVersion } from '@nirmos/sdk';
export async function createEvaluatorExamples(client: Nirmos, models: { embedding: string; judge: string }) {
const text = { caseSensitive: false, trimWhitespace: true, normalizeWhitespace: false };
const pair = [{ key: 'actual', type: 'any' as const }, { key: 'expected', type: 'any' as const }];
const strings = pair.map(input => ({ ...input, type: 'string' as const }));
const versions: EvaluationEvaluatorVersion[] = [
{ type: 'exact_match', category: 'deterministic', outputType: 'boolean', inputSchema: pair, config: text },
{ type: 'contains', category: 'deterministic', outputType: 'boolean', inputSchema: strings, config: text },
{ type: 'not_contains', category: 'deterministic', outputType: 'boolean', inputSchema: strings, config: text },
{ type: 'regex', category: 'deterministic', outputType: 'boolean', inputSchema: [{ key: 'actual', type: 'string' }], config: { pattern: '^Paris$', flags: 'i' } },
{ type: 'json_schema', category: 'deterministic', outputType: 'boolean', inputSchema: [{ key: 'actual', type: 'json' }], config: { schema: { type: 'object', required: ['answer'], properties: { answer: { type: 'string' } } } } },
{ type: 'numeric', category: 'deterministic', outputType: 'number', inputSchema: [{ key: 'actual', type: 'number' }, { key: 'expected', type: 'number' }], config: { operator: 'gte' } },
{ type: 'custom_expression', category: 'deterministic', outputType: 'boolean', inputSchema: pair, config: { expression: { operator: 'eq', left: { input: 'actual' }, right: { input: 'expected' } } } },
{ type: 'cosine_similarity', category: 'semantic', outputType: 'number', inputSchema: [{ key: 'actual', type: 'string' }, { key: 'reference', type: 'string' }], config: { embeddingModel: models.embedding } },
{ type: 'llm_judge', category: 'llm', outputType: 'number', inputSchema: [{ key: 'actual', type: 'any' }], config: { rubric: 'Rate factual accuracy from 1 to 5.', judgeModel: models.judge } },
{ type: 'reference_judge', category: 'llm', outputType: 'number', inputSchema: [{ key: 'actual', type: 'any' }, { key: 'reference', type: 'any' }], config: { rubric: 'Rate agreement with reference from 1 to 5.', judgeModel: models.judge } },
{ type: 'pairwise_judge', category: 'llm', outputType: 'category', inputSchema: [{ key: 'candidateA', type: 'any' }, { key: 'candidateB', type: 'any' }], config: { rubric: 'Choose more accurate answer.', judgeModel: models.judge, tieBehavior: 'allow', outputLabels: ['A', 'B', 'tie'] } },
{ type: 'human_review', category: 'human', outputType: 'boolean', inputSchema: [{ key: 'actual', type: 'any' }], config: { question: 'Is this answer correct?', responseType: 'pass_fail' } },
];
const created = [];
for (const version of versions) {
created.push(await client.evaluations.evaluators.create({ name: `SDK ${version.type}`, version }));
}
return created;
}Judge/semantic model presence is checked on save; executable catalog access, credentials, quota and provider capabilities are checked during execution. Incomplete evaluators created from templates remain readable/editable, but cannot become executable versions without model selection. Reads preserve display output labels numeric, categorical and human_review; write outputType uses number, category and normal scalar labels. The SDK response types reflect this existing projection.
evaluators.update() edits resource metadata. To change scoring, call evaluators.versions.create(evaluatorId, version) and rebind the suite column. Archive examples with evaluators.archive(created.evaluator.id); archive preserves history. Do not archive resources while a run still uses them.