/** * Anthropic SDK wrapper for v0.5 LLM-judge grading calls. * * Per ADR-02 (amended 2026-04-30), src/grading/ is one of two * permitted callers of the Anthropic API. Per ADR-19 §2, Sonnet 4.6 * is the default judge; Opus 4.7 is the escalation backup. * * Two grading modes are exposed: * - gradeSingle: one trial, one answer → RubricResult. * Used by Step 6 calibration (within-judge consistency * regrade; Travis-intuition correlation grading). * - gradePair: one trial, two anonymized answers (A and B) → * paired RubricResult. Used by Step 8 production grading. * * Both modes share the underlying messages.create call, retry-with- * backoff loop, error classification, and cost tracking. They differ * only in prompt shape (single answer vs A/B pair) and output parser * (one score set vs two). * * Temperature is set to 0 by default (ADR-19 §2 deterministic-where- * possible config). Note: temperature 0 is approximately-deterministic, * not strictly so — LLM stochasticity persists in tie-breaks. The * within-judge consistency check (ADR-19 §5 (a)) is the empirical * reliability measurement. If Anthropic adds a seed parameter before * Step 6 calibration, switch to seeded mode and reduce within-judge * regrade substrate (10 → 5) since determinism becomes guaranteed. * * This module deliberately does NOT import from src/extraction/ * (per ADR-02 amendment intent — research-time modules independent). * The retry loop, classifyError, and backoff helpers are duplicated * locally rather than shared. */ import type Anthropic from "@anthropic-ai/sdk"; import type { JudgeCallResult, ModelId, PairedJudgeCallResult } from "./types.js"; export declare const SONNET_46_MODEL: ModelId; export declare const OPUS_47_MODEL: ModelId; export declare const DEFAULT_JUDGE_TEMPERATURE = 0; export declare const DEFAULT_MAX_TOKENS = 2000; export declare const DEFAULT_MAX_RETRIES = 3; export declare const DEFAULT_BASE_BACKOFF_MS = 1000; export declare const DEFAULT_MAX_BACKOFF_MS = 30000; export type RetryClassification = "retry" | "fail"; export declare function classifyError(err: unknown): RetryClassification; export declare class JudgeParseError extends Error { readonly responseText: string; constructor(message: string, responseText: string); } export interface SingleGradeRequest { rubricPrompt: string; prompt: string; answer: string; model?: ModelId; } export interface PairGradeRequest { rubricPrompt: string; prompt: string; answerA: string; answerB: string; model?: ModelId; } export interface JudgeClient { gradeSingle(req: SingleGradeRequest): Promise; gradePair(req: PairGradeRequest): Promise; } export interface CreateJudgeClientOptions { anthropic: Anthropic; defaultModel?: ModelId; maxRetries?: number; baseBackoffMs?: number; maxBackoffMs?: number; temperature?: number; maxTokens?: number; /** For tests — inject a fake sleep. Default: real setTimeout. */ sleep?: (ms: number) => Promise; } export declare function createJudgeClient(options: CreateJudgeClientOptions): JudgeClient; //# sourceMappingURL=judge-client.d.ts.map