@leostera/evalkit 0.8.0 → 0.10.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.
- package/CHANGELOG.md +93 -2
- package/README.md +5 -4
- package/dist/cli.mjs +510 -379
- package/dist/dashboard/assets/index-DNR4shrM.js +67 -0
- package/dist/dashboard/assets/index-TPYprg75.css +2 -0
- package/dist/dashboard/index.html +2 -2
- package/dist/{files-C-U0-PWW.mjs → files-DkDQs2JL.mjs} +3 -0
- package/dist/{index-db-vbqEGFaU.mjs → index-db-B1FeXzmS.mjs} +333 -51
- package/dist/index.d.mts +529 -183
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/runner.d.mts +447 -173
- package/dist/runner.d.mts.map +1 -1
- package/dist/runner.mjs +2 -2
- package/dist/share-worker.d.mts +10 -3
- package/dist/share-worker.d.mts.map +1 -1
- package/dist/share-worker.mjs +6 -3
- package/dist/share.d.mts +49 -7
- package/dist/share.d.mts.map +1 -1
- package/dist/share.mjs +4 -4
- package/dist/skills/evalkit/SKILL.md +5 -5
- package/dist/skills/evalkit-agents/SKILL.md +5 -3
- package/dist/skills/evalkit-datasets/SKILL.md +5 -5
- package/dist/skills/evalkit-evals/SKILL.md +5 -5
- package/dist/skills/evalkit-judges/SKILL.md +8 -6
- package/dist/skills/evalkit-matrices/SKILL.md +2 -2
- package/dist/skills/evalkit-results/SKILL.md +6 -6
- package/dist/{src-LeGSyDD2.mjs → src-B14fXAGp.mjs} +334 -73
- package/dist/{src-CZnDXP1K.mjs → src-Bccv9igQ.mjs} +8 -3
- package/dist/{src-mm8L_IxM.mjs → src-BfSQKOJP.mjs} +676 -321
- package/dist/upgrade-G-uFPJKg.mjs +111 -0
- package/package.json +1 -1
- package/dist/dashboard/assets/index-C12IeG2y.css +0 -2
- package/dist/dashboard/assets/index-xlVsW6ZR.js +0 -37
package/dist/runner.d.mts
CHANGED
|
@@ -41,13 +41,13 @@ export declare class CheckpointExecutionError extends CheckpointExecutionError_b
|
|
|
41
41
|
declare const CancelledError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
42
42
|
readonly _tag: "CancelledError";
|
|
43
43
|
} & Readonly<A>;
|
|
44
|
-
/** The run was cancelled (Ctrl+C); the
|
|
44
|
+
/** The run was cancelled (Ctrl+C); the run stops and is finalized as cancelled. */
|
|
45
45
|
export declare class CancelledError extends CancelledError_base<{
|
|
46
46
|
message: string;
|
|
47
47
|
}> {}
|
|
48
48
|
//#endregion
|
|
49
49
|
//#region ../core/src/identity.d.ts
|
|
50
|
-
declare const ResourceKindSchema: Schema.Literal<["run", "
|
|
50
|
+
declare const ResourceKindSchema: Schema.Literal<["run", "artifact"]>;
|
|
51
51
|
type ResourceKind = typeof ResourceKindSchema.Type;
|
|
52
52
|
type ResourceUri<TKind extends ResourceKind = ResourceKind> = `evalkit:${TKind}:${string}`;
|
|
53
53
|
//#endregion
|
|
@@ -59,14 +59,14 @@ type DatasetFileSource = string | Uint8Array | {
|
|
|
59
59
|
file: string;
|
|
60
60
|
};
|
|
61
61
|
/**
|
|
62
|
-
* Files for the
|
|
62
|
+
* Files for the run workspace: a directory relative to the project root, or
|
|
63
63
|
* a map from workspace path (below the dataset's mount) to its content.
|
|
64
64
|
*/
|
|
65
65
|
type DatasetFiles = string | Readonly<Record<string, DatasetFileSource>>;
|
|
66
|
-
/** What one
|
|
66
|
+
/** What one run receives from a dataset. */
|
|
67
67
|
type DatasetContent = {
|
|
68
68
|
files?: DatasetFiles;
|
|
69
|
-
/** Any JSON-convertible value; converted once when the
|
|
69
|
+
/** Any JSON-convertible value; converted once when the run starts. */
|
|
70
70
|
value?: unknown;
|
|
71
71
|
};
|
|
72
72
|
type DatasetLoadContext = {
|
|
@@ -74,12 +74,12 @@ type DatasetLoadContext = {
|
|
|
74
74
|
root: string;
|
|
75
75
|
signal: AbortSignal;
|
|
76
76
|
};
|
|
77
|
-
type
|
|
77
|
+
type DatasetRunContext = {
|
|
78
78
|
evalId: string;
|
|
79
79
|
runId: string;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
/** Per-
|
|
80
|
+
/** Set when the run is one of several repeats launched together. */
|
|
81
|
+
batch?: Batch;
|
|
82
|
+
/** Per-run random seed, so repeated runs can choose different data. */
|
|
83
83
|
seed: number;
|
|
84
84
|
/** The matrix cell's parameters, or `{}`. */
|
|
85
85
|
parameters: JsonObject;
|
|
@@ -93,7 +93,7 @@ type DatasetSource = {
|
|
|
93
93
|
} | {
|
|
94
94
|
kind: 'computed';
|
|
95
95
|
onLoad: (load: DatasetLoadContext) => DatasetContent | Promise<DatasetContent>;
|
|
96
|
-
onRun?: (loaded: DatasetContent,
|
|
96
|
+
onRun?: (loaded: DatasetContent, run: DatasetRunContext) => DatasetContent | Promise<DatasetContent>;
|
|
97
97
|
};
|
|
98
98
|
/** A checked dataset, as returned by `defineDataset`. Evals accept only these. */
|
|
99
99
|
type Dataset = {
|
|
@@ -141,6 +141,8 @@ type AutEventInput = {
|
|
|
141
141
|
timestamp?: string;
|
|
142
142
|
latencyMs?: number;
|
|
143
143
|
usage?: Usage;
|
|
144
|
+
/** The model that answered this turn, when the agent knows it. */
|
|
145
|
+
model?: string;
|
|
144
146
|
} | {
|
|
145
147
|
kind: 'completed';
|
|
146
148
|
output?: unknown;
|
|
@@ -162,8 +164,69 @@ type TurnResult = string | {
|
|
|
162
164
|
reply?: unknown;
|
|
163
165
|
toolCalls?: readonly TurnToolCall[];
|
|
164
166
|
usage?: Usage;
|
|
167
|
+
/** The model that answered, recorded with the usage. */
|
|
168
|
+
model?: string;
|
|
165
169
|
};
|
|
166
170
|
//#endregion
|
|
171
|
+
//#region ../core/src/judge.d.ts
|
|
172
|
+
/**
|
|
173
|
+
* How a judge must answer, and how EvalKit turns the answer into a score.
|
|
174
|
+
*
|
|
175
|
+
* - `verdict` (the default): a value from 0 to 1 and a reason, as JSON.
|
|
176
|
+
* - `choices`: one of a fixed set of answers, such as A/B/C, each worth a value.
|
|
177
|
+
* - `criteria`: a value from 0 to 1 per criterion; the score is their weighted mean.
|
|
178
|
+
*/
|
|
179
|
+
type JudgeAnswer = {
|
|
180
|
+
kind: 'verdict';
|
|
181
|
+
} | {
|
|
182
|
+
kind: 'choices';
|
|
183
|
+
choices: JudgeChoice[];
|
|
184
|
+
} | {
|
|
185
|
+
kind: 'criteria';
|
|
186
|
+
criteria: JudgeCriterion[];
|
|
187
|
+
};
|
|
188
|
+
/** One answer a `choices` judge can give. Keys are matched case-insensitively. */
|
|
189
|
+
type JudgeChoice = {
|
|
190
|
+
key: string;
|
|
191
|
+
label: string;
|
|
192
|
+
value: number;
|
|
193
|
+
};
|
|
194
|
+
/** One thing a `criteria` judge scores. */
|
|
195
|
+
type JudgeCriterion = {
|
|
196
|
+
name: string;
|
|
197
|
+
weight: number;
|
|
198
|
+
description?: string;
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* One criterion's result, as a scorer returns it and as results record it:
|
|
202
|
+
* a value with what it saw, or `reached: false` when the check never got to
|
|
203
|
+
* run, because something before it failed (say, the app would not start).
|
|
204
|
+
* A criterion not reached counts as 0; the score's `explanation` says why,
|
|
205
|
+
* once, instead of every criterion repeating it.
|
|
206
|
+
*/
|
|
207
|
+
type CriterionResult = ReachedCriterion | UnreachedCriterion;
|
|
208
|
+
type ReachedCriterion = {
|
|
209
|
+
name: string;
|
|
210
|
+
/** From 0 to 1. */
|
|
211
|
+
value: number;
|
|
212
|
+
/** Default 1, or the declared weight. */
|
|
213
|
+
weight?: number;
|
|
214
|
+
/** Why this value. */
|
|
215
|
+
explanation?: string;
|
|
216
|
+
/** What the check observed, as plain data. */
|
|
217
|
+
evidence?: JsonValue;
|
|
218
|
+
};
|
|
219
|
+
type UnreachedCriterion = {
|
|
220
|
+
name: string;
|
|
221
|
+
reached: false;
|
|
222
|
+
weight?: number;
|
|
223
|
+
explanation?: string;
|
|
224
|
+
};
|
|
225
|
+
/** A criterion as a scorer returns it: its evidence may be any plain value. */
|
|
226
|
+
type CriterionInput = (Omit<ReachedCriterion, 'evidence'> & {
|
|
227
|
+
evidence?: unknown;
|
|
228
|
+
}) | UnreachedCriterion;
|
|
229
|
+
//#endregion
|
|
167
230
|
//#region ../core/src/catalog.d.ts
|
|
168
231
|
type EvalCatalogAgent = {
|
|
169
232
|
name?: string;
|
|
@@ -215,14 +278,24 @@ type EvalCatalogDataset = {
|
|
|
215
278
|
type EvalCatalogScorer = {
|
|
216
279
|
name: string;
|
|
217
280
|
kind: ScoringRule['kind'];
|
|
281
|
+
/** What it checks, in the author's words. */
|
|
282
|
+
description?: string;
|
|
218
283
|
passAt?: number;
|
|
219
284
|
supportsPartial?: boolean;
|
|
220
285
|
/** Judges only. */
|
|
221
286
|
rubric?: string;
|
|
287
|
+
/** Judges only: the agent that judges (its own, or the project's default). */
|
|
288
|
+
agent?: EvalCatalogAgent;
|
|
289
|
+
/** Judges only: the names of the inputs it sees. */
|
|
290
|
+
inputs?: string[];
|
|
291
|
+
/** Judges only: how it answers. */
|
|
292
|
+
answer?: JudgeAnswer;
|
|
293
|
+
/** Judges only: the prompt it receives, with `{input}` placeholders. */
|
|
294
|
+
prompt?: string;
|
|
222
295
|
definedAt?: string;
|
|
223
296
|
};
|
|
224
297
|
type EvalCatalogStep =
|
|
225
|
-
/** `message` is absent when it is computed for each
|
|
298
|
+
/** `message` is absent when it is computed for each run. */
|
|
226
299
|
{
|
|
227
300
|
kind: 'user';
|
|
228
301
|
message?: string;
|
|
@@ -248,9 +321,9 @@ type EvalCatalogEntry = {
|
|
|
248
321
|
/** The separate agent that runs judge rules, if any. */
|
|
249
322
|
judgeAgent?: EvalCatalogAgent;
|
|
250
323
|
datasets: EvalCatalogDataset[];
|
|
251
|
-
|
|
324
|
+
/** Runs started each time the scenario runs (`repeat`). */
|
|
325
|
+
repeat: number;
|
|
252
326
|
policy: {
|
|
253
|
-
trials: number;
|
|
254
327
|
timeoutMs?: number;
|
|
255
328
|
failfast?: boolean;
|
|
256
329
|
};
|
|
@@ -296,6 +369,32 @@ type EvalMatrix = EvalMatrixDefinition & {
|
|
|
296
369
|
//#endregion
|
|
297
370
|
//#region ../core/src/config.d.ts
|
|
298
371
|
type KeepSandboxes = 'failed' | 'all' | 'none';
|
|
372
|
+
type AttachmentLimits = {
|
|
373
|
+
/** A larger attachment keeps its last this-many bytes. Default 5 MB. */
|
|
374
|
+
maxFileBytes?: number;
|
|
375
|
+
/** All of one run's attachments; past it, `attach()` rejects. Default 20 MB. */
|
|
376
|
+
maxRunBytes?: number;
|
|
377
|
+
};
|
|
378
|
+
//#endregion
|
|
379
|
+
//#region ../core/src/usage.d.ts
|
|
380
|
+
/**
|
|
381
|
+
* Token usage an agent reports for one turn. EvalKit never measures or infers
|
|
382
|
+
* it; adapters copy it from their provider.
|
|
383
|
+
*/
|
|
384
|
+
type Usage = {
|
|
385
|
+
/**
|
|
386
|
+
* Every input token the model read this turn: the prompt, history and tool
|
|
387
|
+
* results, **including** tokens read from or written to a prompt cache.
|
|
388
|
+
* (Some providers report cached tokens separately; add them in.)
|
|
389
|
+
*/
|
|
390
|
+
inputTokens?: number;
|
|
391
|
+
/** Every token the model produced, including reasoning tokens. */
|
|
392
|
+
outputTokens?: number;
|
|
393
|
+
/** Of `inputTokens`, how many were read from a prompt cache. Informational. */
|
|
394
|
+
cachedInputTokens?: number;
|
|
395
|
+
/** The provider's own total; used only when input and output are not reported. */
|
|
396
|
+
totalTokens?: number;
|
|
397
|
+
};
|
|
299
398
|
//#endregion
|
|
300
399
|
//#region ../core/src/index.d.ts
|
|
301
400
|
type JsonPrimitive = boolean | number | string | null;
|
|
@@ -322,11 +421,6 @@ type AgentRuntime = {
|
|
|
322
421
|
configuration?: JsonObject;
|
|
323
422
|
};
|
|
324
423
|
type AgentRuntimes = Partial<Record<AgentRuntimeName, AgentRuntime>>;
|
|
325
|
-
type Usage = {
|
|
326
|
-
inputTokens?: number;
|
|
327
|
-
outputTokens?: number;
|
|
328
|
-
totalTokens?: number;
|
|
329
|
-
};
|
|
330
424
|
type RecordedError = {
|
|
331
425
|
name: string;
|
|
332
426
|
message: string;
|
|
@@ -362,6 +456,8 @@ type AutEvent = {
|
|
|
362
456
|
timestamp: string;
|
|
363
457
|
latencyMs?: number;
|
|
364
458
|
usage?: Usage;
|
|
459
|
+
/** The model that answered this turn, when the agent knows it. */
|
|
460
|
+
model?: string;
|
|
365
461
|
} | {
|
|
366
462
|
kind: 'completed';
|
|
367
463
|
output?: JsonValue;
|
|
@@ -372,7 +468,7 @@ type AutEvent = {
|
|
|
372
468
|
timestamp: string;
|
|
373
469
|
};
|
|
374
470
|
type RunnerEvent = {
|
|
375
|
-
kind: '
|
|
471
|
+
kind: 'run-started';
|
|
376
472
|
timestamp: string;
|
|
377
473
|
} | {
|
|
378
474
|
kind: 'transcript-step-started';
|
|
@@ -420,7 +516,7 @@ type RunnerEvent = {
|
|
|
420
516
|
error: RecordedError;
|
|
421
517
|
timestamp: string;
|
|
422
518
|
} | {
|
|
423
|
-
kind: '
|
|
519
|
+
kind: 'run-completed';
|
|
424
520
|
timestamp: string;
|
|
425
521
|
} | {
|
|
426
522
|
kind: 'error';
|
|
@@ -433,7 +529,7 @@ type TrajectoryEvent = (AutEvent & {
|
|
|
433
529
|
source: 'runner';
|
|
434
530
|
});
|
|
435
531
|
type WorkspaceView = {
|
|
436
|
-
/** Absolute path to this
|
|
532
|
+
/** Absolute path to this run-scoped workspace. Do not persist it in reports. */
|
|
437
533
|
root: string;
|
|
438
534
|
};
|
|
439
535
|
type CandidateWorkspace = WorkspaceView;
|
|
@@ -441,8 +537,8 @@ type EvaluatorWorkspace = WorkspaceView;
|
|
|
441
537
|
type AutContext = {
|
|
442
538
|
runId: string;
|
|
443
539
|
evalId: string;
|
|
444
|
-
|
|
445
|
-
|
|
540
|
+
/** Set when this run is one of several repeats launched together. */
|
|
541
|
+
batch?: Batch;
|
|
446
542
|
metadata: JsonObject;
|
|
447
543
|
/** Run-time parameters supplied by the eval definition or CLI invocation. */
|
|
448
544
|
parameters?: JsonObject;
|
|
@@ -463,6 +559,14 @@ type AutAdapter<TMessage = string> = {
|
|
|
463
559
|
runtime?: AgentRuntime;
|
|
464
560
|
/** Optional: stream events as they happen. Returning a turn result from `send` is enough for most agents. */
|
|
465
561
|
onEvent: (event: AutEventInput) => void | Promise<void>;
|
|
562
|
+
/**
|
|
563
|
+
* Saves a file with the run's results, such as the agent's raw log,
|
|
564
|
+
* whether or not its sandbox is kept. `name` is a relative path of
|
|
565
|
+
* letters, digits, `.`, `_` and `-` (`logs/agent.log`); each name once.
|
|
566
|
+
* A file over the size limit keeps its last bytes; past the run's
|
|
567
|
+
* total limit it is rejected. See `artifacts.attachments` in the config.
|
|
568
|
+
*/
|
|
569
|
+
attach: (name: string, content: string | Uint8Array) => Promise<void>;
|
|
466
570
|
}): Promise<AutSession<TMessage>>;
|
|
467
571
|
};
|
|
468
572
|
type AutSession<TMessage = string> = {
|
|
@@ -480,13 +584,14 @@ type UserMessageInput = {
|
|
|
480
584
|
parameters: JsonObject;
|
|
481
585
|
/** Values of the scenario's candidate datasets, by dataset ID (never evaluator ones). */
|
|
482
586
|
data: JsonObject;
|
|
483
|
-
/** The
|
|
587
|
+
/** The run's random seed (also in `context.metadata.randomSeed`). */
|
|
484
588
|
seed: number;
|
|
485
|
-
|
|
589
|
+
/** Set when this run is one of several repeats launched together. */
|
|
590
|
+
batch?: Batch;
|
|
486
591
|
};
|
|
487
592
|
type UserStep = {
|
|
488
593
|
kind: 'user';
|
|
489
|
-
/** A fixed message, or one computed for each
|
|
594
|
+
/** A fixed message, or one computed for each run. */
|
|
490
595
|
message: string | ((input: UserMessageInput) => string);
|
|
491
596
|
};
|
|
492
597
|
type AgentStep = {
|
|
@@ -523,9 +628,23 @@ type ExpectToolCallStep = {
|
|
|
523
628
|
};
|
|
524
629
|
};
|
|
525
630
|
type TranscriptStep = UserStep | AgentStep | ScoringRule | ExpectToolCallStep;
|
|
631
|
+
/**
|
|
632
|
+
* What a judge saw and said. The built-in `judge()` records all of it; a
|
|
633
|
+
* predicate that calls a model itself can report `model`, `prompt` and
|
|
634
|
+
* `reply` so the dashboard shows them the same way.
|
|
635
|
+
*/
|
|
526
636
|
type JudgeRunInfo = {
|
|
527
637
|
agent?: AutIdentity;
|
|
638
|
+
/** The model the judge reported using (`turn-completed` `model`). */
|
|
639
|
+
model?: string;
|
|
640
|
+
/** Tokens the judge used: never counted in the agent's `tokens`. */
|
|
528
641
|
usage?: Usage;
|
|
642
|
+
/** The exact prompt the judge received. */
|
|
643
|
+
prompt?: string;
|
|
644
|
+
/** Its reply, as text or JSON. */
|
|
645
|
+
reply?: JsonValue;
|
|
646
|
+
/** 2 when its first reply was not in the format asked for and it was asked again. */
|
|
647
|
+
attempts?: number;
|
|
529
648
|
/** Judge-agent observations; never attributed to the AUT trajectory. */
|
|
530
649
|
events?: JsonValue[];
|
|
531
650
|
};
|
|
@@ -534,13 +653,22 @@ type SkippedScore = {
|
|
|
534
653
|
skipped: true;
|
|
535
654
|
reason: string;
|
|
536
655
|
};
|
|
537
|
-
type ScoreValue = number | SkippedScore | {
|
|
538
|
-
|
|
656
|
+
type ScoreValue<Evidence = unknown> = number | SkippedScore | {
|
|
657
|
+
/** From 0 to 1. Without it, the weighted mean of `criteria`. */
|
|
658
|
+
value?: number;
|
|
539
659
|
passed?: boolean;
|
|
540
660
|
explanation?: string;
|
|
541
|
-
/**
|
|
542
|
-
|
|
543
|
-
|
|
661
|
+
/**
|
|
662
|
+
* Any JSON-convertible value: what the scorer observed. A checkpoint's
|
|
663
|
+
* evidence reaches later scorers through `checkpoint(rule)`.
|
|
664
|
+
*/
|
|
665
|
+
evidence?: Evidence;
|
|
666
|
+
/**
|
|
667
|
+
* Per-criterion results, each shown on its own; see `CriterionResult`.
|
|
668
|
+
* Return `{ name, reached: false }` for a check that never ran.
|
|
669
|
+
*/
|
|
670
|
+
criteria?: CriterionInput[];
|
|
671
|
+
/** What a model-backed scorer saw and said; never counted as AUT usage. */
|
|
544
672
|
judge?: JudgeRunInfo;
|
|
545
673
|
};
|
|
546
674
|
type ScoreResult = {
|
|
@@ -548,8 +676,15 @@ type ScoreResult = {
|
|
|
548
676
|
kind: 'predicate' | 'judge';
|
|
549
677
|
value?: number;
|
|
550
678
|
passed?: boolean;
|
|
679
|
+
/** The pass mark the value was held to (1 unless the rule set `passAt`). */
|
|
680
|
+
passAt?: number;
|
|
551
681
|
explanation?: string;
|
|
552
682
|
evidence?: JsonValue;
|
|
683
|
+
/** A `choices` judge's answer, such as `B`. */
|
|
684
|
+
choice?: string;
|
|
685
|
+
criteria?: CriterionResult[];
|
|
686
|
+
/** Files its scorer saved with `attach()`, by name. */
|
|
687
|
+
attachments?: string[];
|
|
553
688
|
judge?: JudgeRunInfo;
|
|
554
689
|
durationMs: number;
|
|
555
690
|
error?: RecordedError;
|
|
@@ -578,25 +713,80 @@ type ScoringContext = {
|
|
|
578
713
|
* example, in a container that is gone by final scoring).
|
|
579
714
|
*/
|
|
580
715
|
checkpoints: readonly CheckpointResult[];
|
|
716
|
+
/**
|
|
717
|
+
* The latest result of a checkpoint in this scenario's transcript, looked
|
|
718
|
+
* up by the rule itself, so renaming it cannot break the lookup. A
|
|
719
|
+
* predicate's `evidence` keeps its type. Undefined until that step has
|
|
720
|
+
* run; throws for a rule that is not in the transcript.
|
|
721
|
+
*/
|
|
722
|
+
checkpoint<Evidence>(rule: PredicateScorer<Evidence>): CheckpointOutcome<Evidence> | undefined;
|
|
723
|
+
checkpoint(rule: JudgeRule | ExpectToolCallStep): CheckpointOutcome<JsonValue> | undefined;
|
|
724
|
+
/**
|
|
725
|
+
* Saves a file with the run's results, like the agent's `attach()`: for
|
|
726
|
+
* example a container's log, or a file the agent reported, read before the
|
|
727
|
+
* workspace is gone. Same names, limits and rules.
|
|
728
|
+
*/
|
|
729
|
+
attach(name: string, content: string | Uint8Array): Promise<void>;
|
|
730
|
+
};
|
|
731
|
+
/**
|
|
732
|
+
* A checkpoint's result with typed evidence. Evidence is saved as JSON, so
|
|
733
|
+
* it arrives as its JSON form: a `Date` becomes a string, `undefined` fields
|
|
734
|
+
* are dropped.
|
|
735
|
+
*/
|
|
736
|
+
type CheckpointOutcome<Evidence> = Omit<CheckpointResult, 'evidence'> & {
|
|
737
|
+
evidence?: Evidence;
|
|
581
738
|
};
|
|
582
|
-
type PredicateScorer = {
|
|
739
|
+
type PredicateScorer<Evidence = unknown> = {
|
|
583
740
|
kind: 'predicate';
|
|
584
741
|
name: string;
|
|
742
|
+
/** What it checks, in a sentence, shown wherever the scorer is. */
|
|
743
|
+
description?: string;
|
|
585
744
|
supportsPartial?: boolean;
|
|
586
745
|
/** A numeric result passes when it is at least this value. Default: only 1 passes. */
|
|
587
746
|
passAt?: number;
|
|
588
|
-
|
|
747
|
+
/**
|
|
748
|
+
* The checks it reports, declared up front so they show before a run.
|
|
749
|
+
* A declared criterion it leaves out is recorded as not reached; one it
|
|
750
|
+
* did not declare is an error.
|
|
751
|
+
*/
|
|
752
|
+
criteria?: JudgeCriterion[];
|
|
753
|
+
run(context: ScoringContext): boolean | ScoreValue<Evidence> | Promise<boolean | ScoreValue<Evidence>>;
|
|
589
754
|
};
|
|
755
|
+
/** What a judge sees: one named input, read from the run. */
|
|
756
|
+
type JudgeInput = (scoring: ScoringContext) => JsonValue | undefined | Promise<JsonValue | undefined>;
|
|
757
|
+
/**
|
|
758
|
+
* A rubric-graded scorer. EvalKit builds the prompt from the rubric, the
|
|
759
|
+
* inputs and the answer format, runs the judge agent, checks its answer
|
|
760
|
+
* (asking once more if it is not in the format asked for), and records
|
|
761
|
+
* what it saw and said.
|
|
762
|
+
*/
|
|
590
763
|
type JudgeRule = {
|
|
591
764
|
kind: 'judge';
|
|
592
765
|
name: string;
|
|
593
766
|
rubric: string;
|
|
767
|
+
/** What it checks, in a sentence, shown wherever the judge is. */
|
|
768
|
+
description?: string;
|
|
769
|
+
/**
|
|
770
|
+
* The agent that judges, made with `defineAgent()`. Default: `judge` in
|
|
771
|
+
* evalkit.config.ts. It gets the run's parameters, so a matrix axis can
|
|
772
|
+
* choose its model.
|
|
773
|
+
*/
|
|
774
|
+
agent?: AutAdapter;
|
|
775
|
+
/**
|
|
776
|
+
* What the judge sees, by name. Default: `conversation` (this turn at a
|
|
777
|
+
* checkpoint, the whole run in final scoring) and `reply` (the last reply).
|
|
778
|
+
*/
|
|
779
|
+
inputs?: Readonly<Record<string, JudgeInput>>;
|
|
780
|
+
/** How it answers. Default `verdict`: a value from 0 to 1 and a reason. */
|
|
781
|
+
answer: JudgeAnswer;
|
|
782
|
+
/** A value passes when it is at least this. Default: only 1 passes. */
|
|
783
|
+
passAt?: number;
|
|
594
784
|
/** Run even when the scenario stopped early or execution failed. */
|
|
595
785
|
supportsPartial?: boolean;
|
|
596
786
|
};
|
|
597
787
|
type ScoringRule = PredicateScorer | JudgeRule;
|
|
598
788
|
/**
|
|
599
|
-
* A number measured for every
|
|
789
|
+
* A number measured for every run, such as tokens, retries or web searches.
|
|
600
790
|
* Metrics never decide pass or fail; they are averaged per run and shown on
|
|
601
791
|
* the scoreboard. Return undefined when there is nothing to measure.
|
|
602
792
|
*/
|
|
@@ -609,9 +799,9 @@ type Metric = {
|
|
|
609
799
|
better?: 'lower' | 'higher';
|
|
610
800
|
run(context: ScoringContext): number | undefined | Promise<number | undefined>;
|
|
611
801
|
};
|
|
612
|
-
/** A metric's value for one
|
|
802
|
+
/** A metric's value for one run. */
|
|
613
803
|
type MetricResult = {
|
|
614
|
-
name:
|
|
804
|
+
name: MetricName;
|
|
615
805
|
/** Absent when the metric measured nothing or failed. */
|
|
616
806
|
value?: number;
|
|
617
807
|
unit?: string;
|
|
@@ -624,22 +814,23 @@ type EvalPolicy = {
|
|
|
624
814
|
timeoutMs?: number;
|
|
625
815
|
/** Stop later transcript steps after a failed checkpoint assertion. Default false. */
|
|
626
816
|
failfast?: boolean;
|
|
627
|
-
/** Number of independent trials requested by local and hosted runners. */
|
|
628
|
-
trials?: number;
|
|
629
817
|
};
|
|
630
818
|
type EvalDefinition<TAgent extends AutAdapter = AutAdapter> = {
|
|
631
819
|
id: string;
|
|
632
820
|
name?: string;
|
|
633
821
|
agent: TAgent;
|
|
634
|
-
/**
|
|
635
|
-
judge?: AutAdapter;
|
|
636
|
-
/** Data and files the scenario uses; each trial gets its own copy. */
|
|
822
|
+
/** Data and files the scenario uses; each run gets its own copy. */
|
|
637
823
|
datasets?: readonly Dataset[];
|
|
638
824
|
transcript: TranscriptStep[];
|
|
639
825
|
scoring: ScoringRule[];
|
|
640
|
-
/** Numbers to measure for every
|
|
826
|
+
/** Numbers to measure for every run; they never affect pass or fail. */
|
|
641
827
|
metrics?: readonly Metric[];
|
|
642
828
|
policy?: EvalPolicy;
|
|
829
|
+
/**
|
|
830
|
+
* How many runs to start each time the scenario runs, as one batch: repeats
|
|
831
|
+
* under identical conditions, to see how often it passes. Default 1.
|
|
832
|
+
*/
|
|
833
|
+
repeat?: number;
|
|
643
834
|
/** Any JSON-convertible object; converted when the eval is defined. */
|
|
644
835
|
metadata?: Record<string, unknown>;
|
|
645
836
|
workspace?: EvalWorkspace;
|
|
@@ -647,7 +838,7 @@ type EvalDefinition<TAgent extends AutAdapter = AutAdapter> = {
|
|
|
647
838
|
/** How EvalKit treats this scenario's candidate workspace. */
|
|
648
839
|
type EvalWorkspace = {
|
|
649
840
|
/**
|
|
650
|
-
* Paths to leave out of the
|
|
841
|
+
* Paths to leave out of the run's snapshot, read like `.gitignore`: globs
|
|
651
842
|
* relative to the workspace, where a pattern without `/` matches that name
|
|
652
843
|
* at any depth and later patterns win. They come after the project's
|
|
653
844
|
* `artifacts.exclude` (default `DEFAULT_ARTIFACT_EXCLUDE`), so `!pattern`
|
|
@@ -666,7 +857,18 @@ type EvalSuiteMetadata = {
|
|
|
666
857
|
name?: string;
|
|
667
858
|
evalIds: string[];
|
|
668
859
|
};
|
|
669
|
-
|
|
860
|
+
/**
|
|
861
|
+
* How a run ended: `passed` or `failed` by its scores, `errored` when it could
|
|
862
|
+
* not finish (the agent, a dataset or EvalKit failed), `cancelled` by Ctrl+C.
|
|
863
|
+
*/
|
|
864
|
+
type RunStatus = 'running' | 'passed' | 'failed' | 'errored' | 'cancelled';
|
|
865
|
+
/** Runs launched together as repeats of one configuration (`repeat`). */
|
|
866
|
+
type Batch = {
|
|
867
|
+
id: string;
|
|
868
|
+
/** Zero-based position in the batch. */
|
|
869
|
+
index: number;
|
|
870
|
+
size: number;
|
|
871
|
+
};
|
|
670
872
|
/**
|
|
671
873
|
* Where a run's eval code came from: the repository, eval project and commit.
|
|
672
874
|
* Results are tagged with it; they are never stored in the repository itself.
|
|
@@ -701,7 +903,7 @@ type RunProcess = {
|
|
|
701
903
|
hostname: string;
|
|
702
904
|
};
|
|
703
905
|
type RunMetadata = {
|
|
704
|
-
schemaVersion:
|
|
906
|
+
schemaVersion: 6;
|
|
705
907
|
runId: string;
|
|
706
908
|
runUri: ResourceUri<'run'>;
|
|
707
909
|
evalId: string;
|
|
@@ -713,36 +915,21 @@ type RunMetadata = {
|
|
|
713
915
|
};
|
|
714
916
|
aut?: AutIdentity;
|
|
715
917
|
startedAt: string;
|
|
716
|
-
/** Present
|
|
918
|
+
/** Present when the run's commit could be determined. */
|
|
717
919
|
source?: RunSource;
|
|
718
|
-
/** From schema version 5. */
|
|
719
920
|
process?: RunProcess;
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
schemaVersion: 2 | 3 | 4 | 5;
|
|
723
|
-
runId: string;
|
|
724
|
-
runUri: ResourceUri<'run'>;
|
|
725
|
-
trialId: string;
|
|
726
|
-
trialUri: ResourceUri<'trial'>;
|
|
727
|
-
trialIndex: number;
|
|
728
|
-
evalId: string;
|
|
729
|
-
parameters?: JsonObject;
|
|
730
|
-
matrix?: {
|
|
731
|
-
id: string;
|
|
732
|
-
cellKey: string;
|
|
733
|
-
};
|
|
734
|
-
aut?: AutIdentity;
|
|
735
|
-
startedAt: string;
|
|
921
|
+
/** Set when this run is one of several repeats launched together. */
|
|
922
|
+
batch?: Batch;
|
|
736
923
|
/** The effective snapshot ignore patterns: the project's `artifacts.exclude`, then the scenario's `workspace.ignore`. */
|
|
737
924
|
workspaceIgnore?: string[];
|
|
738
|
-
/**
|
|
739
|
-
datasets?:
|
|
925
|
+
/** The datasets this run used, with content digests. */
|
|
926
|
+
datasets?: RunDataset[];
|
|
740
927
|
};
|
|
741
|
-
type
|
|
928
|
+
type RunDataset = {
|
|
742
929
|
id: string;
|
|
743
930
|
visibility: DatasetVisibility;
|
|
744
931
|
source: 'static' | 'computed';
|
|
745
|
-
/** SHA-256 of the
|
|
932
|
+
/** SHA-256 of the run's content: file paths and bytes, and the canonical value. */
|
|
746
933
|
digest: string;
|
|
747
934
|
};
|
|
748
935
|
type CheckpointResult = {
|
|
@@ -752,8 +939,13 @@ type CheckpointResult = {
|
|
|
752
939
|
status: 'passed' | 'failed' | 'error' | 'skipped';
|
|
753
940
|
value?: number;
|
|
754
941
|
passed?: boolean;
|
|
942
|
+
passAt?: number;
|
|
755
943
|
explanation?: string;
|
|
756
944
|
evidence?: JsonValue;
|
|
945
|
+
choice?: string;
|
|
946
|
+
criteria?: CriterionResult[];
|
|
947
|
+
/** Files its scorer saved with `attach()`, by name. */
|
|
948
|
+
attachments?: string[];
|
|
757
949
|
judge?: JudgeRunInfo;
|
|
758
950
|
durationMs?: number;
|
|
759
951
|
error?: RecordedError;
|
|
@@ -762,7 +954,21 @@ type CheckpointResult = {
|
|
|
762
954
|
id: string;
|
|
763
955
|
};
|
|
764
956
|
};
|
|
765
|
-
|
|
957
|
+
/**
|
|
958
|
+
* Metrics EvalKit records for every run; scenario metrics may not reuse
|
|
959
|
+
* these names.
|
|
960
|
+
*
|
|
961
|
+
* - `agent time` (ms): from the run's first event to its last one before
|
|
962
|
+
* final scoring.
|
|
963
|
+
* - `tokens`: the sum of `turnTokens(usage)` over the turns that reported
|
|
964
|
+
* usage, cached input included. Absent when no turn reported any.
|
|
965
|
+
* - `tool calls`: the agent's `tool-call` events.
|
|
966
|
+
*/
|
|
967
|
+
declare const BUILT_IN_METRICS: readonly ['agent time', 'tokens', 'tool calls', 'judge tokens'];
|
|
968
|
+
type BuiltInMetricName = (typeof BUILT_IN_METRICS)[number];
|
|
969
|
+
/** A built-in metric's name (suggested by editors), or a scenario's own. */
|
|
970
|
+
type MetricName = BuiltInMetricName | (string & {});
|
|
971
|
+
type RunScoring = {
|
|
766
972
|
results: ScoreResult[];
|
|
767
973
|
metrics?: MetricResult[];
|
|
768
974
|
checkpoints?: CheckpointResult[];
|
|
@@ -771,40 +977,34 @@ type TrialScoring = {
|
|
|
771
977
|
passed: boolean;
|
|
772
978
|
};
|
|
773
979
|
type ArtifactEntry = {
|
|
774
|
-
/** Path relative to this
|
|
980
|
+
/** Path relative to this run's artifact root. */
|
|
775
981
|
path: string;
|
|
776
982
|
kind: 'file' | 'directory';
|
|
777
983
|
size?: number;
|
|
778
984
|
};
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
985
|
+
/** A file an adapter attached with `attach()`, saved as `artifacts/attachments/<name>`. */
|
|
986
|
+
type AttachmentEntry = {
|
|
987
|
+
name: string;
|
|
988
|
+
/** Bytes saved. */
|
|
989
|
+
size: number;
|
|
990
|
+
/** The original size, when the file was cut to its last `maxFileBytes`. */
|
|
991
|
+
truncatedFrom?: number;
|
|
786
992
|
};
|
|
787
993
|
type RunSummary = {
|
|
788
994
|
status: RunStatus;
|
|
789
995
|
endedAt: string;
|
|
790
996
|
durationMs?: number;
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
/** Trials stopped by cancellation; counted neither as passed nor failed. */
|
|
795
|
-
cancelled?: number;
|
|
997
|
+
scoring?: RunScoring;
|
|
998
|
+
artifacts?: ArtifactEntry[];
|
|
999
|
+
attachments?: AttachmentEntry[];
|
|
796
1000
|
error?: RecordedError;
|
|
797
1001
|
};
|
|
798
|
-
type TrialWriter = {
|
|
799
|
-
appendEvent(event: TrajectoryEvent): Promise<void>;
|
|
800
|
-
writeScores(scoring: TrialScoring): Promise<void>;
|
|
801
|
-
/** Writes a file below this trial's artifact root. */
|
|
802
|
-
writeArtifact(path: string, data: Uint8Array): Promise<void>;
|
|
803
|
-
finalize(summary: TrialSummary): Promise<void>;
|
|
804
|
-
};
|
|
805
1002
|
type RunWriter = {
|
|
806
1003
|
readonly location: string;
|
|
807
|
-
|
|
1004
|
+
appendEvent(event: TrajectoryEvent): Promise<void>;
|
|
1005
|
+
writeScores(scoring: RunScoring): Promise<void>;
|
|
1006
|
+
/** Writes a file below this run's artifact root. */
|
|
1007
|
+
writeArtifact(path: string, data: Uint8Array): Promise<void>;
|
|
808
1008
|
finalize(summary: RunSummary): Promise<void>;
|
|
809
1009
|
};
|
|
810
1010
|
type ReportStore = {
|
|
@@ -812,35 +1012,18 @@ type ReportStore = {
|
|
|
812
1012
|
catalog?: RunCatalog;
|
|
813
1013
|
}): Promise<RunWriter>;
|
|
814
1014
|
};
|
|
815
|
-
|
|
1015
|
+
/** One finished run, as `runEval` returns it. */
|
|
1016
|
+
type RunResult = {
|
|
816
1017
|
runId: string;
|
|
817
1018
|
runUri: ResourceUri<'run'>;
|
|
818
|
-
trialId: string;
|
|
819
|
-
trialUri: ResourceUri<'trial'>;
|
|
820
|
-
trialIndex: number;
|
|
821
1019
|
evalId: string;
|
|
822
1020
|
status: RunStatus;
|
|
1021
|
+
batch?: Batch;
|
|
823
1022
|
reportLocation: string;
|
|
824
1023
|
durationMs?: number;
|
|
825
|
-
scoring?:
|
|
1024
|
+
scoring?: RunScoring;
|
|
826
1025
|
error?: RecordedError;
|
|
827
1026
|
};
|
|
828
|
-
type AggregateScoring = {
|
|
829
|
-
passed: number;
|
|
830
|
-
failed: number;
|
|
831
|
-
cancelled?: number;
|
|
832
|
-
passRate: number;
|
|
833
|
-
overall?: number;
|
|
834
|
-
};
|
|
835
|
-
type RunResult = TrialResult & {
|
|
836
|
-
runId: string;
|
|
837
|
-
trialCount?: number;
|
|
838
|
-
passed?: number;
|
|
839
|
-
failed?: number;
|
|
840
|
-
aggregateScoring?: AggregateScoring;
|
|
841
|
-
/** Present for an aggregate multi-trial run. */
|
|
842
|
-
trials?: TrialResult[];
|
|
843
|
-
};
|
|
844
1027
|
//#endregion
|
|
845
1028
|
//#region ../runner/src/local-report-store.d.ts
|
|
846
1029
|
/** Persists each run as a local tree rooted below `rootDirectory`. */
|
|
@@ -863,7 +1046,7 @@ export declare function staticDatasetFile(dataset: Dataset, root: string, file:
|
|
|
863
1046
|
//#endregion
|
|
864
1047
|
//#region ../runner/src/local-report-reader.d.ts
|
|
865
1048
|
export declare const readRunManifest: (root: string, runId: string) => Promise<{
|
|
866
|
-
readonly schemaVersion:
|
|
1049
|
+
readonly schemaVersion: 6;
|
|
867
1050
|
readonly runUri: string;
|
|
868
1051
|
readonly evalId: string;
|
|
869
1052
|
readonly suiteId?: string | undefined;
|
|
@@ -899,42 +1082,11 @@ export declare const readRunManifest: (root: string, runId: string) => Promise<{
|
|
|
899
1082
|
readonly pid: number;
|
|
900
1083
|
readonly hostname: string;
|
|
901
1084
|
} | undefined;
|
|
902
|
-
readonly
|
|
903
|
-
}>;
|
|
904
|
-
export declare const readRunSummary: (root: string, runId: string) => Promise<{
|
|
905
|
-
readonly status: "cancelled" | "completed" | "failed" | "running";
|
|
906
|
-
readonly endedAt: string;
|
|
907
|
-
readonly durationMs?: number | undefined;
|
|
908
|
-
readonly trialCount: number;
|
|
909
|
-
readonly passed: number;
|
|
910
|
-
readonly failed: number;
|
|
911
|
-
readonly cancelled?: number | undefined;
|
|
912
|
-
readonly error?: {
|
|
913
|
-
readonly name: string;
|
|
914
|
-
readonly message: string;
|
|
915
|
-
readonly stack?: string | undefined;
|
|
916
|
-
} | undefined;
|
|
917
|
-
}>;
|
|
918
|
-
export declare const readTrialManifest: (root: string, runId: string, trialId: string) => Promise<{
|
|
919
|
-
readonly schemaVersion: 2 | 3 | 4 | 5;
|
|
920
|
-
readonly runUri: string;
|
|
921
|
-
readonly trialUri: string;
|
|
922
|
-
readonly trialIndex: number;
|
|
923
|
-
readonly evalId: string;
|
|
924
|
-
readonly parameters?: {
|
|
925
|
-
readonly [x: string]: JsonValue;
|
|
926
|
-
} | undefined;
|
|
927
|
-
readonly matrix?: {
|
|
928
|
-
readonly id: string;
|
|
929
|
-
readonly cellKey: string;
|
|
930
|
-
} | undefined;
|
|
931
|
-
readonly aut?: {
|
|
932
|
-
readonly name?: string | undefined;
|
|
933
|
-
readonly kind: string;
|
|
1085
|
+
readonly batch?: {
|
|
934
1086
|
readonly id: string;
|
|
935
|
-
readonly
|
|
1087
|
+
readonly index: number;
|
|
1088
|
+
readonly size: number;
|
|
936
1089
|
} | undefined;
|
|
937
|
-
readonly startedAt: string;
|
|
938
1090
|
readonly workspaceIgnore?: string[] | undefined;
|
|
939
1091
|
readonly datasets?: {
|
|
940
1092
|
readonly id: string;
|
|
@@ -942,14 +1094,29 @@ export declare const readTrialManifest: (root: string, runId: string, trialId: s
|
|
|
942
1094
|
readonly source: "computed" | "static";
|
|
943
1095
|
readonly digest: string;
|
|
944
1096
|
}[] | undefined;
|
|
945
|
-
readonly status?: "cancelled" | "
|
|
1097
|
+
readonly status?: "cancelled" | "errored" | "failed" | "passed" | "running" | undefined;
|
|
946
1098
|
}>;
|
|
947
|
-
export declare const
|
|
948
|
-
readonly status: "cancelled" | "
|
|
1099
|
+
export declare const readRunSummary: (root: string, runId: string) => Promise<{
|
|
1100
|
+
readonly status: "cancelled" | "errored" | "failed" | "passed" | "running";
|
|
949
1101
|
readonly endedAt: string;
|
|
950
1102
|
readonly durationMs?: number | undefined;
|
|
951
1103
|
readonly scoring?: {
|
|
952
1104
|
readonly results: {
|
|
1105
|
+
readonly passAt?: number | undefined;
|
|
1106
|
+
readonly choice?: string | undefined;
|
|
1107
|
+
readonly criteria?: ({
|
|
1108
|
+
readonly name: string;
|
|
1109
|
+
readonly value: number;
|
|
1110
|
+
readonly weight?: number | undefined;
|
|
1111
|
+
readonly explanation?: string | undefined;
|
|
1112
|
+
readonly evidence?: JsonValue | undefined;
|
|
1113
|
+
} | {
|
|
1114
|
+
readonly name: string;
|
|
1115
|
+
readonly reached: false;
|
|
1116
|
+
readonly weight?: number | undefined;
|
|
1117
|
+
readonly explanation?: string | undefined;
|
|
1118
|
+
})[] | undefined;
|
|
1119
|
+
readonly attachments?: string[] | undefined;
|
|
953
1120
|
readonly name: string;
|
|
954
1121
|
readonly kind: "judge" | "predicate";
|
|
955
1122
|
readonly value?: number | undefined;
|
|
@@ -963,11 +1130,16 @@ export declare const readTrialSummary: (root: string, runId: string, trialId: st
|
|
|
963
1130
|
readonly name?: string | undefined;
|
|
964
1131
|
readonly version?: string | undefined;
|
|
965
1132
|
} | undefined;
|
|
1133
|
+
readonly model?: string | undefined;
|
|
966
1134
|
readonly usage?: {
|
|
967
1135
|
readonly inputTokens?: number | undefined;
|
|
968
1136
|
readonly outputTokens?: number | undefined;
|
|
1137
|
+
readonly cachedInputTokens?: number | undefined;
|
|
969
1138
|
readonly totalTokens?: number | undefined;
|
|
970
1139
|
} | undefined;
|
|
1140
|
+
readonly prompt?: string | undefined;
|
|
1141
|
+
readonly reply?: JsonValue | undefined;
|
|
1142
|
+
readonly attempts?: number | undefined;
|
|
971
1143
|
readonly events?: JsonValue[] | undefined;
|
|
972
1144
|
} | undefined;
|
|
973
1145
|
readonly durationMs: number;
|
|
@@ -991,6 +1163,21 @@ export declare const readTrialSummary: (root: string, runId: string, trialId: st
|
|
|
991
1163
|
} | undefined;
|
|
992
1164
|
}[] | undefined;
|
|
993
1165
|
readonly checkpoints?: {
|
|
1166
|
+
readonly passAt?: number | undefined;
|
|
1167
|
+
readonly choice?: string | undefined;
|
|
1168
|
+
readonly criteria?: ({
|
|
1169
|
+
readonly name: string;
|
|
1170
|
+
readonly value: number;
|
|
1171
|
+
readonly weight?: number | undefined;
|
|
1172
|
+
readonly explanation?: string | undefined;
|
|
1173
|
+
readonly evidence?: JsonValue | undefined;
|
|
1174
|
+
} | {
|
|
1175
|
+
readonly name: string;
|
|
1176
|
+
readonly reached: false;
|
|
1177
|
+
readonly weight?: number | undefined;
|
|
1178
|
+
readonly explanation?: string | undefined;
|
|
1179
|
+
})[] | undefined;
|
|
1180
|
+
readonly attachments?: string[] | undefined;
|
|
994
1181
|
readonly step: number;
|
|
995
1182
|
readonly kind: "expect-tool-call" | "judge" | "predicate";
|
|
996
1183
|
readonly name: string;
|
|
@@ -1006,11 +1193,16 @@ export declare const readTrialSummary: (root: string, runId: string, trialId: st
|
|
|
1006
1193
|
readonly name?: string | undefined;
|
|
1007
1194
|
readonly version?: string | undefined;
|
|
1008
1195
|
} | undefined;
|
|
1196
|
+
readonly model?: string | undefined;
|
|
1009
1197
|
readonly usage?: {
|
|
1010
1198
|
readonly inputTokens?: number | undefined;
|
|
1011
1199
|
readonly outputTokens?: number | undefined;
|
|
1200
|
+
readonly cachedInputTokens?: number | undefined;
|
|
1012
1201
|
readonly totalTokens?: number | undefined;
|
|
1013
1202
|
} | undefined;
|
|
1203
|
+
readonly prompt?: string | undefined;
|
|
1204
|
+
readonly reply?: JsonValue | undefined;
|
|
1205
|
+
readonly attempts?: number | undefined;
|
|
1014
1206
|
readonly events?: JsonValue[] | undefined;
|
|
1015
1207
|
} | undefined;
|
|
1016
1208
|
readonly durationMs?: number | undefined;
|
|
@@ -1033,14 +1225,34 @@ export declare const readTrialSummary: (root: string, runId: string, trialId: st
|
|
|
1033
1225
|
readonly kind: "directory" | "file";
|
|
1034
1226
|
readonly size?: number | undefined;
|
|
1035
1227
|
}[] | undefined;
|
|
1228
|
+
readonly attachments?: {
|
|
1229
|
+
readonly name: string;
|
|
1230
|
+
readonly size: number;
|
|
1231
|
+
readonly truncatedFrom?: number | undefined;
|
|
1232
|
+
}[] | undefined;
|
|
1036
1233
|
readonly error?: {
|
|
1037
1234
|
readonly name: string;
|
|
1038
1235
|
readonly message: string;
|
|
1039
1236
|
readonly stack?: string | undefined;
|
|
1040
1237
|
} | undefined;
|
|
1041
1238
|
}>;
|
|
1042
|
-
export declare const
|
|
1239
|
+
export declare const readRunScoring: (root: string, runId: string) => Promise<{
|
|
1043
1240
|
readonly results: {
|
|
1241
|
+
readonly passAt?: number | undefined;
|
|
1242
|
+
readonly choice?: string | undefined;
|
|
1243
|
+
readonly criteria?: ({
|
|
1244
|
+
readonly name: string;
|
|
1245
|
+
readonly value: number;
|
|
1246
|
+
readonly weight?: number | undefined;
|
|
1247
|
+
readonly explanation?: string | undefined;
|
|
1248
|
+
readonly evidence?: JsonValue | undefined;
|
|
1249
|
+
} | {
|
|
1250
|
+
readonly name: string;
|
|
1251
|
+
readonly reached: false;
|
|
1252
|
+
readonly weight?: number | undefined;
|
|
1253
|
+
readonly explanation?: string | undefined;
|
|
1254
|
+
})[] | undefined;
|
|
1255
|
+
readonly attachments?: string[] | undefined;
|
|
1044
1256
|
readonly name: string;
|
|
1045
1257
|
readonly kind: "judge" | "predicate";
|
|
1046
1258
|
readonly value?: number | undefined;
|
|
@@ -1054,11 +1266,16 @@ export declare const readTrialScoring: (root: string, runId: string, trialId: st
|
|
|
1054
1266
|
readonly name?: string | undefined;
|
|
1055
1267
|
readonly version?: string | undefined;
|
|
1056
1268
|
} | undefined;
|
|
1269
|
+
readonly model?: string | undefined;
|
|
1057
1270
|
readonly usage?: {
|
|
1058
1271
|
readonly inputTokens?: number | undefined;
|
|
1059
1272
|
readonly outputTokens?: number | undefined;
|
|
1273
|
+
readonly cachedInputTokens?: number | undefined;
|
|
1060
1274
|
readonly totalTokens?: number | undefined;
|
|
1061
1275
|
} | undefined;
|
|
1276
|
+
readonly prompt?: string | undefined;
|
|
1277
|
+
readonly reply?: JsonValue | undefined;
|
|
1278
|
+
readonly attempts?: number | undefined;
|
|
1062
1279
|
readonly events?: JsonValue[] | undefined;
|
|
1063
1280
|
} | undefined;
|
|
1064
1281
|
readonly durationMs: number;
|
|
@@ -1082,6 +1299,21 @@ export declare const readTrialScoring: (root: string, runId: string, trialId: st
|
|
|
1082
1299
|
} | undefined;
|
|
1083
1300
|
}[] | undefined;
|
|
1084
1301
|
readonly checkpoints?: {
|
|
1302
|
+
readonly passAt?: number | undefined;
|
|
1303
|
+
readonly choice?: string | undefined;
|
|
1304
|
+
readonly criteria?: ({
|
|
1305
|
+
readonly name: string;
|
|
1306
|
+
readonly value: number;
|
|
1307
|
+
readonly weight?: number | undefined;
|
|
1308
|
+
readonly explanation?: string | undefined;
|
|
1309
|
+
readonly evidence?: JsonValue | undefined;
|
|
1310
|
+
} | {
|
|
1311
|
+
readonly name: string;
|
|
1312
|
+
readonly reached: false;
|
|
1313
|
+
readonly weight?: number | undefined;
|
|
1314
|
+
readonly explanation?: string | undefined;
|
|
1315
|
+
})[] | undefined;
|
|
1316
|
+
readonly attachments?: string[] | undefined;
|
|
1085
1317
|
readonly step: number;
|
|
1086
1318
|
readonly kind: "expect-tool-call" | "judge" | "predicate";
|
|
1087
1319
|
readonly name: string;
|
|
@@ -1097,11 +1329,16 @@ export declare const readTrialScoring: (root: string, runId: string, trialId: st
|
|
|
1097
1329
|
readonly name?: string | undefined;
|
|
1098
1330
|
readonly version?: string | undefined;
|
|
1099
1331
|
} | undefined;
|
|
1332
|
+
readonly model?: string | undefined;
|
|
1100
1333
|
readonly usage?: {
|
|
1101
1334
|
readonly inputTokens?: number | undefined;
|
|
1102
1335
|
readonly outputTokens?: number | undefined;
|
|
1336
|
+
readonly cachedInputTokens?: number | undefined;
|
|
1103
1337
|
readonly totalTokens?: number | undefined;
|
|
1104
1338
|
} | undefined;
|
|
1339
|
+
readonly prompt?: string | undefined;
|
|
1340
|
+
readonly reply?: JsonValue | undefined;
|
|
1341
|
+
readonly attempts?: number | undefined;
|
|
1105
1342
|
readonly events?: JsonValue[] | undefined;
|
|
1106
1343
|
} | undefined;
|
|
1107
1344
|
readonly durationMs?: number | undefined;
|
|
@@ -1119,7 +1356,7 @@ export declare const readTrialScoring: (root: string, runId: string, trialId: st
|
|
|
1119
1356
|
readonly overall?: number | undefined;
|
|
1120
1357
|
readonly passed: boolean;
|
|
1121
1358
|
}>;
|
|
1122
|
-
export declare function
|
|
1359
|
+
export declare function readRunEvents(root: string, runId: string): Promise<TrajectoryEvent[]>;
|
|
1123
1360
|
/**
|
|
1124
1361
|
* True when a run's owning process is known to be gone: it ran on this host
|
|
1125
1362
|
* and its PID no longer exists. Runs from other hosts are never judged.
|
|
@@ -1127,52 +1364,86 @@ export declare function readTrialEvents(root: string, runId: string, trialId: st
|
|
|
1127
1364
|
export declare function ownerIsGone(owner: RunProcess | undefined): boolean;
|
|
1128
1365
|
//#endregion
|
|
1129
1366
|
//#region ../runner/src/matrix.d.ts
|
|
1130
|
-
/** Cells
|
|
1367
|
+
/** Cells and runs; a run that errored counts as failed, a cancelled one as neither. */
|
|
1131
1368
|
type MatrixSummary = {
|
|
1132
1369
|
cells: number;
|
|
1370
|
+
runs: number;
|
|
1133
1371
|
passed: number;
|
|
1134
1372
|
failed: number;
|
|
1135
1373
|
cancelled: number;
|
|
1136
1374
|
};
|
|
1137
1375
|
/** Bounded workers pull cells from the iterator; no Cartesian job array is allocated. */
|
|
1138
|
-
export declare function runMatrix(matrix: EvalMatrix, options: Omit<RunEvalOptions, 'runId' | '
|
|
1376
|
+
export declare function runMatrix(matrix: EvalMatrix, options: Omit<RunEvalOptions, 'runId' | 'parameters' | 'matrix'> & {
|
|
1139
1377
|
selection?: MatrixSelection;
|
|
1140
1378
|
/** The suite each cell's run is recorded under, when `suiteId` is not given. */
|
|
1141
1379
|
suiteFor?: (cell: EvalMatrixCell) => string | undefined;
|
|
1142
|
-
onResult?: (cell: EvalMatrixCell,
|
|
1380
|
+
onResult?: (cell: EvalMatrixCell, runs: readonly RunResult[]) => void | Promise<void>;
|
|
1143
1381
|
}): Effect.Effect<MatrixSummary, unknown>;
|
|
1144
1382
|
//#endregion
|
|
1383
|
+
//#region ../runner/src/upgrade.d.ts
|
|
1384
|
+
/** What upgrading a results folder did, or would do with `dryRun`. */
|
|
1385
|
+
type UpgradeReport = {
|
|
1386
|
+
/** Old runs converted (or that would be). */
|
|
1387
|
+
upgraded: number;
|
|
1388
|
+
/** Version 6 runs they became. */
|
|
1389
|
+
runs: number;
|
|
1390
|
+
/** Old runs with more than one trial: each trial became a run in a batch. */
|
|
1391
|
+
batches: number;
|
|
1392
|
+
/** Old runs left alone because they are still running. */
|
|
1393
|
+
running: string[];
|
|
1394
|
+
};
|
|
1395
|
+
/**
|
|
1396
|
+
* Rewrites results from report schema versions 2 to 5 into version 6, in
|
|
1397
|
+
* place (RFD0008). An old run of one trial (most of them) becomes a run with
|
|
1398
|
+
* the same ID, so links to it keep working. An old run of several trials
|
|
1399
|
+
* becomes runs with the trials' IDs, in a batch with the old run's ID.
|
|
1400
|
+
*
|
|
1401
|
+
* Each new run is written under a temporary name and renamed into place;
|
|
1402
|
+
* artifacts are moved, not copied, as the last step before that rename. An
|
|
1403
|
+
* old run is removed only after its new runs exist, and one replaced under
|
|
1404
|
+
* the same ID is set aside first, so a crash at any point leaves the old run
|
|
1405
|
+
* or complete new ones, and re-running finishes the job. Version 6 runs are
|
|
1406
|
+
* left alone.
|
|
1407
|
+
*/
|
|
1408
|
+
export declare function upgradeReports(root: string, options?: {
|
|
1409
|
+
dryRun?: boolean;
|
|
1410
|
+
}): Promise<UpgradeReport>;
|
|
1411
|
+
//#endregion
|
|
1145
1412
|
//#region ../runner/src/workspace.d.ts
|
|
1146
|
-
/** Where a
|
|
1147
|
-
export declare function
|
|
1413
|
+
/** Where a run's persistent workspace lives below `root`. */
|
|
1414
|
+
export declare function runWorkspacePath(root: string, runId: string): string;
|
|
1148
1415
|
//#endregion
|
|
1149
1416
|
//#region ../runner/src/index.d.ts
|
|
1150
1417
|
export type RunEvalOptions = {
|
|
1151
1418
|
report: ReportStore;
|
|
1419
|
+
/** The run's ID; only with one run (no `repeat`). */
|
|
1152
1420
|
runId?: string;
|
|
1153
|
-
trialId?: string;
|
|
1154
1421
|
suiteId?: string;
|
|
1155
|
-
/** Overrides the
|
|
1156
|
-
|
|
1157
|
-
/** Parameters made available to the AUT for this invocation. */
|
|
1422
|
+
/** Overrides the scenario's `repeat`: how many runs to start, as one batch. */
|
|
1423
|
+
repeat?: number;
|
|
1424
|
+
/** Parameters made available to the AUT, and to judges, for this invocation. */
|
|
1158
1425
|
parameters?: JsonObject;
|
|
1159
|
-
/**
|
|
1426
|
+
/** The agent for judges that name none (`judge` in evalkit.config.ts). */
|
|
1427
|
+
judge?: AutAdapter;
|
|
1428
|
+
/** Matrix provenance recorded in every run's manifest. */
|
|
1160
1429
|
matrix?: RunMetadata['matrix'];
|
|
1161
1430
|
/** Selects a declared AUT runtime such as local, sandbox, or remote. */
|
|
1162
1431
|
runtime?: AgentRuntimeName;
|
|
1163
|
-
/** Maximum number of
|
|
1432
|
+
/** Maximum number of this batch's runs executing concurrently. */
|
|
1164
1433
|
concurrency?: number;
|
|
1165
|
-
/** Optional shared limiter for coordinating
|
|
1434
|
+
/** Optional shared limiter for coordinating runs across batches. */
|
|
1166
1435
|
semaphore?: Effect.Semaphore;
|
|
1167
|
-
/** Base directory for persistent local
|
|
1436
|
+
/** Base directory for persistent local run workspaces. Omit for an ephemeral OS temp workspace. */
|
|
1168
1437
|
workspaceRoot?: string;
|
|
1169
|
-
/** With `workspaceRoot`: which
|
|
1438
|
+
/** With `workspaceRoot`: which run workspaces to keep afterwards. Default `'failed'`. */
|
|
1170
1439
|
keepWorkspaces?: KeepSandboxes;
|
|
1171
1440
|
/**
|
|
1172
1441
|
* Candidate paths left out of the artifact snapshot, before the scenario's
|
|
1173
1442
|
* own `workspace.ignore`. Default `DEFAULT_ARTIFACT_EXCLUDE`.
|
|
1174
1443
|
*/
|
|
1175
1444
|
artifactExclude?: readonly string[];
|
|
1445
|
+
/** Size limits for files adapters and scorers `attach()`. Default `DEFAULT_ATTACHMENT_LIMITS`. */
|
|
1446
|
+
attachmentLimits?: AttachmentLimits;
|
|
1176
1447
|
/** Repository and commit the eval code came from, recorded in the manifest. */
|
|
1177
1448
|
source?: RunSource;
|
|
1178
1449
|
/** The project's evals and suites at run time, saved beside the manifest. */
|
|
@@ -1180,7 +1451,7 @@ export type RunEvalOptions = {
|
|
|
1180
1451
|
/** Project root; dataset paths resolve against it. Default: the working directory. */
|
|
1181
1452
|
root?: string;
|
|
1182
1453
|
/**
|
|
1183
|
-
* Aborting stops new
|
|
1454
|
+
* Aborting stops new runs from starting; running ones stop at their next
|
|
1184
1455
|
* step and are finalized as cancelled. Also passed to dataset loaders.
|
|
1185
1456
|
*/
|
|
1186
1457
|
signal?: AbortSignal;
|
|
@@ -1188,20 +1459,23 @@ export type RunEvalOptions = {
|
|
|
1188
1459
|
* Observes every trajectory event after it is recorded, for live progress.
|
|
1189
1460
|
* It must not throw; an error it throws is ignored.
|
|
1190
1461
|
*/
|
|
1191
|
-
onEvent?: (
|
|
1462
|
+
onEvent?: (run: RunRef, event: TrajectoryEvent) => void;
|
|
1192
1463
|
now?: () => Date;
|
|
1193
1464
|
};
|
|
1194
|
-
/** Identifies the
|
|
1195
|
-
export type
|
|
1465
|
+
/** Identifies the run an observed event belongs to. */
|
|
1466
|
+
export type RunRef = {
|
|
1196
1467
|
runId: string;
|
|
1197
|
-
|
|
1198
|
-
trialIndex: number;
|
|
1468
|
+
batch?: Batch;
|
|
1199
1469
|
evalId: string;
|
|
1200
1470
|
suiteId?: string;
|
|
1201
1471
|
parameters?: JsonObject;
|
|
1202
1472
|
};
|
|
1203
|
-
/**
|
|
1204
|
-
|
|
1473
|
+
/**
|
|
1474
|
+
* Runs a scenario: once, or `repeat` times as one batch. Resolves to one
|
|
1475
|
+
* result per run started; runs never started because of cancellation are
|
|
1476
|
+
* left out.
|
|
1477
|
+
*/
|
|
1478
|
+
export declare function runEval(definition: EvalDefinition, options: RunEvalOptions): Effect.Effect<RunResult[], unknown>;
|
|
1205
1479
|
//#endregion
|
|
1206
|
-
export type { DatasetFileEntry, MatrixSummary };
|
|
1480
|
+
export type { DatasetFileEntry, MatrixSummary, UpgradeReport };
|
|
1207
1481
|
//# sourceMappingURL=runner.d.mts.map
|