import { BaseGrader } from "./baseGrader.js"; import type { Grade, GraderInput, GraderOptions, Input, JSON } from "./types.js"; /** What a metric function receives. `input` is the typed Input; the gold answer is * `input.expected`, and any extra per-input data lives under `input.metadata`. */ export type GraderContext = { output: JSON; input: Input; /** Run the bundled LLM goal judge and get back its 0..1 score + reasoning. * Defaults: `output` falls back to `run.output`, `expected` falls back to * `input.expected` (so the bundled judge grades against the gold answer when * one is present, matching `LlmJudge`). */ judge: (args: { goal: string; output?: JSON; expected?: JSON; }) => Promise<{ score: number; reasoning: string; }>; }; /** A metric: return a 0..1 number, a pass/fail boolean, or a full Grade. */ export type GraderFn = (ctx: GraderContext) => number | boolean | Grade | Promise; /** Public "grader" union: a metric function or a configured grader instance. */ export type Grader = GraderFn | BaseGrader; /** Adapts a metric function into a single-shot BaseGrader so the whole grading * pipeline (sampling, gating, weighting, scoring) treats it like any grader. */ export declare class FunctionGrader extends BaseGrader { private readonly fn; protected readonly defaultName = "fn"; constructor(fn: GraderFn, options?: GraderOptions); protected _run({ input, run, runAgency }: GraderInput): Promise; } /** Wrap a metric function so it carries policy (mustPass/weight/threshold/inputScope/samples/name). */ export declare function grader(fn: GraderFn, options?: GraderOptions): BaseGrader; /** Normalize a user-supplied grader (function or instance) into a BaseGrader. */ export declare function toGrader(spec: Grader): BaseGrader;