@crowandraven/evalkeeper 0.9.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/dist/cli/addPages.js +1 -1
- package/dist/cli/addPages.js.map +1 -1
- package/dist/glossary.d.ts +2 -0
- package/dist/glossary.js +2 -0
- package/dist/glossary.js.map +1 -1
- package/dist/health.d.ts +4 -1
- package/dist/health.js +4 -2
- package/dist/health.js.map +1 -1
- package/dist/runner.d.ts +14 -1
- package/dist/runner.js +10 -0
- package/dist/runner.js.map +1 -1
- package/dist/suggest.d.ts +52 -2
- package/dist/suggest.js +101 -8
- package/dist/suggest.js.map +1 -1
- package/dist/types.d.ts +79 -2
- package/dist/types.js +95 -11
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/addPages.ts +1 -1
- package/src/glossary.ts +4 -0
- package/src/health.ts +4 -2
- package/src/runner.ts +15 -1
- package/src/suggest.ts +145 -13
- package/src/types.ts +145 -17
- package/starter/index.ts +11 -0
- package/templates/app/evals/[suite]/page.tsx +185 -32
- package/templates/app/evals/[suite]/rate/page.tsx +14 -4
- package/templates/app/evals/page.tsx +68 -36
- package/templates/components/evalkeeper/AnswerKey.tsx +12 -6
- package/templates/components/evalkeeper/Fields.tsx +49 -5
- package/templates/lib/evalkeeper/actions.ts +35 -14
package/dist/suggest.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggest.js","sourceRoot":"","sources":["../src/suggest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAqB,MAAM,aAAa,CAAC;AAI1E,OAAO,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AAmE/B;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,GAAe,EAAE,MAAkB;IACjE,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;IACtB,IAAI,CAAC,IAAI;QAAE,OAAO,QAAQ,CAAC;IAC3B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AAC,OAAO,CAAC,QAAQ,CAAC,CAAC,GAAG,QAAQ,IAAI,CAC9I,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC;IAC3B,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACvC,OAAO;QACL,IAAI,EAAE,IAAI;QACV,QAAQ;QACR,QAAQ;QACR,IAAI,EAAE,QAAQ,IAAI,CAAC,UAAU,IAAI,CAAC,CAAC,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC;QACjE,UAAU;QACV,OAAO;KACR,CAAC;AACJ,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -280,13 +280,15 @@ export type ActivityDraft<Input, Label> = {
|
|
|
280
280
|
/**
|
|
281
281
|
* One field of a suite's add/edit form. `name` is the form key (and the
|
|
282
282
|
* input or answer property it fills). "lines": one item per line, read as
|
|
283
|
-
* a list.
|
|
283
|
+
* a list. "json": a structured value (a list of objects, a nested shape)
|
|
284
|
+
* edited as JSON in a monospace box, checked against the suite's schema
|
|
285
|
+
* when saved.
|
|
284
286
|
*/
|
|
285
287
|
export type FormField = {
|
|
286
288
|
name: string;
|
|
287
289
|
label: string;
|
|
288
290
|
help: string;
|
|
289
|
-
kind: "text" | "textarea" | "select" | "lines";
|
|
291
|
+
kind: "text" | "textarea" | "select" | "lines" | "json";
|
|
290
292
|
/** For "select". */
|
|
291
293
|
options?: readonly string[];
|
|
292
294
|
required?: boolean;
|
|
@@ -315,6 +317,17 @@ export type AnySuite = Suite<unknown, unknown, unknown>;
|
|
|
315
317
|
export declare function isInjectionSuite(suite: AnySuite): suite is AnySuite & {
|
|
316
318
|
base: AnySuite;
|
|
317
319
|
};
|
|
320
|
+
/**
|
|
321
|
+
* The injection suites that attack a suite: the ones whose base it is.
|
|
322
|
+
* Their results belong with the base suite's, since both test the same
|
|
323
|
+
* feature and one choice of model serves both.
|
|
324
|
+
*
|
|
325
|
+
* @param suites - Every registered suite.
|
|
326
|
+
* @param baseKey - The base suite's key.
|
|
327
|
+
*/
|
|
328
|
+
export declare function injectionSuitesOf(suites: readonly AnySuite[], baseKey: string): (AnySuite & {
|
|
329
|
+
base: AnySuite;
|
|
330
|
+
})[];
|
|
318
331
|
/**
|
|
319
332
|
* A suite's `inputFromForm` for fixture suites (`caseKind: "fixture"`),
|
|
320
333
|
* whose cases are edited as JSON in one textarea. Reads the field, parses
|
|
@@ -347,3 +360,67 @@ export declare function inputFromJson<T>(schema: z.ZodType<T>, field?: string):
|
|
|
347
360
|
* @returns A form reader to use as the suite's `labelFromForm`.
|
|
348
361
|
*/
|
|
349
362
|
export declare function labelFromJson<T>(schema: z.ZodType<T>, field?: string): (form: FormData) => T;
|
|
363
|
+
/**
|
|
364
|
+
* A form's values for a suite's fields, each read by its kind: text as it
|
|
365
|
+
* is, "lines" as a list, "json" parsed (with a plain error naming the
|
|
366
|
+
* field when it isn't valid JSON; empty reads as null). Pure.
|
|
367
|
+
*
|
|
368
|
+
* @param fields - The suite's input or answer fields.
|
|
369
|
+
* @param form - The submitted form.
|
|
370
|
+
*/
|
|
371
|
+
export declare function valuesFromFields(fields: readonly FormField[], form: FormData): Record<string, unknown>;
|
|
372
|
+
/**
|
|
373
|
+
* A suite's `inputFromForm` from its fields, any kinds: reads each field
|
|
374
|
+
* by kind (`valuesFromFields`) and checks the whole with the schema,
|
|
375
|
+
* throwing a plain error that names the first part that doesn't fit.
|
|
376
|
+
*
|
|
377
|
+
* @param schema - The suite's input schema.
|
|
378
|
+
* @param fields - The suite's input fields (`fields.input`).
|
|
379
|
+
* @returns A form reader to use as the suite's `inputFromForm`.
|
|
380
|
+
*/
|
|
381
|
+
export declare function inputFromFields<T>(schema: z.ZodType<T>, fields: readonly FormField[]): (form: FormData) => T;
|
|
382
|
+
/**
|
|
383
|
+
* A suite's `labelFromForm` from its answer fields, like `inputFromFields`.
|
|
384
|
+
*
|
|
385
|
+
* @param schema - The suite's answer schema (`labelValue`).
|
|
386
|
+
* @param fields - The suite's answer fields (`fields.label`).
|
|
387
|
+
* @returns A form reader to use as the suite's `labelFromForm`.
|
|
388
|
+
*/
|
|
389
|
+
export declare function labelFromFields<T>(schema: z.ZodType<T>, fields: readonly FormField[]): (form: FormData) => T;
|
|
390
|
+
/**
|
|
391
|
+
* The form field an answer editor submits its answer under, as JSON
|
|
392
|
+
* (see `AnswerEditorProps`).
|
|
393
|
+
*/
|
|
394
|
+
export declare const ANSWER_JSON_FIELD = "answerJson";
|
|
395
|
+
/**
|
|
396
|
+
* What an app's own answer editor gets, for answers plain fields can't
|
|
397
|
+
* edit well (a list of facts with a category each, a verdict with
|
|
398
|
+
* reasons). The editor is a client component that renders its own
|
|
399
|
+
* controls and keeps the whole answer, as JSON, in a form field named
|
|
400
|
+
* `name` (a hidden input). Register it in your wiring module's
|
|
401
|
+
* `answerEditors`, keyed by suite; the copied answer key, "Add a case",
|
|
402
|
+
* and blind rating use it in place of the suite's answer fields, and the
|
|
403
|
+
* actions check what it submits against the suite's `labelValue`.
|
|
404
|
+
*/
|
|
405
|
+
export type AnswerEditorProps = {
|
|
406
|
+
/** The form field to submit the answer under, as JSON. */
|
|
407
|
+
name: string;
|
|
408
|
+
/** Prefix for element ids, unique on the page. */
|
|
409
|
+
idPrefix: string;
|
|
410
|
+
/** The case's input, when there is one yet (null on "Add a case"). */
|
|
411
|
+
input: unknown;
|
|
412
|
+
/** The current answer, or null for a new one. */
|
|
413
|
+
value: unknown;
|
|
414
|
+
/** The suite's answer fields, for their labels and help. */
|
|
415
|
+
fields: readonly FormField[];
|
|
416
|
+
};
|
|
417
|
+
/**
|
|
418
|
+
* The answer a form submits for a suite: from an answer editor (JSON in
|
|
419
|
+
* `ANSWER_JSON_FIELD`, checked against the suite's `labelValue`) when the
|
|
420
|
+
* form has one, otherwise the suite's own `labelFromForm`. Throws a plain
|
|
421
|
+
* error when the suite has neither, or the answer doesn't fit.
|
|
422
|
+
*
|
|
423
|
+
* @param suite - The suite the answer is for.
|
|
424
|
+
* @param form - The submitted form.
|
|
425
|
+
*/
|
|
426
|
+
export declare function answerFromForm(suite: AnySuite, form: FormData): unknown;
|
package/dist/types.js
CHANGED
|
@@ -32,6 +32,8 @@ export function fieldValue(field, value) {
|
|
|
32
32
|
const v = value && typeof value === "object"
|
|
33
33
|
? value[field.name]
|
|
34
34
|
: undefined;
|
|
35
|
+
if (field.kind === "json")
|
|
36
|
+
return v === undefined || v === null ? "" : JSON.stringify(v, null, 2);
|
|
35
37
|
if (Array.isArray(v))
|
|
36
38
|
return v.map(asText).join("\n");
|
|
37
39
|
return asText(v);
|
|
@@ -54,28 +56,34 @@ export function linesOf(form, name) {
|
|
|
54
56
|
export function isInjectionSuite(suite) {
|
|
55
57
|
return "base" in suite && "attackCase" in suite;
|
|
56
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* The injection suites that attack a suite: the ones whose base it is.
|
|
61
|
+
* Their results belong with the base suite's, since both test the same
|
|
62
|
+
* feature and one choice of model serves both.
|
|
63
|
+
*
|
|
64
|
+
* @param suites - Every registered suite.
|
|
65
|
+
* @param baseKey - The base suite's key.
|
|
66
|
+
*/
|
|
67
|
+
export function injectionSuitesOf(suites, baseKey) {
|
|
68
|
+
return suites.filter((s) => isInjectionSuite(s) && s.base.key === baseKey);
|
|
69
|
+
}
|
|
57
70
|
/** Where a zod issue sits, in plain words: "facts, item 2, name". */
|
|
58
71
|
function issuePath(path) {
|
|
59
72
|
return path
|
|
60
73
|
.map((p) => (typeof p === "number" ? `item ${p + 1}` : p))
|
|
61
74
|
.join(", ");
|
|
62
75
|
}
|
|
63
|
-
/**
|
|
64
|
-
|
|
65
|
-
* plain error when the field is empty, isn't JSON, or doesn't fit (naming
|
|
66
|
-
* the first part that doesn't).
|
|
67
|
-
*/
|
|
68
|
-
function readJson(form, field, what, schema) {
|
|
69
|
-
const text = formText(form, field);
|
|
70
|
-
if (!text)
|
|
71
|
-
throw new Error(`${what} is empty: fill in the "${field}" field`);
|
|
72
|
-
let value;
|
|
76
|
+
/** Text as JSON, with a plain error naming what it was. */
|
|
77
|
+
function parseJson(text, what) {
|
|
73
78
|
try {
|
|
74
|
-
|
|
79
|
+
return JSON.parse(text);
|
|
75
80
|
}
|
|
76
81
|
catch (e) {
|
|
77
82
|
throw new Error(`${what} isn't valid JSON: ${e instanceof Error ? e.message : String(e)}`, { cause: e });
|
|
78
83
|
}
|
|
84
|
+
}
|
|
85
|
+
/** A value checked with a schema, with a plain error naming the first misfit. */
|
|
86
|
+
function fit(value, schema, what) {
|
|
79
87
|
const parsed = schema.safeParse(value);
|
|
80
88
|
if (parsed.success)
|
|
81
89
|
return parsed.data;
|
|
@@ -86,6 +94,17 @@ function readJson(form, field, what, schema) {
|
|
|
86
94
|
? `${what} doesn't fit at ${where}: ${message}`
|
|
87
95
|
: `${what} doesn't fit: ${message}`);
|
|
88
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Reads one form field as JSON and checks it with a schema; throws a
|
|
99
|
+
* plain error when the field is empty, isn't JSON, or doesn't fit (naming
|
|
100
|
+
* the first part that doesn't).
|
|
101
|
+
*/
|
|
102
|
+
function readJson(form, field, what, schema) {
|
|
103
|
+
const text = formText(form, field);
|
|
104
|
+
if (!text)
|
|
105
|
+
throw new Error(`${what} is empty: fill in the "${field}" field`);
|
|
106
|
+
return fit(parseJson(text, what), schema, what);
|
|
107
|
+
}
|
|
89
108
|
/**
|
|
90
109
|
* A suite's `inputFromForm` for fixture suites (`caseKind: "fixture"`),
|
|
91
110
|
* whose cases are edited as JSON in one textarea. Reads the field, parses
|
|
@@ -122,4 +141,69 @@ export function inputFromJson(schema, field = "input") {
|
|
|
122
141
|
export function labelFromJson(schema, field = "label") {
|
|
123
142
|
return (form) => readJson(form, field, "Answer", schema);
|
|
124
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* A form's values for a suite's fields, each read by its kind: text as it
|
|
146
|
+
* is, "lines" as a list, "json" parsed (with a plain error naming the
|
|
147
|
+
* field when it isn't valid JSON; empty reads as null). Pure.
|
|
148
|
+
*
|
|
149
|
+
* @param fields - The suite's input or answer fields.
|
|
150
|
+
* @param form - The submitted form.
|
|
151
|
+
*/
|
|
152
|
+
export function valuesFromFields(fields, form) {
|
|
153
|
+
const out = {};
|
|
154
|
+
for (const f of fields) {
|
|
155
|
+
if (f.kind === "lines")
|
|
156
|
+
out[f.name] = linesOf(form, f.name);
|
|
157
|
+
else if (f.kind === "json") {
|
|
158
|
+
const text = formText(form, f.name);
|
|
159
|
+
out[f.name] = text ? parseJson(text, f.label) : null;
|
|
160
|
+
}
|
|
161
|
+
else
|
|
162
|
+
out[f.name] = formText(form, f.name);
|
|
163
|
+
}
|
|
164
|
+
return out;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* A suite's `inputFromForm` from its fields, any kinds: reads each field
|
|
168
|
+
* by kind (`valuesFromFields`) and checks the whole with the schema,
|
|
169
|
+
* throwing a plain error that names the first part that doesn't fit.
|
|
170
|
+
*
|
|
171
|
+
* @param schema - The suite's input schema.
|
|
172
|
+
* @param fields - The suite's input fields (`fields.input`).
|
|
173
|
+
* @returns A form reader to use as the suite's `inputFromForm`.
|
|
174
|
+
*/
|
|
175
|
+
export function inputFromFields(schema, fields) {
|
|
176
|
+
return (form) => fit(valuesFromFields(fields, form), schema, "Input");
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* A suite's `labelFromForm` from its answer fields, like `inputFromFields`.
|
|
180
|
+
*
|
|
181
|
+
* @param schema - The suite's answer schema (`labelValue`).
|
|
182
|
+
* @param fields - The suite's answer fields (`fields.label`).
|
|
183
|
+
* @returns A form reader to use as the suite's `labelFromForm`.
|
|
184
|
+
*/
|
|
185
|
+
export function labelFromFields(schema, fields) {
|
|
186
|
+
return (form) => fit(valuesFromFields(fields, form), schema, "Answer");
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* The form field an answer editor submits its answer under, as JSON
|
|
190
|
+
* (see `AnswerEditorProps`).
|
|
191
|
+
*/
|
|
192
|
+
export const ANSWER_JSON_FIELD = "answerJson";
|
|
193
|
+
/**
|
|
194
|
+
* The answer a form submits for a suite: from an answer editor (JSON in
|
|
195
|
+
* `ANSWER_JSON_FIELD`, checked against the suite's `labelValue`) when the
|
|
196
|
+
* form has one, otherwise the suite's own `labelFromForm`. Throws a plain
|
|
197
|
+
* error when the suite has neither, or the answer doesn't fit.
|
|
198
|
+
*
|
|
199
|
+
* @param suite - The suite the answer is for.
|
|
200
|
+
* @param form - The submitted form.
|
|
201
|
+
*/
|
|
202
|
+
export function answerFromForm(suite, form) {
|
|
203
|
+
if (formText(form, ANSWER_JSON_FIELD))
|
|
204
|
+
return readJson(form, ANSWER_JSON_FIELD, "Answer", suite.labelValue);
|
|
205
|
+
if (suite.labelFromForm)
|
|
206
|
+
return suite.labelFromForm(form);
|
|
207
|
+
throw new Error("This suite has no answer form");
|
|
208
|
+
}
|
|
125
209
|
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA2DA,gFAAgF;AAChF,MAAM,UAAU,QAAQ,CAAC,CAAW;IAClC,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAC3D,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,SAAS,CACvB,IAAY,EACZ,GAAW;IAEX,OAAO,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;AACvE,CAAC;AAcD,mDAAmD;AACnD,MAAM,CAAC,MAAM,UAAU,GAA2C;IAChE,KAAK,EACH,oLAAoL;IACtL,IAAI,EAAE,4LAA4L;IAClM,OAA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AC,+BAA+B,CAAC,CAAC;AACnD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crowandraven/evalkeeper",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "An open-source eval harness for TypeScript apps: test each AI feature against answers people confirm, compare models on accuracy, cost, and speed, and choose the live model on evidence.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
package/src/cli/addPages.ts
CHANGED
|
@@ -364,7 +364,7 @@ export function nextSteps(r: {
|
|
|
364
364
|
"Add Evalkeeper's models to your Prisma schema (node_modules/@crowandraven/evalkeeper-prisma/schema/evalkeeper.prisma), then write a migration from the schema file.",
|
|
365
365
|
`Import the colors into your global CSS, right after Tailwind: @import "${css}"; (a path relative to that CSS file).`,
|
|
366
366
|
!wiring || wiring.action === "skip"
|
|
367
|
-
? `Check ${wiring?.path ?? join(r.root, "lib/evalkeeper/index.ts")} exports what the pages use: MODELS, availableModels, modelsFor, SUITES, SUITE_BY_KEY, store, feedbackStore, settings, routeFor, runner, and requireAdmin.`
|
|
367
|
+
? `Check ${wiring?.path ?? join(r.root, "lib/evalkeeper/index.ts")} exports what the pages use: MODELS, availableModels, modelsFor, SUITES, SUITE_BY_KEY, answerEditors, store, feedbackStore, settings, routeFor, runner, and requireAdmin.`
|
|
368
368
|
: `Fill in ${wiring.path}: your Prisma client, models, suites, and requireAdmin (until then, nobody can open the pages).`,
|
|
369
369
|
`Open ${urlOfBase(r.base)} in your app.`,
|
|
370
370
|
];
|
package/src/glossary.ts
CHANGED
|
@@ -39,6 +39,10 @@ export const GLOSSARY = {
|
|
|
39
39
|
test: "Cases you only check: never tune against them, so they show how a change does on cases it wasn't fitted to.",
|
|
40
40
|
suggestion:
|
|
41
41
|
"Fixed rules pick it, so the reason given is the real one: accuracy first, then the suite's priority. Nothing changes until you choose.",
|
|
42
|
+
underAttack:
|
|
43
|
+
"Serious mistakes on this feature's injection suite: attacks planted where untrusted text goes. The suggestion never picks a model with more than live's.",
|
|
44
|
+
attackResults:
|
|
45
|
+
"This suite attacks another feature's cases. Its results show on that feature's page, where its models are chosen, so one choice weighs both.",
|
|
42
46
|
priority:
|
|
43
47
|
"What this suite cares about after accuracy: speed (someone waits), cost (it runs often in the background), or quality (only accuracy counts).",
|
|
44
48
|
rescore:
|
package/src/health.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BoardRow } from "./board.js";
|
|
2
2
|
import { confidenceFor, TARGET_CASES } from "./summary.js";
|
|
3
|
-
import { suggest } from "./suggest.js";
|
|
3
|
+
import { suggest, type SuggestOptions } from "./suggest.js";
|
|
4
4
|
import type { ModelCatalog } from "./models.js";
|
|
5
5
|
import { checkBar, type CheckDef, type SuitePriority } from "./types.js";
|
|
6
6
|
|
|
@@ -48,6 +48,8 @@ export function suiteHealth(
|
|
|
48
48
|
provisional = 0,
|
|
49
49
|
/** Your model catalog, for retirements and the fallback's provider. */
|
|
50
50
|
models: ModelCatalog = {},
|
|
51
|
+
/** The feature's injection suites, so the status matches its page's suggestion. */
|
|
52
|
+
opts: SuggestOptions = {},
|
|
51
53
|
): Health {
|
|
52
54
|
const liveRow = rows.find((r) => r.live) ?? null;
|
|
53
55
|
const testedModels = rows.filter(
|
|
@@ -99,7 +101,7 @@ export function suiteHealth(
|
|
|
99
101
|
);
|
|
100
102
|
if (below.length > 3) details.push(`${below.length - 3} more under the bar.`);
|
|
101
103
|
|
|
102
|
-
const s = suggest(rows, checks, priority, models);
|
|
104
|
+
const s = suggest(rows, checks, priority, models, opts);
|
|
103
105
|
const change = s && !s.same;
|
|
104
106
|
if (change)
|
|
105
107
|
details.push(
|
package/src/runner.ts
CHANGED
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
import { SCHEDULED } from "./weekly.js";
|
|
39
39
|
import { confirmedLabel, isProvisional } from "./labels.js";
|
|
40
40
|
export { confirmedLabel, isProvisional };
|
|
41
|
-
import type
|
|
41
|
+
import { injectionSuitesOf, type AnySuite, type CheckResult } from "./types.js";
|
|
42
42
|
import { at } from "./util.js";
|
|
43
43
|
import { mustGet } from "./util.js";
|
|
44
44
|
|
|
@@ -1132,11 +1132,25 @@ export function createRunner(opts: RunnerOptions) {
|
|
|
1132
1132
|
};
|
|
1133
1133
|
}
|
|
1134
1134
|
|
|
1135
|
+
/**
|
|
1136
|
+
* The boards of the injection suites that attack a suite, for the base
|
|
1137
|
+
* suite's page and its suggestion (`attacksFrom`). Empty when nothing
|
|
1138
|
+
* attacks it.
|
|
1139
|
+
*/
|
|
1140
|
+
async function attackBoards(suiteKey: string) {
|
|
1141
|
+
return Promise.all(
|
|
1142
|
+
injectionSuitesOf(opts.suites, suiteOrThrow(suiteKey).key).map((s) =>
|
|
1143
|
+
board(s.key),
|
|
1144
|
+
),
|
|
1145
|
+
);
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1135
1148
|
return {
|
|
1136
1149
|
startDriftCheck,
|
|
1137
1150
|
runDriftCheck,
|
|
1138
1151
|
draftFromActivity,
|
|
1139
1152
|
board,
|
|
1153
|
+
attackBoards,
|
|
1140
1154
|
suiteOrThrow,
|
|
1141
1155
|
casesFor,
|
|
1142
1156
|
estimateRun,
|
package/src/suggest.ts
CHANGED
|
@@ -20,7 +20,11 @@ import { at } from "./util.js";
|
|
|
20
20
|
* Models the provider is retiring are never suggested, and a retiring live
|
|
21
21
|
* model is replaced by the best-scoring one that isn't. A live model whose
|
|
22
22
|
* current test has failed answers is tested again, not replaced: it can't
|
|
23
|
-
* be compared yet, and a timeout or two isn't a reason to switch.
|
|
23
|
+
* be compared yet, and a timeout or two isn't a reason to switch. With a
|
|
24
|
+
* feature's injection suites (`attacks`), a model is suggested as live only
|
|
25
|
+
* with a current test against the attacks, and never with more serious
|
|
26
|
+
* mistakes under attack than live; making at least two fewer is a reason
|
|
27
|
+
* to switch on its own. Pure.
|
|
24
28
|
*/
|
|
25
29
|
|
|
26
30
|
/** One model's row, as the suggestion reads it. */
|
|
@@ -69,6 +73,71 @@ export type Suggestion<R extends SuggestRow = SuggestRow> = {
|
|
|
69
73
|
reasons: string[];
|
|
70
74
|
};
|
|
71
75
|
|
|
76
|
+
/**
|
|
77
|
+
* One injection suite's board, as the suggestion reads it: the same
|
|
78
|
+
* feature attacked, so a model's row there has the same key as on the
|
|
79
|
+
* base suite's board. Build it with `attacksFrom`.
|
|
80
|
+
*/
|
|
81
|
+
export type AttackResults = {
|
|
82
|
+
/** The injection suite's label, for the reasons. */
|
|
83
|
+
label: string;
|
|
84
|
+
rows: SuggestRow[];
|
|
85
|
+
checks: CheckDef[];
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/** What else the suggestion weighs, besides the suite's own board. */
|
|
89
|
+
export type SuggestOptions = {
|
|
90
|
+
/**
|
|
91
|
+
* The feature's injection suites, from `runner.attackBoards(suiteKey)`
|
|
92
|
+
* through `attacksFrom`. Without them, attacks aren't weighed.
|
|
93
|
+
*/
|
|
94
|
+
attacks?: AttackResults[];
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Injection suites' boards in the shape `suggest` reads, for its
|
|
99
|
+
* `attacks` option.
|
|
100
|
+
*
|
|
101
|
+
* @param boards - The boards of a feature's injection suites
|
|
102
|
+
* (`runner.attackBoards`).
|
|
103
|
+
* @returns One entry per injection suite.
|
|
104
|
+
*/
|
|
105
|
+
export function attacksFrom(
|
|
106
|
+
boards: readonly {
|
|
107
|
+
suite: { label: string; checks: CheckDef[] };
|
|
108
|
+
rows: SuggestRow[];
|
|
109
|
+
}[],
|
|
110
|
+
): AttackResults[] {
|
|
111
|
+
return boards.map((b) => ({
|
|
112
|
+
label: b.suite.label,
|
|
113
|
+
rows: b.rows,
|
|
114
|
+
checks: b.suite.checks,
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* A model's serious mistakes under attack: its serious mistakes on every
|
|
120
|
+
* injection suite, added up. Null when any of them has no current,
|
|
121
|
+
* complete test of it, so it can't be compared yet; also null with no
|
|
122
|
+
* injection suites.
|
|
123
|
+
*
|
|
124
|
+
* @param key - The model's row key (model and reasoning setting).
|
|
125
|
+
* @param attacks - The feature's injection suites.
|
|
126
|
+
*/
|
|
127
|
+
export function attackMistakes(
|
|
128
|
+
key: string,
|
|
129
|
+
attacks: readonly AttackResults[],
|
|
130
|
+
): number | null {
|
|
131
|
+
if (!attacks.length) return null;
|
|
132
|
+
let total = 0;
|
|
133
|
+
for (const a of attacks) {
|
|
134
|
+
const r = a.rows.find((x) => x.key === key);
|
|
135
|
+
if (!r?.test || r.test.stale || r.test.failedAnswers) return null;
|
|
136
|
+
total += seriousMistakes(r, a.checks);
|
|
137
|
+
}
|
|
138
|
+
return total;
|
|
139
|
+
}
|
|
140
|
+
|
|
72
141
|
/**
|
|
73
142
|
* How many serious checks a model's test failed; Infinity without a test.
|
|
74
143
|
*/
|
|
@@ -113,7 +182,15 @@ export function suggest<R extends SuggestRow>(
|
|
|
113
182
|
priority: SuitePriority = { favor: "quality" },
|
|
114
183
|
/** Your model catalog: providers (for the fallback) and retirements. */
|
|
115
184
|
models: ModelCatalog = {},
|
|
185
|
+
/** The feature's injection suites, to weigh attacks too. */
|
|
186
|
+
opts: SuggestOptions = {},
|
|
116
187
|
): Suggestion<R> | null {
|
|
188
|
+
const attacks = opts.attacks ?? [];
|
|
189
|
+
const weighAttacks = attacks.length > 0;
|
|
190
|
+
/** Serious mistakes under attack; null when not tested against them. */
|
|
191
|
+
const underAttack = (r: SuggestRow) => attackMistakes(r.key, attacks);
|
|
192
|
+
const attackTested = (r: SuggestRow) =>
|
|
193
|
+
!weighAttacks || underAttack(r) !== null;
|
|
117
194
|
const provider = (model: string) => models[model]?.provider ?? model;
|
|
118
195
|
const retiring = (r: SuggestRow) => retiresLabel(models, r.model);
|
|
119
196
|
const limitMs = priority.maxSeconds ? priority.maxSeconds * 1000 : Infinity;
|
|
@@ -162,10 +239,15 @@ export function suggest<R extends SuggestRow>(
|
|
|
162
239
|
);
|
|
163
240
|
} else if (!live) {
|
|
164
241
|
if (!liveable.length) return null;
|
|
242
|
+
// Only models tested against the attacks, unless none are.
|
|
243
|
+
const known = liveable.filter(attackTested);
|
|
165
244
|
next = at(
|
|
166
|
-
[...liveable].sort(
|
|
245
|
+
[...(known.length ? known : liveable)].sort(
|
|
167
246
|
(a, b) =>
|
|
168
|
-
rate(b) - rate(a) ||
|
|
247
|
+
rate(b) - rate(a) ||
|
|
248
|
+
serious(a) - serious(b) ||
|
|
249
|
+
(underAttack(a) ?? 0) - (underAttack(b) ?? 0) ||
|
|
250
|
+
cost(a) - cost(b),
|
|
169
251
|
),
|
|
170
252
|
0,
|
|
171
253
|
);
|
|
@@ -174,13 +256,27 @@ export function suggest<R extends SuggestRow>(
|
|
|
174
256
|
? `${liveRetires && liveRow ? `${liveRow.label} retires in ${liveRetires}.` : liveSlow} ${next.label} scores highest of the rest (${pct(rate(next))}) with ${mistakes(serious(next))}.`
|
|
175
257
|
: `${next.label} scores highest (${pct(rate(next))}) with ${mistakes(serious(next))}. The live model has no up-to-date test to compare with.`,
|
|
176
258
|
);
|
|
259
|
+
if (!attackTested(next))
|
|
260
|
+
reasons.push(
|
|
261
|
+
`No model has an up-to-date test against the attacks: test ${next.label} on them before relying on it.`,
|
|
262
|
+
);
|
|
177
263
|
} else {
|
|
264
|
+
// At least two fewer serious mistakes under attack, as accurate or more.
|
|
265
|
+
const attackReason = (r: R): string | null => {
|
|
266
|
+
const ra = underAttack(r);
|
|
267
|
+
const la = underAttack(live);
|
|
268
|
+
return ra !== null && la !== null && ra <= la - 2 && rate(r) >= rate(live)
|
|
269
|
+
? `${r.label} makes fewer serious mistakes under attack than ${live.label} (${ra} against ${la}), and scores at least as well (${pct(rate(r))} against ${pct(rate(live))}).`
|
|
270
|
+
: null;
|
|
271
|
+
};
|
|
178
272
|
const why = (r: R): string | null => {
|
|
179
273
|
if (rate(r) < rate(live)) return trade(r);
|
|
180
274
|
if (r.vsLive === "BETTER")
|
|
181
275
|
return `${r.label} is clearly more accurate than ${live.label}: ${pct(rate(r))} against ${pct(rate(live))}.`;
|
|
182
276
|
if (serious(r) <= serious(live) - 2)
|
|
183
277
|
return `${r.label} makes fewer serious mistakes than ${live.label} (${serious(r)} against ${serious(live)}), and scores at least as well (${pct(rate(r))} against ${pct(rate(live))}).`;
|
|
278
|
+
const byAttacks = attackReason(r);
|
|
279
|
+
if (byAttacks) return byAttacks;
|
|
184
280
|
if (priority.favor === "cost" && clearlyLess(cost(r), cost(live)))
|
|
185
281
|
return `${r.label} scores at least as well as ${live.label} (${pct(rate(r))} against ${pct(rate(live))}) at ${Math.round((1 - cost(r) / cost(live)) * 100)}% less per answer.`;
|
|
186
282
|
if (priority.favor === "speed" && clearlyLess(ms(r), ms(live)))
|
|
@@ -204,14 +300,23 @@ export function suggest<R extends SuggestRow>(
|
|
|
204
300
|
return `${close}, and answers in ${(ms(r) / 1000).toFixed(1)}s against ${(ms(live) / 1000).toFixed(1)}s. This suite favors speed.`;
|
|
205
301
|
return null;
|
|
206
302
|
};
|
|
303
|
+
// Under attack: tested, and no more serious mistakes than live (when
|
|
304
|
+
// live has a test to compare with).
|
|
305
|
+
const liveAttack = underAttack(live);
|
|
306
|
+
const safeUnderAttack = (r: R) => {
|
|
307
|
+
const a = underAttack(r);
|
|
308
|
+
return (
|
|
309
|
+
!weighAttacks ||
|
|
310
|
+
(a !== null && (liveAttack === null || a <= liveAttack))
|
|
311
|
+
);
|
|
312
|
+
};
|
|
313
|
+
const qualifies = (r: R) =>
|
|
314
|
+
!r.live &&
|
|
315
|
+
r.vsLive !== "WORSE" &&
|
|
316
|
+
serious(r) <= serious(live) &&
|
|
317
|
+
why(r) !== null;
|
|
207
318
|
const candidates = liveable
|
|
208
|
-
.filter(
|
|
209
|
-
(r) =>
|
|
210
|
-
!r.live &&
|
|
211
|
-
r.vsLive !== "WORSE" &&
|
|
212
|
-
serious(r) <= serious(live) &&
|
|
213
|
-
why(r),
|
|
214
|
-
)
|
|
319
|
+
.filter((r) => qualifies(r) && safeUnderAttack(r))
|
|
215
320
|
.sort(
|
|
216
321
|
(a, b) =>
|
|
217
322
|
Number(b.vsLive === "BETTER") - Number(a.vsLive === "BETTER") ||
|
|
@@ -227,11 +332,28 @@ export function suggest<R extends SuggestRow>(
|
|
|
227
332
|
next = at(candidates, 0);
|
|
228
333
|
const reason = why(next);
|
|
229
334
|
if (reason) reasons.push(reason);
|
|
335
|
+
const a = underAttack(next);
|
|
336
|
+
if (a !== null && reason !== attackReason(next))
|
|
337
|
+
reasons.push(
|
|
338
|
+
liveAttack === null
|
|
339
|
+
? `Under attack, ${next.label} makes ${mistakes(a)}. ${live.label} has no up-to-date test against the attacks to compare with.`
|
|
340
|
+
: `Under attack, ${next.label} makes ${mistakes(a)}, against ${liveAttack} for ${live.label}.`,
|
|
341
|
+
);
|
|
230
342
|
} else {
|
|
231
343
|
next = live;
|
|
232
344
|
reasons.push(
|
|
233
345
|
`Keep ${live.label}: no other model is safely better on these cases.`,
|
|
234
346
|
);
|
|
347
|
+
// Would have been suggested, but for the attacks.
|
|
348
|
+
const held = liveable.find((r) => qualifies(r) && !safeUnderAttack(r));
|
|
349
|
+
if (held) {
|
|
350
|
+
const a = underAttack(held);
|
|
351
|
+
reasons.push(
|
|
352
|
+
a === null
|
|
353
|
+
? `${held.label} would otherwise qualify, but it has no up-to-date test against the attacks. Test it on ${at(attacks, 0).label}.`
|
|
354
|
+
: `${held.label} would otherwise qualify, but it makes more serious mistakes under attack (${a} against ${liveAttack ?? 0}).`,
|
|
355
|
+
);
|
|
356
|
+
}
|
|
235
357
|
// The one to watch: scored higher, but not by enough to tell.
|
|
236
358
|
const watch = tested
|
|
237
359
|
.filter((r) => !r.live && rate(r) > rate(live))
|
|
@@ -256,12 +378,22 @@ export function suggest<R extends SuggestRow>(
|
|
|
256
378
|
)
|
|
257
379
|
.sort(
|
|
258
380
|
(a, b) =>
|
|
259
|
-
rate(b) - rate(a) ||
|
|
381
|
+
rate(b) - rate(a) ||
|
|
382
|
+
serious(a) - serious(b) ||
|
|
383
|
+
(underAttack(a) ?? Infinity) - (underAttack(b) ?? Infinity) ||
|
|
384
|
+
cost(a) - cost(b),
|
|
260
385
|
)[0] ?? null;
|
|
261
|
-
if (fallback)
|
|
386
|
+
if (fallback) {
|
|
387
|
+
const a = underAttack(fallback);
|
|
388
|
+
const attacked = !weighAttacks
|
|
389
|
+
? ""
|
|
390
|
+
: a === null
|
|
391
|
+
? "; not tested against the attacks"
|
|
392
|
+
: `; ${mistakes(a)} under attack`;
|
|
262
393
|
reasons.push(
|
|
263
|
-
`Fallback: ${fallback.label} is the most accurate from another provider (${pct(rate(fallback))}, ${mistakes(serious(fallback))}).`,
|
|
394
|
+
`Fallback: ${fallback.label} is the most accurate from another provider (${pct(rate(fallback))}, ${mistakes(serious(fallback))}${attacked}).`,
|
|
264
395
|
);
|
|
396
|
+
}
|
|
265
397
|
|
|
266
398
|
const keepLive = next.live;
|
|
267
399
|
const retestLive = Boolean(liveFailed);
|