@crowandraven/evalkeeper 0.13.0 → 0.14.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/drafts.d.ts +2 -0
- package/dist/drafts.js +3 -1
- package/dist/drafts.js.map +1 -1
- package/dist/failures.d.ts +16 -0
- package/dist/failures.js +40 -0
- package/dist/failures.js.map +1 -0
- package/dist/health.js +2 -1
- package/dist/health.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/legs.d.ts +4 -1
- package/dist/legs.js +6 -2
- package/dist/legs.js.map +1 -1
- package/dist/next/actions.js +53 -9
- package/dist/next/actions.js.map +1 -1
- package/dist/next/route.js +2 -1
- package/dist/next/route.js.map +1 -1
- package/dist/next/weekly.d.ts +7 -2
- package/dist/next/weekly.js +5 -3
- package/dist/next/weekly.js.map +1 -1
- package/dist/prune.d.ts +4 -1
- package/dist/prune.js +11 -2
- package/dist/prune.js.map +1 -1
- package/dist/react/AddCase.d.ts +12 -2
- package/dist/react/AddCase.js +70 -8
- package/dist/react/AddCase.js.map +1 -1
- package/dist/react/AnswerKey.js +11 -5
- package/dist/react/AnswerKey.js.map +1 -1
- package/dist/react/CaseMenu.d.ts +6 -1
- package/dist/react/CaseMenu.js +5 -2
- package/dist/react/CaseMenu.js.map +1 -1
- package/dist/react/CompareView.js +4 -4
- package/dist/react/CompareView.js.map +1 -1
- package/dist/react/FeedbackView.js +3 -3
- package/dist/react/FeedbackView.js.map +1 -1
- package/dist/react/HubSections.js +3 -4
- package/dist/react/HubSections.js.map +1 -1
- package/dist/react/PriorityPicker.d.ts +21 -0
- package/dist/react/PriorityPicker.js +47 -0
- package/dist/react/PriorityPicker.js.map +1 -0
- package/dist/react/RunView.js +21 -5
- package/dist/react/RunView.js.map +1 -1
- package/dist/react/SettingsHistory.js +3 -3
- package/dist/react/SettingsHistory.js.map +1 -1
- package/dist/react/SuiteSections.d.ts +4 -0
- package/dist/react/SuiteSections.js +57 -33
- package/dist/react/SuiteSections.js.map +1 -1
- package/dist/react/WeeklyCheck.js +4 -8
- package/dist/react/WeeklyCheck.js.map +1 -1
- package/dist/react/app.d.ts +2 -0
- package/dist/react/app.js.map +1 -1
- package/dist/react/format.d.ts +2 -2
- package/dist/react/format.js +4 -2
- package/dist/react/format.js.map +1 -1
- package/dist/react/pieces.d.ts +11 -0
- package/dist/react/pieces.js +17 -2
- package/dist/react/pieces.js.map +1 -1
- package/dist/runner.d.ts +7 -2
- package/dist/runner.js +5 -2
- package/dist/runner.js.map +1 -1
- package/dist/suggest.js +25 -7
- package/dist/suggest.js.map +1 -1
- package/package.json +10 -10
- package/src/drafts.ts +6 -1
- package/src/failures.ts +50 -0
- package/src/health.ts +2 -1
- package/src/index.ts +1 -0
- package/src/legs.ts +8 -2
- package/src/next/actions.ts +54 -9
- package/src/next/route.ts +2 -1
- package/src/next/weekly.ts +15 -4
- package/src/prune.ts +15 -1
- package/src/react/AddCase.tsx +98 -11
- package/src/react/AnswerKey.tsx +74 -14
- package/src/react/CaseMenu.tsx +24 -0
- package/src/react/CompareView.tsx +19 -4
- package/src/react/FeedbackView.tsx +13 -3
- package/src/react/HubSections.tsx +10 -5
- package/src/react/PriorityPicker.tsx +143 -0
- package/src/react/RunView.tsx +41 -6
- package/src/react/SettingsHistory.tsx +3 -3
- package/src/react/SuiteSections.tsx +192 -184
- package/src/react/WeeklyCheck.tsx +12 -6
- package/src/react/app.ts +2 -0
- package/src/react/format.ts +4 -2
- package/src/react/pieces.tsx +34 -1
- package/src/runner.ts +11 -4
- package/src/suggest.ts +26 -7
- package/templates/lib/evalkeeper/actions.ts +4 -0
package/src/runner.ts
CHANGED
|
@@ -60,8 +60,8 @@ export const STUCK_MS = 6 * 60_000;
|
|
|
60
60
|
export const REUSE_DAYS = 7;
|
|
61
61
|
|
|
62
62
|
/** A provider refusing calls for billing: every later call fails too. */
|
|
63
|
-
export
|
|
64
|
-
|
|
63
|
+
export { OUT_OF_CREDITS } from "./failures.js";
|
|
64
|
+
import { OUT_OF_CREDITS } from "./failures.js";
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
67
|
* What the runner needs from your app: storage, suites, models, instruction hashes, and,
|
|
@@ -108,7 +108,7 @@ export type RunnerOptions = {
|
|
|
108
108
|
*/
|
|
109
109
|
continueRun?: (
|
|
110
110
|
runId: string,
|
|
111
|
-
opts: Required<RunEvalOptions
|
|
111
|
+
opts: Required<Omit<RunEvalOptions, "requestStartedAt">>,
|
|
112
112
|
) => Promise<boolean>;
|
|
113
113
|
/**
|
|
114
114
|
* Which model each operation runs on now, its fallback, and its
|
|
@@ -157,6 +157,11 @@ export type RunEvalOptions = {
|
|
|
157
157
|
leg?: number;
|
|
158
158
|
/** What earlier legs' judge spent. */
|
|
159
159
|
judgeCostUsd?: number;
|
|
160
|
+
/**
|
|
161
|
+
* When the request running this leg started, if earlier than this call
|
|
162
|
+
* (tests queued one after another): the time limit counts from then.
|
|
163
|
+
*/
|
|
164
|
+
requestStartedAt?: number;
|
|
160
165
|
};
|
|
161
166
|
|
|
162
167
|
const sha = (text: string, n = 8) =>
|
|
@@ -584,8 +589,9 @@ export function createRunner(opts: RunnerOptions) {
|
|
|
584
589
|
let outOfCredits = null as string | null;
|
|
585
590
|
const timeout = suite.answerTimeoutMs ?? ANSWER_TIMEOUT_MS;
|
|
586
591
|
const deadline = opts.requestLimitMs
|
|
587
|
-
? Date.now() + opts.requestLimitMs - timeout
|
|
592
|
+
? (o.requestStartedAt ?? Date.now()) + opts.requestLimitMs - timeout
|
|
588
593
|
: Infinity;
|
|
594
|
+
const late = Date.now() > deadline;
|
|
589
595
|
let skipped = 0;
|
|
590
596
|
|
|
591
597
|
await mapLimit(todo, suite.concurrency ?? 6, async ({ c, repeat }) => {
|
|
@@ -678,6 +684,7 @@ export function createRunner(opts: RunnerOptions) {
|
|
|
678
684
|
done: todo.length - skipped,
|
|
679
685
|
leg,
|
|
680
686
|
outOfCredits: !!outOfCredits,
|
|
687
|
+
late,
|
|
681
688
|
}) &&
|
|
682
689
|
opts.continueRun &&
|
|
683
690
|
(await opts.continueRun(runId, next).catch(() => false))
|
package/src/suggest.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { Rate } from "./stats.js";
|
|
|
3
3
|
import type { CheckDef, SuitePriority } from "./types.js";
|
|
4
4
|
import type { Verdict } from "./compare.js";
|
|
5
5
|
import { at } from "./util.js";
|
|
6
|
+
import { failureHints, failureKind } from "./failures.js";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Which model to make live and which the fallback, from a suite's current
|
|
@@ -154,6 +155,19 @@ export function seriousMistakes(row: SuggestRow, checks: CheckDef[]): number {
|
|
|
154
155
|
|
|
155
156
|
const mistakes = (n: number) => `${n} serious mistake${n === 1 ? "" : "s"}`;
|
|
156
157
|
const rate = (r: SuggestRow) => (r.test ? r.test.right / r.test.total : 0);
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Two scores side by side, "92% against 88%", with as many decimals as it
|
|
161
|
+
* takes (up to two) when they differ but would round alike ("98.14%
|
|
162
|
+
* against 98.06%"), so a reason never compares a number with itself.
|
|
163
|
+
*/
|
|
164
|
+
function against(a: number, b: number): string {
|
|
165
|
+
const at = (x: number, d: number) => (x * 100).toFixed(d);
|
|
166
|
+
const d = [0, 1, 2].find((n) => at(a, n) !== at(b, n)) ?? 0;
|
|
167
|
+
return d === 0
|
|
168
|
+
? `${pct(a)} against ${pct(b)}`
|
|
169
|
+
: `${at(a, d)}% against ${at(b, d)}%`;
|
|
170
|
+
}
|
|
157
171
|
const pct = (x: number) => `${Math.round(x * 100)}%`;
|
|
158
172
|
const cost = (r: SuggestRow) => r.test?.costPerAnswer ?? Infinity;
|
|
159
173
|
const ms = (r: SuggestRow) => r.test?.avgMs ?? Infinity;
|
|
@@ -234,8 +248,13 @@ export function suggest<R extends SuggestRow>(
|
|
|
234
248
|
next = liveFailed;
|
|
235
249
|
const n = liveFailed.test.failedAnswers ?? 0;
|
|
236
250
|
const why = liveFailed.test.failureReason;
|
|
251
|
+
const kind = failureKind(why ?? null);
|
|
252
|
+
// Timeouts and answers cut short fail the same way again: say what
|
|
253
|
+
// to change instead of only "test again".
|
|
237
254
|
reasons.push(
|
|
238
|
-
|
|
255
|
+
kind === "timeout" || kind === "cutShort"
|
|
256
|
+
? `${n} of ${liveFailed.label}'s answers failed on its last test (${why}), so it can't be compared yet. ${failureHints([why ?? null]).join(" ")}`
|
|
257
|
+
: `Test ${liveFailed.label} again: ${n} of its answers failed on its last test${why ? ` (${why})` : ""}, so it can't be compared yet.`,
|
|
239
258
|
);
|
|
240
259
|
} else if (!live) {
|
|
241
260
|
if (!liveable.length) return null;
|
|
@@ -266,21 +285,21 @@ export function suggest<R extends SuggestRow>(
|
|
|
266
285
|
const ra = underAttack(r);
|
|
267
286
|
const la = underAttack(live);
|
|
268
287
|
return ra !== null && la !== null && ra <= la - 2 && rate(r) >= rate(live)
|
|
269
|
-
? `${r.label} makes fewer serious mistakes on the attacks than ${live.label} (${ra} against ${la}), and scores at least as well (${
|
|
288
|
+
? `${r.label} makes fewer serious mistakes on the attacks than ${live.label} (${ra} against ${la}), and scores at least as well (${against(rate(r), rate(live))}).`
|
|
270
289
|
: null;
|
|
271
290
|
};
|
|
272
291
|
const why = (r: R): string | null => {
|
|
273
292
|
if (rate(r) < rate(live)) return trade(r);
|
|
274
293
|
if (r.vsLive === "BETTER")
|
|
275
|
-
return `${r.label} is clearly more accurate than ${live.label}
|
|
294
|
+
return `${r.label} is clearly more accurate than ${live.label} on the cases both answered (overall ${against(rate(r), rate(live))}).`;
|
|
276
295
|
if (serious(r) <= serious(live) - 2)
|
|
277
|
-
return `${r.label} makes fewer serious mistakes than ${live.label} (${serious(r)} against ${serious(live)}), and scores at least as well (${
|
|
296
|
+
return `${r.label} makes fewer serious mistakes than ${live.label} (${serious(r)} against ${serious(live)}), and scores at least as well (${against(rate(r), rate(live))}).`;
|
|
278
297
|
const byAttacks = attackReason(r);
|
|
279
298
|
if (byAttacks) return byAttacks;
|
|
280
299
|
if (priority.favor === "cost" && clearlyLess(cost(r), cost(live)))
|
|
281
|
-
return `${r.label} scores at least as well as ${live.label} (${
|
|
300
|
+
return `${r.label} scores at least as well as ${live.label} (${against(rate(r), rate(live))}) at ${Math.round((1 - cost(r) / cost(live)) * 100)}% less per answer.`;
|
|
282
301
|
if (priority.favor === "speed" && clearlyLess(ms(r), ms(live)))
|
|
283
|
-
return `${r.label} scores at least as well as ${live.label} (${
|
|
302
|
+
return `${r.label} scores at least as well as ${live.label} (${against(rate(r), rate(live))}) and answers faster (${(ms(r) / 1000).toFixed(1)}s against ${(ms(live) / 1000).toFixed(1)}s).`;
|
|
284
303
|
return null;
|
|
285
304
|
};
|
|
286
305
|
// Cost and speed suites: a little less accurate, no clear difference,
|
|
@@ -293,7 +312,7 @@ export function suggest<R extends SuggestRow>(
|
|
|
293
312
|
serious(r) > serious(live)
|
|
294
313
|
)
|
|
295
314
|
return null;
|
|
296
|
-
const close = `${r.label} is about as accurate as ${live.label} (${
|
|
315
|
+
const close = `${r.label} is about as accurate as ${live.label} (${against(rate(r), rate(live))}: closer than these cases can tell apart), with no more serious mistakes`;
|
|
297
316
|
if (priority.favor === "cost" && cost(r) <= cost(live) * HALF)
|
|
298
317
|
return `${close}, at ${Math.round((1 - cost(r) / cost(live)) * 100)}% less per answer. This suite favors cost.`;
|
|
299
318
|
if (priority.favor === "speed" && ms(r) <= ms(live) * HALF)
|
|
@@ -97,6 +97,10 @@ export async function setPriority(form: FormData) {
|
|
|
97
97
|
return actions.setPriority(form);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
export async function keepAnswer(form: FormData) {
|
|
101
|
+
return actions.keepAnswer(form);
|
|
102
|
+
}
|
|
103
|
+
|
|
100
104
|
export async function runWeeklyNow() {
|
|
101
105
|
return actions.runWeeklyNow();
|
|
102
106
|
}
|