@valerypopoff/rivet2-evaluations 2.3.0 → 2.4.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/dist/cjs/bundle.cjs +572 -309
- package/dist/cjs/bundle.cjs.map +4 -4
- package/dist/esm/canonical.js +37 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/library.js +84 -0
- package/dist/esm/normalization.js +101 -1
- package/dist/esm/runner.js +201 -129
- package/dist/esm/serialization.js +3 -0
- package/dist/esm/store.js +25 -5
- package/dist/types/canonical.d.ts +3 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/library.d.ts +8 -0
- package/dist/types/normalization.d.ts +15 -0
- package/dist/types/runner.d.ts +58 -2
- package/dist/types/store.d.ts +10 -3
- package/dist/types/types.d.ts +74 -2
- package/package.json +2 -2
package/dist/types/store.d.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import type { EvaluationDatasetSnapshot, EvaluationRecordingArtifact, EvaluationRun,
|
|
2
|
-
export declare class InMemoryEvaluationRunStore implements
|
|
1
|
+
import type { EvaluationDatasetSnapshot, EvaluationLibrary, EvaluationRecordingArtifact, EvaluationRun, EvaluationStore } from './types.js';
|
|
2
|
+
export declare class InMemoryEvaluationRunStore implements EvaluationStore {
|
|
3
3
|
#private;
|
|
4
|
+
getLibrary(): Promise<EvaluationLibrary>;
|
|
5
|
+
putLibrary(library: EvaluationLibrary): Promise<void>;
|
|
4
6
|
put(run: EvaluationRun): Promise<void>;
|
|
7
|
+
updateRunName(input: {
|
|
8
|
+
projectId: string;
|
|
9
|
+
runId: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
}): Promise<EvaluationRun | undefined>;
|
|
5
12
|
get(input: {
|
|
6
13
|
projectId: string;
|
|
7
14
|
runId: string;
|
|
@@ -29,7 +36,7 @@ export declare class InMemoryEvaluationRunStore implements EvaluationRunStore {
|
|
|
29
36
|
recordingId: string;
|
|
30
37
|
retention: EvaluationRecordingArtifact['reference']['retention'];
|
|
31
38
|
expiresAt?: string;
|
|
32
|
-
}): Promise<
|
|
39
|
+
}): Promise<boolean>;
|
|
33
40
|
promoteBaseline(input: {
|
|
34
41
|
projectId: string;
|
|
35
42
|
runId: string;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export type EvaluationDataset = {
|
|
|
27
27
|
* Legacy project ownership retained only while importing older project
|
|
28
28
|
* files. Locally persisted evaluation datasets intentionally omit it so
|
|
29
29
|
* they can be reused with any currently open project.
|
|
30
|
-
|
|
30
|
+
*/
|
|
31
31
|
projectId?: ProjectId;
|
|
32
32
|
name: string;
|
|
33
33
|
fields: EvaluationDatasetField[];
|
|
@@ -158,6 +158,18 @@ export type EvaluationProjectData = {
|
|
|
158
158
|
suites: EvaluationSuite[];
|
|
159
159
|
baselines: EvaluationBaselineSnapshot[];
|
|
160
160
|
};
|
|
161
|
+
/**
|
|
162
|
+
* Rivet-local evaluation resources. This is deliberately outside project
|
|
163
|
+
* files so one Rivet instance can retain its evaluation library independently
|
|
164
|
+
* of whichever project is currently open.
|
|
165
|
+
*/
|
|
166
|
+
export type EvaluationLibrary = {
|
|
167
|
+
version: 1;
|
|
168
|
+
data: EvaluationProjectData;
|
|
169
|
+
datasets: EvaluationDataset[];
|
|
170
|
+
/** Legacy project IDs whose embedded evaluation resources were imported. */
|
|
171
|
+
migratedLegacyProjectIds: ProjectId[];
|
|
172
|
+
};
|
|
161
173
|
export type EvaluationObservationStatus = 'passed' | 'failed' | 'scored' | 'error' | 'skipped';
|
|
162
174
|
export type EvaluationObservation = {
|
|
163
175
|
id: string;
|
|
@@ -284,7 +296,13 @@ export type EvaluationAggregate = {
|
|
|
284
296
|
/** Normalized internal score in the closed 0..1 range. */
|
|
285
297
|
meanScore?: number;
|
|
286
298
|
averageLatencyMs: number;
|
|
299
|
+
/** Optional so historical persisted runs without this newer factoid remain readable. */
|
|
300
|
+
medianLatencyMs?: number;
|
|
287
301
|
p95LatencyMs: number;
|
|
302
|
+
/** Score distribution statistics use equal-weight per-case mean scores. */
|
|
303
|
+
medianScore?: number;
|
|
304
|
+
/** Score distribution statistics use equal-weight per-case mean scores. */
|
|
305
|
+
p95Score?: number;
|
|
288
306
|
totalCostUsd?: number;
|
|
289
307
|
averageCostUsd?: number;
|
|
290
308
|
targetErrorRate: number;
|
|
@@ -307,6 +325,8 @@ export type EvaluationRun = {
|
|
|
307
325
|
projectId: ProjectId;
|
|
308
326
|
suiteId: string;
|
|
309
327
|
suiteName: string;
|
|
328
|
+
/** Optional user-assigned label for distinguishing retained runs. */
|
|
329
|
+
name?: string;
|
|
310
330
|
/**
|
|
311
331
|
* Monotonically increases while a run is persisted. Stores use it to reject
|
|
312
332
|
* a delayed live-progress write after a newer completed snapshot.
|
|
@@ -318,6 +338,8 @@ export type EvaluationRun = {
|
|
|
318
338
|
purpose: EvaluationRunPurpose;
|
|
319
339
|
/** Captures the suite semantics that produced this run. */
|
|
320
340
|
evaluationMode?: EvaluationSuiteMode;
|
|
341
|
+
/** Planned target executions, retained so live progress does not depend on a later suite edit. */
|
|
342
|
+
requestedTrialCount?: number;
|
|
321
343
|
executionStatus: 'queued' | 'running' | 'completed' | 'canceled' | 'error';
|
|
322
344
|
qualityStatus: EvaluationQualityStatus;
|
|
323
345
|
qualityReason: EvaluationQualityReason;
|
|
@@ -329,6 +351,31 @@ export type EvaluationRun = {
|
|
|
329
351
|
trials: EvaluationTrial[];
|
|
330
352
|
warnings: string[];
|
|
331
353
|
};
|
|
354
|
+
/**
|
|
355
|
+
* Incremental live-run protocol. A started event carries only the empty run
|
|
356
|
+
* shell, a settled event carries one immutable trial, and the terminal event
|
|
357
|
+
* carries the complete reporting shape once. Consumers that still need full
|
|
358
|
+
* snapshots can use RunEvaluationSuiteOptions.onUpdate during the compatibility
|
|
359
|
+
* period.
|
|
360
|
+
*/
|
|
361
|
+
export type EvaluationRunEvent = {
|
|
362
|
+
type: 'run-started';
|
|
363
|
+
revision: number;
|
|
364
|
+
run: EvaluationRun;
|
|
365
|
+
} | {
|
|
366
|
+
type: 'trial-settled';
|
|
367
|
+
revision: number;
|
|
368
|
+
runId: string;
|
|
369
|
+
projectId: ProjectId;
|
|
370
|
+
suiteId: string;
|
|
371
|
+
requestedTrialCount: number;
|
|
372
|
+
settledTrialCount: number;
|
|
373
|
+
trial: EvaluationTrial;
|
|
374
|
+
} | {
|
|
375
|
+
type: 'run-finalized';
|
|
376
|
+
revision: number;
|
|
377
|
+
run: EvaluationRun;
|
|
378
|
+
};
|
|
332
379
|
export type EvaluationRecordingReference = {
|
|
333
380
|
id: string;
|
|
334
381
|
retention: 'temporary' | 'failure' | 'baseline' | 'retained';
|
|
@@ -386,6 +433,12 @@ export type EvaluationGraphRunner = (input: {
|
|
|
386
433
|
}) => Promise<EvaluationGraphExecution>;
|
|
387
434
|
export type EvaluationRunStore = {
|
|
388
435
|
put(run: EvaluationRun): Promise<void>;
|
|
436
|
+
/** Sets a user-assigned run name; omit the name to restore the Unnamed label. */
|
|
437
|
+
updateRunName(input: {
|
|
438
|
+
projectId: ProjectId;
|
|
439
|
+
runId: string;
|
|
440
|
+
name?: string;
|
|
441
|
+
}): Promise<EvaluationRun | undefined>;
|
|
389
442
|
get(input: {
|
|
390
443
|
projectId: ProjectId;
|
|
391
444
|
runId: string;
|
|
@@ -417,12 +470,31 @@ export type EvaluationRunStore = {
|
|
|
417
470
|
recordingId: string;
|
|
418
471
|
retention: EvaluationRecordingReference['retention'];
|
|
419
472
|
expiresAt?: string;
|
|
420
|
-
}): Promise<
|
|
473
|
+
}): Promise<boolean>;
|
|
421
474
|
/** Pins all artifacts belonging to the run before its compact baseline is saved in the project. */
|
|
422
475
|
promoteBaseline(input: {
|
|
423
476
|
projectId: ProjectId;
|
|
424
477
|
runId: string;
|
|
425
478
|
}): Promise<void>;
|
|
479
|
+
/**
|
|
480
|
+
* Optional V2 capability. Persists an idempotent incremental lifecycle event
|
|
481
|
+
* so a host can recover settled work after a process interruption.
|
|
482
|
+
*/
|
|
483
|
+
applyRunEvent?(event: EvaluationRunEvent): Promise<void>;
|
|
484
|
+
};
|
|
485
|
+
export type EvaluationStoreInitialization = {
|
|
486
|
+
/** A recoverable persistence warning that a host may surface to the user. */
|
|
487
|
+
warning?: string;
|
|
488
|
+
};
|
|
489
|
+
/**
|
|
490
|
+
* Complete persistence boundary for Evaluations. Desktop, browser, and hosted
|
|
491
|
+
* Rivet instances implement this same contract so definitions and operational
|
|
492
|
+
* evidence cannot silently land in different stores.
|
|
493
|
+
*/
|
|
494
|
+
export type EvaluationStore = EvaluationRunStore & {
|
|
495
|
+
initialize?(): Promise<EvaluationStoreInitialization | void>;
|
|
496
|
+
getLibrary(): Promise<EvaluationLibrary>;
|
|
497
|
+
putLibrary(library: EvaluationLibrary): Promise<void>;
|
|
426
498
|
};
|
|
427
499
|
export type EvaluationReporter = {
|
|
428
500
|
report(run: EvaluationRun): Promise<void> | void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@valerypopoff/rivet2-evaluations",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/cjs/bundle.cjs",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@valerypopoff/rivet2-core": "^2.
|
|
39
|
+
"@valerypopoff/rivet2-core": "^2.4.0",
|
|
40
40
|
"yaml": "^2.9.0"
|
|
41
41
|
}
|
|
42
42
|
}
|