@crowandraven/evalkeeper 0.2.0 → 0.3.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/importCases.d.ts +94 -0
- package/dist/importCases.js +185 -0
- package/dist/importCases.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/labels.d.ts +9 -3
- package/dist/labels.js +2 -0
- package/dist/labels.js.map +1 -1
- package/dist/memoryStore.js +3 -2
- package/dist/memoryStore.js.map +1 -1
- package/dist/models.d.ts +17 -6
- package/dist/models.js +29 -5
- package/dist/models.js.map +1 -1
- package/dist/runner.d.ts +16 -1
- package/dist/runner.js +34 -5
- package/dist/runner.js.map +1 -1
- package/dist/settings.js +1 -0
- package/dist/settings.js.map +1 -1
- package/dist/store.d.ts +13 -2
- package/dist/testing.js +27 -0
- package/dist/testing.js.map +1 -1
- package/dist/types.d.ts +5 -0
- package/dist/types.js.map +1 -1
- package/dist/weekly.js +3 -2
- package/dist/weekly.js.map +1 -1
- package/package.json +1 -1
- package/src/importCases.ts +252 -0
- package/src/index.ts +1 -0
- package/src/labels.ts +9 -4
- package/src/memoryStore.ts +6 -2
- package/src/models.ts +35 -7
- package/src/runner.ts +67 -19
- package/src/settings.ts +1 -0
- package/src/store.ts +14 -2
- package/src/testing.ts +33 -0
- package/src/types.ts +5 -0
- package/src/weekly.ts +3 -2
- package/templates/app/evals/[suite]/page.tsx +1 -2
- package/templates/app/evals/feedback/page.tsx +11 -6
- package/templates/app/evals/page.tsx +40 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { EvalStore } from "./store.js";
|
|
2
|
+
import type { AnySuite } from "./types.js";
|
|
3
|
+
/** One row of an import, mapped to the suite's shapes. */
|
|
4
|
+
export type ImportedCase = {
|
|
5
|
+
/** Stable within its source (a row id in the file), so a rerun skips it. */
|
|
6
|
+
id: string;
|
|
7
|
+
/** The suite's input; checked against `suite.input`. */
|
|
8
|
+
input: unknown;
|
|
9
|
+
/** The answer, checked against `suite.labelValue`; null: none yet. */
|
|
10
|
+
label: unknown;
|
|
11
|
+
tags?: string[];
|
|
12
|
+
note?: string | null;
|
|
13
|
+
/** This row's set, instead of the import's `split`. */
|
|
14
|
+
split?: "DEV" | "TEST";
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* How imported answers arrive. Pending (the default): a person confirms
|
|
18
|
+
* each one on the pages before tests use it. Provisional: tests use them
|
|
19
|
+
* now, every score says it rests on unreviewed answers, and the rows carry
|
|
20
|
+
* `tag` so the review queue is findable. Use provisional only when the
|
|
21
|
+
* owner said so; `allowedBy` and `at` record who and when. Nothing is
|
|
22
|
+
* imported confirmed: only a person confirms an answer.
|
|
23
|
+
*/
|
|
24
|
+
export type ImportAnswers = {
|
|
25
|
+
status: "PENDING";
|
|
26
|
+
} | {
|
|
27
|
+
status: "PROVISIONAL";
|
|
28
|
+
/** Who drafted the answers: an agent's name, recorded as the rater. */
|
|
29
|
+
rater: string;
|
|
30
|
+
/** The person who allowed using them before review. */
|
|
31
|
+
allowedBy: string;
|
|
32
|
+
/** When they allowed it; default now. */
|
|
33
|
+
at?: Date;
|
|
34
|
+
/** Added to each row's tags; default "needs-review". */
|
|
35
|
+
tag?: string;
|
|
36
|
+
};
|
|
37
|
+
/** A row that couldn't be imported, and why. */
|
|
38
|
+
export type ImportProblem = {
|
|
39
|
+
id: string;
|
|
40
|
+
problem: string;
|
|
41
|
+
};
|
|
42
|
+
/** Rows that don't fit the suite. Nothing was written. */
|
|
43
|
+
export declare class CaseImportError extends Error {
|
|
44
|
+
readonly problems: ImportProblem[];
|
|
45
|
+
constructor(source: string, problems: ImportProblem[]);
|
|
46
|
+
}
|
|
47
|
+
/** What an import did. */
|
|
48
|
+
export type ImportResult = {
|
|
49
|
+
/** Cases created. */
|
|
50
|
+
added: number;
|
|
51
|
+
/** Rows imported before (by source and id), left alone. */
|
|
52
|
+
skipped: number;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Imports existing test data as cases for one suite. Every row is mapped
|
|
56
|
+
* and checked against the suite's input and answer schemas first; if any
|
|
57
|
+
* row fails, nothing is written and `CaseImportError` lists them. Rows
|
|
58
|
+
* imported before (same source and id, retired ones included) are skipped,
|
|
59
|
+
* so it can run again after the file grows.
|
|
60
|
+
*
|
|
61
|
+
* Splits: "DEV" for cases you tune against, "TEST" for a held-out file,
|
|
62
|
+
* "auto" (the default) for new cases, split like cases added by hand.
|
|
63
|
+
*
|
|
64
|
+
* Run it against your development database; an app's own guard should
|
|
65
|
+
* refuse a production one.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* const { added, skipped } = await importCases({
|
|
70
|
+
* store,
|
|
71
|
+
* suite: ticketTriage,
|
|
72
|
+
* source: "tickets-heldout.json",
|
|
73
|
+
* rows: JSON.parse(await readFile("tickets-heldout.json", "utf8")),
|
|
74
|
+
* map: (r) => ({ id: r.id, input: { body: r.text }, label: { queue: r.queue } }),
|
|
75
|
+
* split: "TEST",
|
|
76
|
+
* });
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
export declare function importCases<Row>(opts: {
|
|
80
|
+
store: EvalStore;
|
|
81
|
+
suite: AnySuite;
|
|
82
|
+
/** Where the rows came from, such as a file name. */
|
|
83
|
+
source: string;
|
|
84
|
+
rows: readonly Row[];
|
|
85
|
+
map: (row: Row, index: number) => ImportedCase;
|
|
86
|
+
split?: "DEV" | "TEST" | "auto";
|
|
87
|
+
answers?: ImportAnswers;
|
|
88
|
+
}): Promise<ImportResult>;
|
|
89
|
+
/**
|
|
90
|
+
* Adds a suite's `starter` cases as drafts with pending answers, for a
|
|
91
|
+
* person to confirm on the pages. Safe to run again: starters already
|
|
92
|
+
* added (by their input) are skipped.
|
|
93
|
+
*/
|
|
94
|
+
export declare function importStarters(store: EvalStore, suite: AnySuite): Promise<ImportResult>;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { nextSplit } from "./quickSet.js";
|
|
2
|
+
import { stableJson } from "./stableJson.js";
|
|
3
|
+
/** Rows that don't fit the suite. Nothing was written. */
|
|
4
|
+
export class CaseImportError extends Error {
|
|
5
|
+
problems;
|
|
6
|
+
constructor(source, problems) {
|
|
7
|
+
super(`${problems.length} row${problems.length === 1 ? "" : "s"} in ${source} can't be imported, so none were: ${problems
|
|
8
|
+
.slice(0, 5)
|
|
9
|
+
.map((p) => `${p.id} (${p.problem})`)
|
|
10
|
+
.join("; ")}${problems.length > 5 ? "; …" : ""}`);
|
|
11
|
+
this.name = "CaseImportError";
|
|
12
|
+
this.problems = problems;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
const sourceRefOf = (source, id) => `${source}#${id}`;
|
|
16
|
+
/**
|
|
17
|
+
* Imports existing test data as cases for one suite. Every row is mapped
|
|
18
|
+
* and checked against the suite's input and answer schemas first; if any
|
|
19
|
+
* row fails, nothing is written and `CaseImportError` lists them. Rows
|
|
20
|
+
* imported before (same source and id, retired ones included) are skipped,
|
|
21
|
+
* so it can run again after the file grows.
|
|
22
|
+
*
|
|
23
|
+
* Splits: "DEV" for cases you tune against, "TEST" for a held-out file,
|
|
24
|
+
* "auto" (the default) for new cases, split like cases added by hand.
|
|
25
|
+
*
|
|
26
|
+
* Run it against your development database; an app's own guard should
|
|
27
|
+
* refuse a production one.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const { added, skipped } = await importCases({
|
|
32
|
+
* store,
|
|
33
|
+
* suite: ticketTriage,
|
|
34
|
+
* source: "tickets-heldout.json",
|
|
35
|
+
* rows: JSON.parse(await readFile("tickets-heldout.json", "utf8")),
|
|
36
|
+
* map: (r) => ({ id: r.id, input: { body: r.text }, label: { queue: r.queue } }),
|
|
37
|
+
* split: "TEST",
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export async function importCases(opts) {
|
|
42
|
+
const { store, suite, source } = opts;
|
|
43
|
+
const answers = opts.answers ?? { status: "PENDING" };
|
|
44
|
+
// 1. Map and check every row before writing anything.
|
|
45
|
+
const problems = [];
|
|
46
|
+
const seen = new Set();
|
|
47
|
+
const mapped = [];
|
|
48
|
+
opts.rows.forEach((row, i) => {
|
|
49
|
+
let c;
|
|
50
|
+
try {
|
|
51
|
+
c = opts.map(row, i);
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
problems.push({
|
|
55
|
+
id: `row ${i + 1}`,
|
|
56
|
+
problem: e instanceof Error ? e.message : String(e),
|
|
57
|
+
});
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const id = c.id || `row ${i + 1}`;
|
|
61
|
+
if (!c.id)
|
|
62
|
+
problems.push({ id, problem: "no id" });
|
|
63
|
+
else if (seen.has(c.id))
|
|
64
|
+
problems.push({ id, problem: "the same id as an earlier row" });
|
|
65
|
+
seen.add(c.id);
|
|
66
|
+
const input = suite.input.safeParse(c.input);
|
|
67
|
+
if (!input.success)
|
|
68
|
+
problems.push({
|
|
69
|
+
id,
|
|
70
|
+
problem: `input: ${input.error.issues[0]?.message ?? "invalid"}`,
|
|
71
|
+
});
|
|
72
|
+
let label = null;
|
|
73
|
+
if (c.label !== null && c.label !== undefined) {
|
|
74
|
+
const l = suite.labelValue.safeParse(c.label);
|
|
75
|
+
if (!l.success)
|
|
76
|
+
problems.push({
|
|
77
|
+
id,
|
|
78
|
+
problem: `answer: ${l.error.issues[0]?.message ?? "invalid"}`,
|
|
79
|
+
});
|
|
80
|
+
else
|
|
81
|
+
label = l.data;
|
|
82
|
+
}
|
|
83
|
+
if (input.success)
|
|
84
|
+
mapped.push({ ...c, input: input.data, label });
|
|
85
|
+
});
|
|
86
|
+
if (problems.length)
|
|
87
|
+
throw new CaseImportError(source, problems);
|
|
88
|
+
// 2. Skip what's already there, retired cases included.
|
|
89
|
+
const existing = await store.listCases(suite.key, { includeRetired: true });
|
|
90
|
+
const refs = new Set(existing.map((c) => c.sourceRef));
|
|
91
|
+
const counts = { DEV: 0, TEST: 0 };
|
|
92
|
+
for (const c of existing)
|
|
93
|
+
if (c.status !== "RETIRED")
|
|
94
|
+
counts[c.split] += 1;
|
|
95
|
+
const at = answers.status === "PROVISIONAL" ? (answers.at ?? new Date()) : null;
|
|
96
|
+
let added = 0;
|
|
97
|
+
let skipped = 0;
|
|
98
|
+
for (const c of mapped) {
|
|
99
|
+
const sourceRef = sourceRefOf(source, c.id);
|
|
100
|
+
if (refs.has(sourceRef)) {
|
|
101
|
+
skipped += 1;
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
const split = c.split ??
|
|
105
|
+
(opts.split === "DEV" || opts.split === "TEST"
|
|
106
|
+
? opts.split
|
|
107
|
+
: nextSplit(counts));
|
|
108
|
+
counts[split] += 1;
|
|
109
|
+
const labels = [];
|
|
110
|
+
if (c.label !== null)
|
|
111
|
+
labels.push(answers.status === "PROVISIONAL"
|
|
112
|
+
? {
|
|
113
|
+
kind: "EXPECTED",
|
|
114
|
+
status: "PROVISIONAL",
|
|
115
|
+
value: c.label,
|
|
116
|
+
raterRole: "AGENT",
|
|
117
|
+
raterId: answers.rater,
|
|
118
|
+
note: `Drafted by ${answers.rater}; ${answers.allowedBy} allowed testing on it before review (${at?.toISOString().slice(0, 10)}).`,
|
|
119
|
+
}
|
|
120
|
+
: {
|
|
121
|
+
kind: "EXPECTED",
|
|
122
|
+
status: "PENDING",
|
|
123
|
+
value: c.label,
|
|
124
|
+
raterRole: "IMPORT",
|
|
125
|
+
raterId: null,
|
|
126
|
+
note: null,
|
|
127
|
+
});
|
|
128
|
+
const tags = [...(c.tags ?? [])];
|
|
129
|
+
if (answers.status === "PROVISIONAL" && c.label !== null) {
|
|
130
|
+
const tag = answers.tag ?? "needs-review";
|
|
131
|
+
if (!tags.includes(tag))
|
|
132
|
+
tags.push(tag);
|
|
133
|
+
}
|
|
134
|
+
const data = {
|
|
135
|
+
suite: suite.key,
|
|
136
|
+
input: c.input,
|
|
137
|
+
tags,
|
|
138
|
+
split,
|
|
139
|
+
// In use only with an answer tests may grade against.
|
|
140
|
+
status: c.label !== null && answers.status === "PROVISIONAL"
|
|
141
|
+
? "ACTIVE"
|
|
142
|
+
: "DRAFT",
|
|
143
|
+
source: "IMPORT",
|
|
144
|
+
sourceRef,
|
|
145
|
+
note: c.note ?? null,
|
|
146
|
+
labels,
|
|
147
|
+
};
|
|
148
|
+
await store.createCase(data);
|
|
149
|
+
refs.add(sourceRef);
|
|
150
|
+
added += 1;
|
|
151
|
+
}
|
|
152
|
+
return { added, skipped };
|
|
153
|
+
}
|
|
154
|
+
/** A short, stable id for a starter case: a hash of its input. */
|
|
155
|
+
function starterId(input) {
|
|
156
|
+
// FNV-1a: the core stays free of node:crypto; this only names rows.
|
|
157
|
+
let h = 0x811c9dc5;
|
|
158
|
+
for (const ch of stableJson(input)) {
|
|
159
|
+
h ^= ch.charCodeAt(0);
|
|
160
|
+
h = Math.imul(h, 0x01000193) >>> 0;
|
|
161
|
+
}
|
|
162
|
+
return h.toString(16).padStart(8, "0");
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Adds a suite's `starter` cases as drafts with pending answers, for a
|
|
166
|
+
* person to confirm on the pages. Safe to run again: starters already
|
|
167
|
+
* added (by their input) are skipped.
|
|
168
|
+
*/
|
|
169
|
+
export function importStarters(store, suite) {
|
|
170
|
+
return importCases({
|
|
171
|
+
store,
|
|
172
|
+
suite,
|
|
173
|
+
source: `starter:${suite.key}`,
|
|
174
|
+
rows: suite.starter ?? [],
|
|
175
|
+
map: (s) => ({
|
|
176
|
+
id: starterId(s.input),
|
|
177
|
+
input: s.input,
|
|
178
|
+
label: s.label,
|
|
179
|
+
tags: s.tags,
|
|
180
|
+
note: s.note,
|
|
181
|
+
split: s.split,
|
|
182
|
+
}),
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=importCases.js.map
|
|
@@ -0,0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MAAM,EAAE,IAAI,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QACnC,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QACtB,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAgB,EAChB,KAAe;IAEf,OAAO,WAAW,CAAC;QACjB,KAAK;QACL,KAAK;QACL,MAAM,EAAE,WAAW,KAAK,CAAC,GAAG,EAAE;QAC9B,IAAI,EAAE,KAAK,CAAC,OAAO,IAAI,EAAE;QACzB,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACX,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC;YACtB,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,KAAK,EAAE,CAAC,CAAC,KAAK;SACf,CAAC;KACH,CAAC,CAAC;AACL,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -31,4 +31,5 @@ export * from "./store.js";
|
|
|
31
31
|
export * from "./labels.js";
|
|
32
32
|
// Server-only (node:crypto): import from "@crowandraven/evalkeeper/runner".
|
|
33
33
|
// In-memory store for tests and demos: "@crowandraven/evalkeeper/memory".
|
|
34
|
+
export * from "./importCases.js";
|
|
34
35
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAA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9B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,4EAA4E;AAC5E,0EAA0E;AAC1E,cAAc,kBAAkB,CAAC"}
|
package/dist/labels.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
/** What the answer-in-use rule needs from a label: the store's, or an app's own row. */
|
|
2
|
+
export type LabelLike = {
|
|
3
|
+
status: string;
|
|
4
|
+
updatedAt: Date;
|
|
5
|
+
};
|
|
2
6
|
/**
|
|
3
7
|
* The EXPECTED answer tests use: the newest confirmed one, or failing that a
|
|
4
8
|
* provisional one (put to use before review). Pending answers never count.
|
|
9
|
+
* Generic, so pages that read their own label rows (with extra columns)
|
|
10
|
+
* share the rule and keep their row type.
|
|
5
11
|
*/
|
|
6
|
-
export declare function confirmedLabel(labels:
|
|
12
|
+
export declare function confirmedLabel<L extends LabelLike>(labels: readonly L[]): L | null;
|
|
7
13
|
/** In use on an answer nobody has reviewed yet. */
|
|
8
|
-
export declare function isProvisional(labels:
|
|
14
|
+
export declare function isProvisional(labels: readonly LabelLike[]): boolean;
|
package/dist/labels.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The EXPECTED answer tests use: the newest confirmed one, or failing that a
|
|
3
3
|
* provisional one (put to use before review). Pending answers never count.
|
|
4
|
+
* Generic, so pages that read their own label rows (with extra columns)
|
|
5
|
+
* share the rule and keep their row type.
|
|
4
6
|
*/
|
|
5
7
|
export function confirmedLabel(labels) {
|
|
6
8
|
const newest = (status) => labels
|
package/dist/labels.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"labels.js","sourceRoot":"","sources":["../src/labels.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"labels.js","sourceRoot":"","sources":["../src/labels.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAoB;IAEpB,MAAM,MAAM,GAAG,CAAC,MAAc,EAAE,EAAE,CAChC,MAAM;SACH,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC;SAClC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;IAC5D,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAAC,aAAa,CAAC,CAAC;AACtD,CAAC;AAED,mDAAmD;AACnD,MAAM,UAAU,aAAa,CAAC,MAA4B;IACxD,OAAO,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,aAAa,CAAC;AAC1D,CAAC"}
|
package/dist/memoryStore.js
CHANGED
|
@@ -127,9 +127,10 @@ export function memoryStore() {
|
|
|
127
127
|
f.updatedAt = now();
|
|
128
128
|
}
|
|
129
129
|
},
|
|
130
|
-
async listCases(suite) {
|
|
130
|
+
async listCases(suite, opts) {
|
|
131
131
|
return cases
|
|
132
|
-
.filter((c) => c.suite === suite &&
|
|
132
|
+
.filter((c) => c.suite === suite &&
|
|
133
|
+
(opts?.includeRetired || c.status !== "RETIRED"))
|
|
133
134
|
.sort((a, b) => +a.createdAt - +b.createdAt);
|
|
134
135
|
},
|
|
135
136
|
async createCase({ labels = [], ...data }) {
|
package/dist/memoryStore.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memoryStore.js","sourceRoot":"","sources":["../src/memoryStore.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EACL,gBAAgB,GAIjB,MAAM,eAAe,CAAC;AAQvB;;;GAGG;AACH,MAAM,UAAU,WAAW;IAUzB,MAAM,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C,CAAC,EAAE,EAAE,CACJ,CAAC,CAAC,WAAW,KAAK,WAAW;gBAC7B,CAAC,CAAC,CAAC,MAAM;gBACT,CAAC,CAAC,CAAC,KAAK;gBACR,CAAC,CAAC,SAAS,IAAI,KAAK,CACvB;iBACA,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAC1D,CAAC;QACJ,CAAC;QACD,KAAK,CAAC,YAAY,CAAC,IAAI;YACrB,MAAM,CAAC,GAAiB,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,EAAE,CAAC;YACrE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAChB,OAAO,CAAC,CAAC;QACX,CAAC;QACD,KAAK,CAAC,eAAe,CAAC,QAAQ,EAAE,MAAM;YACpC,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC;YACjD,IAAI,CAAC;gBAAE,CAAC,CAAC,MAAM,GAAG,MAAM,CAAC;QAC3B,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/models.d.ts
CHANGED
|
@@ -2,10 +2,19 @@
|
|
|
2
2
|
* What Evalkeeper needs to know about the models your app can use. You
|
|
3
3
|
* pass a catalog in; Evalkeeper never picks a provider itself. Pure.
|
|
4
4
|
*/
|
|
5
|
-
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
/**
|
|
6
|
+
* The reasoning settings providers name, lowest first, so a setting one
|
|
7
|
+
* model lacks can be placed against the ones it has. A model's own
|
|
8
|
+
* `efforts` say which it takes.
|
|
9
|
+
*/
|
|
10
|
+
export declare const REASONING_EFFORTS: readonly ["none", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
11
|
+
/** A setting from REASONING_EFFORTS. */
|
|
12
|
+
export type KnownReasoningEffort = (typeof REASONING_EFFORTS)[number];
|
|
13
|
+
/**
|
|
14
|
+
* A reasoning setting a model may accept: one of REASONING_EFFORTS, or any
|
|
15
|
+
* other name a provider uses. The catalog's `efforts` order them per model.
|
|
16
|
+
*/
|
|
17
|
+
export type ReasoningEffort = KnownReasoningEffort | (string & {});
|
|
9
18
|
/**
|
|
10
19
|
* What Evalkeeper needs to know about one model: its label, provider, prices, reasoning
|
|
11
20
|
* settings, and retirement date.
|
|
@@ -70,7 +79,9 @@ export declare function priceCall(models: ModelCatalog, model: string, tokens: {
|
|
|
70
79
|
}): number | null;
|
|
71
80
|
/**
|
|
72
81
|
* The effort a model actually gets for a requested one: the same if it
|
|
73
|
-
* takes it;
|
|
74
|
-
*
|
|
82
|
+
* takes it; one below the lowest it takes (say "none" on a model that
|
|
83
|
+
* starts at "minimal"), its lowest; one above its highest, its highest;
|
|
84
|
+
* otherwise (a name it doesn't place) its own default. Undefined: send
|
|
85
|
+
* nothing.
|
|
75
86
|
*/
|
|
76
87
|
export declare function effortFor(models: ModelCatalog, model: string, requested: ReasoningEffort | null | undefined): ReasoningEffort | undefined;
|
package/dist/models.js
CHANGED
|
@@ -2,8 +2,20 @@
|
|
|
2
2
|
* What Evalkeeper needs to know about the models your app can use. You
|
|
3
3
|
* pass a catalog in; Evalkeeper never picks a provider itself. Pure.
|
|
4
4
|
*/
|
|
5
|
-
/**
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* The reasoning settings providers name, lowest first, so a setting one
|
|
7
|
+
* model lacks can be placed against the ones it has. A model's own
|
|
8
|
+
* `efforts` say which it takes.
|
|
9
|
+
*/
|
|
10
|
+
export const REASONING_EFFORTS = [
|
|
11
|
+
"none",
|
|
12
|
+
"minimal",
|
|
13
|
+
"low",
|
|
14
|
+
"medium",
|
|
15
|
+
"high",
|
|
16
|
+
"xhigh",
|
|
17
|
+
"max",
|
|
18
|
+
];
|
|
7
19
|
/** Whether a catalog entry is a baseline (code, not a model): never suggested. */
|
|
8
20
|
export function isBaseline(models, model) {
|
|
9
21
|
return models[model]?.baseline === true;
|
|
@@ -42,8 +54,10 @@ export function priceCall(models, model, tokens) {
|
|
|
42
54
|
}
|
|
43
55
|
/**
|
|
44
56
|
* The effort a model actually gets for a requested one: the same if it
|
|
45
|
-
* takes it;
|
|
46
|
-
*
|
|
57
|
+
* takes it; one below the lowest it takes (say "none" on a model that
|
|
58
|
+
* starts at "minimal"), its lowest; one above its highest, its highest;
|
|
59
|
+
* otherwise (a name it doesn't place) its own default. Undefined: send
|
|
60
|
+
* nothing.
|
|
47
61
|
*/
|
|
48
62
|
export function effortFor(models, model, requested) {
|
|
49
63
|
const efforts = models[model]?.efforts;
|
|
@@ -51,6 +65,16 @@ export function effortFor(models, model, requested) {
|
|
|
51
65
|
return undefined;
|
|
52
66
|
if (efforts.includes(requested))
|
|
53
67
|
return requested;
|
|
54
|
-
|
|
68
|
+
const rank = (e) => REASONING_EFFORTS.indexOf(e);
|
|
69
|
+
const want = rank(requested);
|
|
70
|
+
const lowest = efforts[0];
|
|
71
|
+
const highest = efforts.at(-1);
|
|
72
|
+
if (want < 0 || lowest === undefined || highest === undefined)
|
|
73
|
+
return undefined;
|
|
74
|
+
if (rank(lowest) >= 0 && want < rank(lowest))
|
|
75
|
+
return lowest;
|
|
76
|
+
if (rank(highest) >= 0 && want > rank(highest))
|
|
77
|
+
return highest;
|
|
78
|
+
return undefined;
|
|
55
79
|
}
|
|
56
80
|
//# sourceMappingURL=models.js.map
|
package/dist/models.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;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,SAAS,CAAC;IACnB,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;QAAE,OAAO,MAAM,CAAC;IAC5D,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC;QAAE,OAAO,OAAO,CAAC;IAC/D,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/dist/runner.d.ts
CHANGED
|
@@ -64,10 +64,17 @@ export type RunnerOptions = {
|
|
|
64
64
|
models: string[];
|
|
65
65
|
fallbackModels?: string[];
|
|
66
66
|
};
|
|
67
|
+
/**
|
|
68
|
+
* Which retiring models (`ModelInfo.retiring`) the board lists.
|
|
69
|
+
* "always" (the default): every candidate, though a retiring one is never
|
|
70
|
+
* suggested. "inUse": only one a feature still runs on, as its live or
|
|
71
|
+
* fallback model, so nobody spends a test on a model that's going away.
|
|
72
|
+
*/
|
|
73
|
+
retiringOnBoard?: "always" | "inUse";
|
|
67
74
|
};
|
|
68
75
|
/**
|
|
69
76
|
* Which model a feature runs on now, its fallback, its reasoning setting,
|
|
70
|
-
* and its
|
|
77
|
+
* its temperature, and its output cap.
|
|
71
78
|
*/
|
|
72
79
|
export type Route = {
|
|
73
80
|
model: string;
|
|
@@ -75,6 +82,8 @@ export type Route = {
|
|
|
75
82
|
reasoningEffort: ReasoningEffort | null;
|
|
76
83
|
/** Null or unset: no temperature sent. */
|
|
77
84
|
temperature?: number | null;
|
|
85
|
+
/** The output-token cap; null or unset: the call's own default. */
|
|
86
|
+
maxOutputTokens?: number | null;
|
|
78
87
|
};
|
|
79
88
|
/**
|
|
80
89
|
* How to run a test: fresh (no reuse), and, for a test continued in a new request, its leg
|
|
@@ -102,6 +111,8 @@ export declare function requestHashFor(r: {
|
|
|
102
111
|
repeat: number;
|
|
103
112
|
/** Left out of the hash when null, so requests without one reuse as before. */
|
|
104
113
|
temperature?: number | null;
|
|
114
|
+
/** Left out of the hash when null, like temperature. */
|
|
115
|
+
maxOutputTokens?: number | null;
|
|
105
116
|
}): string;
|
|
106
117
|
/** Changes whenever a case or its answer in use does. */
|
|
107
118
|
export declare function datasetVersion(cases: CaseRecord[]): string;
|
|
@@ -153,6 +164,8 @@ export declare function createRunner(opts: RunnerOptions): {
|
|
|
153
164
|
reasoningEffort?: ReasoningEffort | null;
|
|
154
165
|
/** The temperature to test; undefined: the operation's live one. */
|
|
155
166
|
temperature?: number | null;
|
|
167
|
+
/** The output cap to test; undefined: the operation's live one. */
|
|
168
|
+
maxOutputTokens?: number | null;
|
|
156
169
|
}) => Promise<{
|
|
157
170
|
cases: number;
|
|
158
171
|
/** Answers the test will need: cases times repeats. */
|
|
@@ -172,6 +185,8 @@ export declare function createRunner(opts: RunnerOptions): {
|
|
|
172
185
|
reasoningEffort?: ReasoningEffort | null;
|
|
173
186
|
/** A temperature to test; undefined: the operation's live one. */
|
|
174
187
|
temperature?: number | null;
|
|
188
|
+
/** An output cap to test; undefined: the operation's live one. */
|
|
189
|
+
maxOutputTokens?: number | null;
|
|
175
190
|
/** For the estimate: pass the same `fresh` to runEval. */
|
|
176
191
|
fresh?: boolean;
|
|
177
192
|
}) => Promise<{
|