/** * E — Evaluation namespace. * * Build evaluation criteria, test cases, and comparison suites. * Compose criteria with .pipe() to chain multiple checks. * * Usage: * agent.eval("What is 2+2?", { expect: "4" }) * const suite = E.suite(agent).add(E.case("prompt", { expect: "answer" })).run() */ import type { CallbackFn, State } from "../core/types.js"; /** A single evaluation criterion descriptor. */ export interface ECriterion { name: string; config: Record; } /** A composable evaluation criteria chain. */ export declare class EComposite { readonly criteria: ECriterion[]; constructor(criteria: ECriterion[]); /** Chain: add another criterion. */ pipe(other: EComposite): EComposite; /** Convert to a flat array. */ toArray(): ECriterion[]; } /** An evaluation case descriptor. */ export declare class ECase { readonly prompt: string; readonly expect?: string | undefined; readonly tools?: unknown[] | undefined; readonly rubrics?: string[] | undefined; readonly state?: State | undefined; constructor(prompt: string, expect?: string | undefined, tools?: unknown[] | undefined, rubrics?: string[] | undefined, state?: State | undefined); } /** A conversation scenario for user simulation. */ export declare class EScenario { readonly start: string; readonly plan: string[]; readonly persona?: EPersonaSpec | undefined; constructor(start: string, plan: string[], persona?: EPersonaSpec | undefined); } /** Persona specification. */ export interface EPersonaSpec { id: string; description: string; behaviors: string[]; } /** Evaluation result wrapper. */ export declare class EvalReport { readonly passed: boolean; readonly scores: Record; readonly details: Record[]; constructor(passed: boolean, scores: Record, details: Record[]); /** Overall pass rate. */ get passRate(): number; } /** Side-by-side comparison results. */ export declare class ComparisonReport { readonly agents: string[]; readonly results: Map; constructor(agents: string[], results: Map); /** Get winner by average score. */ get winner(): string | undefined; } /** Fluent evaluation suite builder. */ export declare class EvalSuite { readonly agent: unknown; readonly cases: ECase[]; readonly criteria: EComposite[]; constructor(agent: unknown); /** Add an evaluation case. */ add(testCase: ECase): this; /** Add evaluation criteria. */ withCriteria(criteria: EComposite): this; /** Run the suite (placeholder — resolved at runtime). */ run(): Promise; } /** Comparison suite for multiple agents. */ export declare class ComparisonSuite { readonly agents: unknown[]; readonly cases: ECase[]; constructor(agents: unknown[]); /** Add an evaluation case. */ add(testCase: ECase): this; /** Run the comparison (placeholder — resolved at runtime). */ run(): Promise; } /** Prebuilt user simulation personas. */ declare class PersonaNamespace { /** Expert persona: knows what they want, professional tone. */ expert(): EPersonaSpec; /** Novice persona: relies on agent, conversational tone. */ novice(): EPersonaSpec; /** Evaluator persona: assessing capabilities. */ evaluator(): EPersonaSpec; /** Create a custom persona. */ custom(id: string, description: string, behaviors: string[]): EPersonaSpec; } /** * E namespace — evaluation factories. * * All 16 methods + persona sub-namespace from the Python E namespace. */ export declare class E { /** Prebuilt user simulation personas. */ static readonly persona: PersonaNamespace; /** Tool trajectory matching criterion. */ static trajectory(opts?: { threshold?: number; match?: "exact" | "in_order" | "any_order"; }): EComposite; /** ROUGE-1 response match criterion. */ static responseMatch(opts?: { threshold?: number; }): EComposite; /** LLM-as-a-judge semantic matching. */ static semanticMatch(opts?: { threshold?: number; judgeModel?: string; }): EComposite; /** Hallucination detection criterion. */ static hallucination(opts?: { threshold?: number; judgeModel?: string; checkIntermediate?: boolean; }): EComposite; /** Safety evaluation criterion. */ static safety(opts?: { threshold?: number; }): EComposite; /** Rubric-based response quality criterion. */ static rubric(texts: string[], opts?: { threshold?: number; judgeModel?: string; }): EComposite; /** Rubric-based tool use quality criterion. */ static toolRubric(texts: string[], opts?: { threshold?: number; judgeModel?: string; }): EComposite; /** User-defined custom metric. */ static custom(name: string, fn: CallbackFn, opts?: { threshold?: number; }): EComposite; /** Create a standalone evaluation case. */ static case_(prompt: string, opts?: { expect?: string; tools?: unknown[]; rubrics?: string[]; state?: State; }): ECase; /** Create a conversation scenario for user simulation. */ static scenario(start: string, plan: string[], opts?: { persona?: EPersonaSpec; }): EScenario; /** Create an evaluation suite for an agent builder. */ static suite(agent: unknown): EvalSuite; /** Compare multiple agents on the same eval set. */ static compare(...agents: unknown[]): ComparisonSuite; /** Load eval set from a JSON file (placeholder — resolved at runtime). */ static fromFile(path: string): ECase[]; /** Load all eval sets from a directory (placeholder — resolved at runtime). */ static fromDir(path: string): ECase[]; /** Create a quality gate for pipelines. */ static gate(criteria: EComposite, opts?: { threshold?: number; outputKey?: string; }): EComposite; } export {}; //# sourceMappingURL=eval.d.ts.map