@fabricorg/experiments-evals 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,257 @@
1
+ import { E as EvaluatorKind, M as ModelClient, a as EvalScore, C as ChatMessage } from './model-client-B7yk_i1s.cjs';
2
+ export { b as EvalRun, c as EvalRunSpec, d as EvalRunStatus, e as EvalRunTarget, G as GenerationSignal, f as GenerationSignalItem, g as ModelCompletionOptions, h as ModelResponse, S as StaticModelClient, T as TokenUsage, m as maxCompletionTokenUsage } from './model-client-B7yk_i1s.cjs';
3
+ import 'zod';
4
+
5
+ /** What an evaluator sees: the example under test plus the produced output. */
6
+ interface EvalInput {
7
+ input: unknown;
8
+ output: unknown;
9
+ expectedOutput?: unknown;
10
+ /** Retrieved context for RAG-style judges (documents, tool results). */
11
+ context?: unknown;
12
+ metadata?: Record<string, unknown>;
13
+ }
14
+ interface EvalContext {
15
+ model: ModelClient;
16
+ nowMs: () => number;
17
+ }
18
+ interface Evaluator {
19
+ readonly kind: EvaluatorKind;
20
+ readonly name: string;
21
+ readonly version: string;
22
+ /** Worst-case judge usage reserved before IO; absent for token-free evaluators. */
23
+ maxJudgeTokens?(input: EvalInput): number;
24
+ /**
25
+ * The judge's prompt template, when the evaluator is an LLM judge. Exposed
26
+ * so budget derivation (deriveReserveTokensPerCall) can size worst-case
27
+ * per-call token reservations from the actual prompt text.
28
+ */
29
+ readonly promptTemplate?: Pick<JudgeTemplate, 'system' | 'user'>;
30
+ evaluate(input: EvalInput, ctx: EvalContext): Promise<EvalScore>;
31
+ }
32
+ interface JudgeTemplate {
33
+ name: string;
34
+ version: string;
35
+ /** Labels the judge may answer with, mapped to normalized scores. */
36
+ labels: Record<string, number>;
37
+ system: string;
38
+ /** Rendered with {{input}}, {{output}}, {{expectedOutput}}, {{context}}. */
39
+ user: string;
40
+ /** Deterministic provider-enforced response ceiling. Default: 256. */
41
+ maxOutputTokens?: number;
42
+ }
43
+ /**
44
+ * Build an LLM-judge evaluator from a template. Response contract: the model
45
+ * answers `LABEL: <label>` on the first line, free-form explanation after —
46
+ * a portable explanation-bearing format that remains easy to import/export.
47
+ */
48
+ declare function llmJudge(template: JudgeTemplate): Evaluator;
49
+ /** Build a deterministic code evaluator from a pure function. */
50
+ declare function codeEvaluator(name: string, version: string, fn: (input: EvalInput) => {
51
+ label?: string;
52
+ score: number | null;
53
+ explanation?: string;
54
+ }): Evaluator;
55
+ declare function render(template: string, input: EvalInput): string;
56
+ declare function parseJudgeResponse(text: string, labels: Record<string, number>): {
57
+ label?: string;
58
+ score: number | null;
59
+ explanation?: string;
60
+ };
61
+
62
+ /**
63
+ * Built-in judge library. Prompts use a portable binary-label + explanation
64
+ * contract and are versioned independently — bump the version on ANY prompt
65
+ * change because evaluator provenance depends on it.
66
+ */
67
+ declare const hallucinationJudge: Evaluator;
68
+ declare const qaCorrectnessJudge: Evaluator;
69
+ declare const relevanceJudge: Evaluator;
70
+ declare const toxicityJudge: Evaluator;
71
+ declare const summarizationJudge: Evaluator;
72
+ /** Rendered in place of the reference answer when the example carries none. */
73
+ declare const NO_REFERENCE_MARKER = "(no reference provided)";
74
+ /**
75
+ * Reference-grounded correctness. Examples without an expectedOutput render
76
+ * the explicit no-reference marker and come back unscored (null score) rather
77
+ * than being silently graded referenceless.
78
+ */
79
+ declare const qaCorrectnessReferenceJudge: Evaluator;
80
+ declare const trajectoryCoherenceJudge: Evaluator;
81
+ declare const BUILT_IN_EVALUATORS: readonly Evaluator[];
82
+ declare function getEvaluator(name: string): Evaluator | undefined;
83
+
84
+ interface EvaluatorAggregate {
85
+ evaluatorName: string;
86
+ evaluatorVersion: string;
87
+ scored: number;
88
+ /** Scores the judge could not produce (null score — parse failures etc.). */
89
+ unscored: number;
90
+ meanScore: number | null;
91
+ /** Wilson 95% CI over pass-rate; only for binary judges (all scores 0/1). */
92
+ passRate: {
93
+ rate: number;
94
+ low: number;
95
+ high: number;
96
+ } | null;
97
+ labelCounts: Record<string, number>;
98
+ totalTokens: number;
99
+ meanLatencyMs: number | null;
100
+ }
101
+ /** Pure aggregation over a run's scores, grouped by evaluator name+version. */
102
+ declare function aggregateScores(scores: readonly EvalScore[]): EvaluatorAggregate[];
103
+
104
+ interface RunItem {
105
+ /** Dataset exampleId or span id — opaque to the runner. */
106
+ itemId: string;
107
+ input: EvalInput;
108
+ }
109
+ interface ScoredItem {
110
+ itemId: string;
111
+ score: EvalScore;
112
+ }
113
+ interface ExecuteOptions {
114
+ evaluators: readonly Evaluator[];
115
+ items: readonly RunItem[];
116
+ ctx: EvalContext;
117
+ /**
118
+ * Hard token budget (governance: eval-cost-controls). Enforced by
119
+ * reservation: a judge call only starts if `spent + reserved +
120
+ * reserveTokensPerCall` still fits, so concurrent workers can never
121
+ * collectively overshoot by racing the check.
122
+ */
123
+ maxJudgeTokens?: number;
124
+ /**
125
+ * Optional minimum reservation per judge call. The runner always takes the
126
+ * larger of this value and the evaluator's input-specific worst-case bound.
127
+ * Code and heuristic evaluators reserve zero tokens and continue after a
128
+ * judge budget is exhausted.
129
+ */
130
+ reserveTokensPerCall?: number;
131
+ concurrency?: number;
132
+ /** Called after each item completes — the agent checkpoints here. */
133
+ onProgress?: (done: number, total: number, tokensSpent: number) => void;
134
+ }
135
+ interface ExecuteResult {
136
+ scores: ScoredItem[];
137
+ tokensSpent: number;
138
+ /** Items fully or partially skipped because the token budget was exhausted. */
139
+ skippedForBudget: number;
140
+ /** Individual judge evaluations skipped because their reservation did not fit. */
141
+ skippedEvaluationsForBudget: number;
142
+ /** Per-item evaluator failures (item kept; other evaluators still ran). */
143
+ failures: Array<{
144
+ itemId: string;
145
+ evaluatorName: string;
146
+ message: string;
147
+ }>;
148
+ }
149
+ /**
150
+ * Completion cap assumed per judge call when sizing reservations. Judges
151
+ * answer `LABEL: <label>` plus a brief explanation — 512 tokens is a generous
152
+ * ceiling for that contract.
153
+ */
154
+ declare const JUDGE_COMPLETION_TOKEN_CAP = 512;
155
+ /**
156
+ * Prompt-token allowance for the item content rendered into the template
157
+ * ({{input}}/{{output}}/{{expectedOutput}}/{{context}}). A worst-case bound
158
+ * for typical dataset examples; oversized examples only weaken the guarantee
159
+ * to "caps the number of calls started" (see reserveTokensPerCall docs).
160
+ */
161
+ declare const ITEM_CONTENT_TOKEN_ALLOWANCE = 1024;
162
+ /**
163
+ * Worst-case tokens one judge call may consume, derived from the largest
164
+ * prompt template among the run's evaluators (chars/4 heuristic) plus the
165
+ * item-content allowance and the completion cap. Threaded from run creation
166
+ * into ExecuteOptions.reserveTokensPerCall so the hard budget is enforced by
167
+ * reservation rather than after-the-fact accounting.
168
+ */
169
+ declare function deriveReserveTokensPerCall(evaluators: readonly Evaluator[]): number;
170
+ /**
171
+ * Pure orchestration: evaluate every item with every evaluator under a hard
172
+ * token budget, bounded concurrency, and per-evaluator error isolation. IO
173
+ * happens only through the injected ModelClient; persistence is the caller's
174
+ * job (the eval-runner agent writes to the warehouse between batches).
175
+ */
176
+ declare function executeEvalRun(opts: ExecuteOptions): Promise<ExecuteResult>;
177
+
178
+ /**
179
+ * Generation phase for playground-replay eval runs (review fix: replay must
180
+ * not call the model inside the API request lifecycle). The run executor —
181
+ * in-process drain and the Temporal eval-runner alike — renders a prompt
182
+ * version over dataset examples up front (pure, no IO), then this phase
183
+ * completes each rendered conversation through the ModelClient to produce
184
+ * the system-under-test `output` that the judges score.
185
+ *
186
+ * Budget discipline: generation tokens count INSIDE the run's shared token
187
+ * budget (review finding: "playground generation occurs outside its
188
+ * budget"). The same reservation scheme as `executeEvalRun` applies — a
189
+ * completion only starts if `spent + reserveTokensPerCall` still fits, so a
190
+ * tiny budget starves generation into skips instead of overshooting.
191
+ */
192
+ /** One example to generate an output for: rendered messages + judge context. */
193
+ interface GenerationItem {
194
+ itemId: string;
195
+ /** Prompt version rendered against the example's variables. */
196
+ messages: ChatMessage[];
197
+ /**
198
+ * Judge-facing input for the item; `output` is overwritten with the model
199
+ * completion when generation succeeds.
200
+ */
201
+ input: EvalInput;
202
+ }
203
+ /**
204
+ * Completion cap assumed per generation call when sizing reservations —
205
+ * generations are real task outputs, not judge verdicts, so the ceiling is
206
+ * higher than JUDGE_COMPLETION_TOKEN_CAP. A template that pins
207
+ * `params.maxTokens` overrides this.
208
+ */
209
+ declare const GENERATION_COMPLETION_TOKEN_CAP = 1024;
210
+ /**
211
+ * Worst-case tokens one generation call may consume: template size
212
+ * (chars/4 heuristic) + rendered-variable allowance + the completion cap
213
+ * (or the template's own maxTokens pin). Mirrors deriveReserveTokensPerCall.
214
+ */
215
+ declare function deriveReserveTokensPerGeneration(templateChars: number, maxCompletionTokens?: number): number;
216
+ interface GenerationPhaseOptions {
217
+ items: readonly GenerationItem[];
218
+ model: ModelClient;
219
+ /** Shared run budget still available; undefined = unbounded. */
220
+ maxTokens?: number;
221
+ reserveTokensPerCall: number;
222
+ /** Provider-enforced completion ceiling. Default: 1024. */
223
+ maxOutputTokens?: number;
224
+ /** Generation sampling temperature. Default: 0 for reproducible replays. */
225
+ temperature?: number;
226
+ /**
227
+ * Polled before each completion; return true to stop early (cancellation).
228
+ * Items not yet generated when the phase stops are neither generated nor
229
+ * counted as budget skips.
230
+ */
231
+ shouldStop?: () => boolean | Promise<boolean>;
232
+ }
233
+ interface GenerationPhaseResult {
234
+ /** Judgeable run items — each carries its model completion as `output`. */
235
+ items: RunItem[];
236
+ tokensSpent: number;
237
+ inputTokens: number;
238
+ outputTokens: number;
239
+ /** Items skipped because the shared budget could not cover a reservation. */
240
+ skippedForBudget: number;
241
+ /** Per-item generation failures (item excluded from judging). */
242
+ failures: Array<{
243
+ itemId: string;
244
+ message: string;
245
+ }>;
246
+ /** True when shouldStop() ended the phase early. */
247
+ stopped: boolean;
248
+ modelEndpoint: string;
249
+ }
250
+ /**
251
+ * Sequential on purpose: generation runs inside durable executors (Temporal
252
+ * strict determinism) and the per-run example cap is small (maxExamples ≤
253
+ * 200), so bounded concurrency buys little and costs replay determinism.
254
+ */
255
+ declare function executeGenerationPhase(opts: GenerationPhaseOptions): Promise<GenerationPhaseResult>;
256
+
257
+ export { BUILT_IN_EVALUATORS, ChatMessage, type EvalContext, type EvalInput, EvalScore, type Evaluator, type EvaluatorAggregate, EvaluatorKind, type ExecuteOptions, type ExecuteResult, GENERATION_COMPLETION_TOKEN_CAP, type GenerationItem, type GenerationPhaseOptions, type GenerationPhaseResult, ITEM_CONTENT_TOKEN_ALLOWANCE, JUDGE_COMPLETION_TOKEN_CAP, type JudgeTemplate, ModelClient, NO_REFERENCE_MARKER, type RunItem, type ScoredItem, aggregateScores, codeEvaluator, deriveReserveTokensPerCall, deriveReserveTokensPerGeneration, executeEvalRun, executeGenerationPhase, getEvaluator, hallucinationJudge, llmJudge, parseJudgeResponse, qaCorrectnessJudge, qaCorrectnessReferenceJudge, relevanceJudge, render, summarizationJudge, toxicityJudge, trajectoryCoherenceJudge };
@@ -0,0 +1,257 @@
1
+ import { E as EvaluatorKind, M as ModelClient, a as EvalScore, C as ChatMessage } from './model-client-B7yk_i1s.js';
2
+ export { b as EvalRun, c as EvalRunSpec, d as EvalRunStatus, e as EvalRunTarget, G as GenerationSignal, f as GenerationSignalItem, g as ModelCompletionOptions, h as ModelResponse, S as StaticModelClient, T as TokenUsage, m as maxCompletionTokenUsage } from './model-client-B7yk_i1s.js';
3
+ import 'zod';
4
+
5
+ /** What an evaluator sees: the example under test plus the produced output. */
6
+ interface EvalInput {
7
+ input: unknown;
8
+ output: unknown;
9
+ expectedOutput?: unknown;
10
+ /** Retrieved context for RAG-style judges (documents, tool results). */
11
+ context?: unknown;
12
+ metadata?: Record<string, unknown>;
13
+ }
14
+ interface EvalContext {
15
+ model: ModelClient;
16
+ nowMs: () => number;
17
+ }
18
+ interface Evaluator {
19
+ readonly kind: EvaluatorKind;
20
+ readonly name: string;
21
+ readonly version: string;
22
+ /** Worst-case judge usage reserved before IO; absent for token-free evaluators. */
23
+ maxJudgeTokens?(input: EvalInput): number;
24
+ /**
25
+ * The judge's prompt template, when the evaluator is an LLM judge. Exposed
26
+ * so budget derivation (deriveReserveTokensPerCall) can size worst-case
27
+ * per-call token reservations from the actual prompt text.
28
+ */
29
+ readonly promptTemplate?: Pick<JudgeTemplate, 'system' | 'user'>;
30
+ evaluate(input: EvalInput, ctx: EvalContext): Promise<EvalScore>;
31
+ }
32
+ interface JudgeTemplate {
33
+ name: string;
34
+ version: string;
35
+ /** Labels the judge may answer with, mapped to normalized scores. */
36
+ labels: Record<string, number>;
37
+ system: string;
38
+ /** Rendered with {{input}}, {{output}}, {{expectedOutput}}, {{context}}. */
39
+ user: string;
40
+ /** Deterministic provider-enforced response ceiling. Default: 256. */
41
+ maxOutputTokens?: number;
42
+ }
43
+ /**
44
+ * Build an LLM-judge evaluator from a template. Response contract: the model
45
+ * answers `LABEL: <label>` on the first line, free-form explanation after —
46
+ * a portable explanation-bearing format that remains easy to import/export.
47
+ */
48
+ declare function llmJudge(template: JudgeTemplate): Evaluator;
49
+ /** Build a deterministic code evaluator from a pure function. */
50
+ declare function codeEvaluator(name: string, version: string, fn: (input: EvalInput) => {
51
+ label?: string;
52
+ score: number | null;
53
+ explanation?: string;
54
+ }): Evaluator;
55
+ declare function render(template: string, input: EvalInput): string;
56
+ declare function parseJudgeResponse(text: string, labels: Record<string, number>): {
57
+ label?: string;
58
+ score: number | null;
59
+ explanation?: string;
60
+ };
61
+
62
+ /**
63
+ * Built-in judge library. Prompts use a portable binary-label + explanation
64
+ * contract and are versioned independently — bump the version on ANY prompt
65
+ * change because evaluator provenance depends on it.
66
+ */
67
+ declare const hallucinationJudge: Evaluator;
68
+ declare const qaCorrectnessJudge: Evaluator;
69
+ declare const relevanceJudge: Evaluator;
70
+ declare const toxicityJudge: Evaluator;
71
+ declare const summarizationJudge: Evaluator;
72
+ /** Rendered in place of the reference answer when the example carries none. */
73
+ declare const NO_REFERENCE_MARKER = "(no reference provided)";
74
+ /**
75
+ * Reference-grounded correctness. Examples without an expectedOutput render
76
+ * the explicit no-reference marker and come back unscored (null score) rather
77
+ * than being silently graded referenceless.
78
+ */
79
+ declare const qaCorrectnessReferenceJudge: Evaluator;
80
+ declare const trajectoryCoherenceJudge: Evaluator;
81
+ declare const BUILT_IN_EVALUATORS: readonly Evaluator[];
82
+ declare function getEvaluator(name: string): Evaluator | undefined;
83
+
84
+ interface EvaluatorAggregate {
85
+ evaluatorName: string;
86
+ evaluatorVersion: string;
87
+ scored: number;
88
+ /** Scores the judge could not produce (null score — parse failures etc.). */
89
+ unscored: number;
90
+ meanScore: number | null;
91
+ /** Wilson 95% CI over pass-rate; only for binary judges (all scores 0/1). */
92
+ passRate: {
93
+ rate: number;
94
+ low: number;
95
+ high: number;
96
+ } | null;
97
+ labelCounts: Record<string, number>;
98
+ totalTokens: number;
99
+ meanLatencyMs: number | null;
100
+ }
101
+ /** Pure aggregation over a run's scores, grouped by evaluator name+version. */
102
+ declare function aggregateScores(scores: readonly EvalScore[]): EvaluatorAggregate[];
103
+
104
+ interface RunItem {
105
+ /** Dataset exampleId or span id — opaque to the runner. */
106
+ itemId: string;
107
+ input: EvalInput;
108
+ }
109
+ interface ScoredItem {
110
+ itemId: string;
111
+ score: EvalScore;
112
+ }
113
+ interface ExecuteOptions {
114
+ evaluators: readonly Evaluator[];
115
+ items: readonly RunItem[];
116
+ ctx: EvalContext;
117
+ /**
118
+ * Hard token budget (governance: eval-cost-controls). Enforced by
119
+ * reservation: a judge call only starts if `spent + reserved +
120
+ * reserveTokensPerCall` still fits, so concurrent workers can never
121
+ * collectively overshoot by racing the check.
122
+ */
123
+ maxJudgeTokens?: number;
124
+ /**
125
+ * Optional minimum reservation per judge call. The runner always takes the
126
+ * larger of this value and the evaluator's input-specific worst-case bound.
127
+ * Code and heuristic evaluators reserve zero tokens and continue after a
128
+ * judge budget is exhausted.
129
+ */
130
+ reserveTokensPerCall?: number;
131
+ concurrency?: number;
132
+ /** Called after each item completes — the agent checkpoints here. */
133
+ onProgress?: (done: number, total: number, tokensSpent: number) => void;
134
+ }
135
+ interface ExecuteResult {
136
+ scores: ScoredItem[];
137
+ tokensSpent: number;
138
+ /** Items fully or partially skipped because the token budget was exhausted. */
139
+ skippedForBudget: number;
140
+ /** Individual judge evaluations skipped because their reservation did not fit. */
141
+ skippedEvaluationsForBudget: number;
142
+ /** Per-item evaluator failures (item kept; other evaluators still ran). */
143
+ failures: Array<{
144
+ itemId: string;
145
+ evaluatorName: string;
146
+ message: string;
147
+ }>;
148
+ }
149
+ /**
150
+ * Completion cap assumed per judge call when sizing reservations. Judges
151
+ * answer `LABEL: <label>` plus a brief explanation — 512 tokens is a generous
152
+ * ceiling for that contract.
153
+ */
154
+ declare const JUDGE_COMPLETION_TOKEN_CAP = 512;
155
+ /**
156
+ * Prompt-token allowance for the item content rendered into the template
157
+ * ({{input}}/{{output}}/{{expectedOutput}}/{{context}}). A worst-case bound
158
+ * for typical dataset examples; oversized examples only weaken the guarantee
159
+ * to "caps the number of calls started" (see reserveTokensPerCall docs).
160
+ */
161
+ declare const ITEM_CONTENT_TOKEN_ALLOWANCE = 1024;
162
+ /**
163
+ * Worst-case tokens one judge call may consume, derived from the largest
164
+ * prompt template among the run's evaluators (chars/4 heuristic) plus the
165
+ * item-content allowance and the completion cap. Threaded from run creation
166
+ * into ExecuteOptions.reserveTokensPerCall so the hard budget is enforced by
167
+ * reservation rather than after-the-fact accounting.
168
+ */
169
+ declare function deriveReserveTokensPerCall(evaluators: readonly Evaluator[]): number;
170
+ /**
171
+ * Pure orchestration: evaluate every item with every evaluator under a hard
172
+ * token budget, bounded concurrency, and per-evaluator error isolation. IO
173
+ * happens only through the injected ModelClient; persistence is the caller's
174
+ * job (the eval-runner agent writes to the warehouse between batches).
175
+ */
176
+ declare function executeEvalRun(opts: ExecuteOptions): Promise<ExecuteResult>;
177
+
178
+ /**
179
+ * Generation phase for playground-replay eval runs (review fix: replay must
180
+ * not call the model inside the API request lifecycle). The run executor —
181
+ * in-process drain and the Temporal eval-runner alike — renders a prompt
182
+ * version over dataset examples up front (pure, no IO), then this phase
183
+ * completes each rendered conversation through the ModelClient to produce
184
+ * the system-under-test `output` that the judges score.
185
+ *
186
+ * Budget discipline: generation tokens count INSIDE the run's shared token
187
+ * budget (review finding: "playground generation occurs outside its
188
+ * budget"). The same reservation scheme as `executeEvalRun` applies — a
189
+ * completion only starts if `spent + reserveTokensPerCall` still fits, so a
190
+ * tiny budget starves generation into skips instead of overshooting.
191
+ */
192
+ /** One example to generate an output for: rendered messages + judge context. */
193
+ interface GenerationItem {
194
+ itemId: string;
195
+ /** Prompt version rendered against the example's variables. */
196
+ messages: ChatMessage[];
197
+ /**
198
+ * Judge-facing input for the item; `output` is overwritten with the model
199
+ * completion when generation succeeds.
200
+ */
201
+ input: EvalInput;
202
+ }
203
+ /**
204
+ * Completion cap assumed per generation call when sizing reservations —
205
+ * generations are real task outputs, not judge verdicts, so the ceiling is
206
+ * higher than JUDGE_COMPLETION_TOKEN_CAP. A template that pins
207
+ * `params.maxTokens` overrides this.
208
+ */
209
+ declare const GENERATION_COMPLETION_TOKEN_CAP = 1024;
210
+ /**
211
+ * Worst-case tokens one generation call may consume: template size
212
+ * (chars/4 heuristic) + rendered-variable allowance + the completion cap
213
+ * (or the template's own maxTokens pin). Mirrors deriveReserveTokensPerCall.
214
+ */
215
+ declare function deriveReserveTokensPerGeneration(templateChars: number, maxCompletionTokens?: number): number;
216
+ interface GenerationPhaseOptions {
217
+ items: readonly GenerationItem[];
218
+ model: ModelClient;
219
+ /** Shared run budget still available; undefined = unbounded. */
220
+ maxTokens?: number;
221
+ reserveTokensPerCall: number;
222
+ /** Provider-enforced completion ceiling. Default: 1024. */
223
+ maxOutputTokens?: number;
224
+ /** Generation sampling temperature. Default: 0 for reproducible replays. */
225
+ temperature?: number;
226
+ /**
227
+ * Polled before each completion; return true to stop early (cancellation).
228
+ * Items not yet generated when the phase stops are neither generated nor
229
+ * counted as budget skips.
230
+ */
231
+ shouldStop?: () => boolean | Promise<boolean>;
232
+ }
233
+ interface GenerationPhaseResult {
234
+ /** Judgeable run items — each carries its model completion as `output`. */
235
+ items: RunItem[];
236
+ tokensSpent: number;
237
+ inputTokens: number;
238
+ outputTokens: number;
239
+ /** Items skipped because the shared budget could not cover a reservation. */
240
+ skippedForBudget: number;
241
+ /** Per-item generation failures (item excluded from judging). */
242
+ failures: Array<{
243
+ itemId: string;
244
+ message: string;
245
+ }>;
246
+ /** True when shouldStop() ended the phase early. */
247
+ stopped: boolean;
248
+ modelEndpoint: string;
249
+ }
250
+ /**
251
+ * Sequential on purpose: generation runs inside durable executors (Temporal
252
+ * strict determinism) and the per-run example cap is small (maxExamples ≤
253
+ * 200), so bounded concurrency buys little and costs replay determinism.
254
+ */
255
+ declare function executeGenerationPhase(opts: GenerationPhaseOptions): Promise<GenerationPhaseResult>;
256
+
257
+ export { BUILT_IN_EVALUATORS, ChatMessage, type EvalContext, type EvalInput, EvalScore, type Evaluator, type EvaluatorAggregate, EvaluatorKind, type ExecuteOptions, type ExecuteResult, GENERATION_COMPLETION_TOKEN_CAP, type GenerationItem, type GenerationPhaseOptions, type GenerationPhaseResult, ITEM_CONTENT_TOKEN_ALLOWANCE, JUDGE_COMPLETION_TOKEN_CAP, type JudgeTemplate, ModelClient, NO_REFERENCE_MARKER, type RunItem, type ScoredItem, aggregateScores, codeEvaluator, deriveReserveTokensPerCall, deriveReserveTokensPerGeneration, executeEvalRun, executeGenerationPhase, getEvaluator, hallucinationJudge, llmJudge, parseJudgeResponse, qaCorrectnessJudge, qaCorrectnessReferenceJudge, relevanceJudge, render, summarizationJudge, toxicityJudge, trajectoryCoherenceJudge };