@crowandraven/evalkeeper 0.5.0 → 0.8.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/README.md +16 -0
- package/dist/activity.d.ts +58 -0
- package/dist/activity.js +125 -0
- package/dist/activity.js.map +1 -0
- package/dist/assertExpect.d.ts +52 -0
- package/dist/assertExpect.js +104 -0
- package/dist/assertExpect.js.map +1 -0
- package/dist/blind.d.ts +79 -0
- package/dist/blind.js +113 -0
- package/dist/blind.js.map +1 -0
- package/dist/cli/addPages.d.ts +6 -1
- package/dist/cli/addPages.js +19 -4
- package/dist/cli/addPages.js.map +1 -1
- package/dist/cli/main.d.ts +1 -1
- package/dist/cli/main.js +4 -3
- package/dist/cli/main.js.map +1 -1
- package/dist/compare.d.ts +38 -0
- package/dist/compare.js +62 -0
- package/dist/compare.js.map +1 -1
- package/dist/decisions.js +8 -0
- package/dist/decisions.js.map +1 -1
- package/dist/feedback.d.ts +17 -2
- package/dist/feedback.js +13 -2
- package/dist/feedback.js.map +1 -1
- package/dist/glossary.d.ts +22 -0
- package/dist/glossary.js +22 -0
- package/dist/glossary.js.map +1 -1
- package/dist/health.js +5 -3
- package/dist/health.js.map +1 -1
- package/dist/importCases.d.ts +76 -5
- package/dist/importCases.js +114 -14
- package/dist/importCases.js.map +1 -1
- package/dist/inInstructions.d.ts +47 -0
- package/dist/inInstructions.js +95 -0
- package/dist/inInstructions.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/memoryStore.js +3 -1
- package/dist/memoryStore.js.map +1 -1
- package/dist/readCheck.d.ts +116 -0
- package/dist/readCheck.js +321 -0
- package/dist/readCheck.js.map +1 -0
- package/dist/runner.d.ts +16 -0
- package/dist/runner.js +51 -3
- package/dist/runner.js.map +1 -1
- package/dist/settings.d.ts +81 -3
- package/dist/settings.js +160 -23
- package/dist/settings.js.map +1 -1
- package/dist/store.d.ts +10 -3
- package/dist/suggest.d.ts +10 -1
- package/dist/suggest.js +22 -4
- package/dist/suggest.js.map +1 -1
- package/dist/suiteContract.d.ts +23 -0
- package/dist/suiteContract.js +106 -0
- package/dist/suiteContract.js.map +1 -0
- package/dist/suites/crisisRisk.d.ts +83 -0
- package/dist/suites/crisisRisk.js +176 -0
- package/dist/suites/crisisRisk.js.map +1 -0
- package/dist/suites/crisisRiskCases.d.ts +40 -0
- package/dist/suites/crisisRiskCases.js +179 -0
- package/dist/suites/crisisRiskCases.js.map +1 -0
- package/dist/suites/hopelessness.d.ts +116 -0
- package/dist/suites/hopelessness.js +293 -0
- package/dist/suites/hopelessness.js.map +1 -0
- package/dist/suites/hopelessnessCases.d.ts +61 -0
- package/dist/suites/hopelessnessCases.js +242 -0
- package/dist/suites/hopelessnessCases.js.map +1 -0
- package/dist/suites/index.d.ts +11 -0
- package/dist/suites/index.js +12 -0
- package/dist/suites/index.js.map +1 -0
- package/dist/testing.d.ts +162 -12
- package/dist/testing.js +479 -115
- package/dist/testing.js.map +1 -1
- package/dist/types.d.ts +98 -0
- package/dist/types.js +68 -0
- package/dist/types.js.map +1 -1
- package/dist/weekly.d.ts +21 -3
- package/dist/weekly.js +18 -1
- package/dist/weekly.js.map +1 -1
- package/package.json +5 -1
- package/src/activity.ts +154 -0
- package/src/assertExpect.ts +168 -0
- package/src/blind.ts +138 -0
- package/src/cli/addPages.ts +20 -4
- package/src/cli/main.ts +4 -3
- package/src/compare.ts +85 -0
- package/src/decisions.ts +10 -0
- package/src/feedback.ts +20 -2
- package/src/glossary.ts +40 -0
- package/src/health.ts +5 -3
- package/src/importCases.ts +172 -33
- package/src/inInstructions.ts +105 -0
- package/src/index.ts +5 -0
- package/src/memoryStore.ts +2 -1
- package/src/readCheck.ts +458 -0
- package/src/runner.ts +74 -4
- package/src/settings.ts +192 -26
- package/src/store.ts +11 -3
- package/src/suggest.ts +33 -4
- package/src/suiteContract.ts +147 -0
- package/src/suites/crisisRisk.ts +250 -0
- package/src/suites/crisisRiskCases.ts +205 -0
- package/src/suites/hopelessness.ts +410 -0
- package/src/suites/hopelessnessCases.ts +286 -0
- package/src/suites/index.ts +11 -0
- package/src/testing.ts +646 -121
- package/src/types.ts +147 -0
- package/src/weekly.ts +39 -3
- package/starter/index.ts +8 -0
- package/templates/app/evals/[suite]/compare/page.tsx +385 -0
- package/templates/app/evals/[suite]/page.tsx +104 -31
- package/templates/app/evals/[suite]/rate/page.tsx +143 -0
- package/templates/app/evals/[suite]/runs/[runId]/page.tsx +84 -3
- package/templates/app/evals/[suite]/side-by-side/page.tsx +320 -0
- package/templates/app/evals/feedback/page.tsx +3 -0
- package/templates/app/evals/page.tsx +3 -0
- package/templates/components/evalkeeper/AnswerKey.tsx +2 -1
- package/templates/components/evalkeeper/DisagreementChip.tsx +35 -0
- package/templates/components/evalkeeper/ReadableOutput.tsx +97 -0
- package/templates/components/evalkeeper/RollBack.tsx +21 -1
- package/templates/components/evalkeeper/SettingsHistory.tsx +29 -5
- package/templates/components/evalkeeper/WeeklyCheck.tsx +34 -2
- package/templates/lib/evalkeeper/actions.ts +68 -4
- package/templates/lib/evalkeeper/weekly.ts +27 -4
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Metadata } from "next";
|
|
1
2
|
import Link from "next/link";
|
|
2
3
|
import { notFound } from "next/navigation";
|
|
3
4
|
import {
|
|
@@ -38,6 +39,15 @@ import { EVALS_BASE, evalsPath } from "@/lib/evalkeeper/paths";
|
|
|
38
39
|
|
|
39
40
|
export const dynamic = "force-dynamic";
|
|
40
41
|
|
|
42
|
+
export async function generateMetadata({
|
|
43
|
+
params,
|
|
44
|
+
}: {
|
|
45
|
+
params: Promise<{ suite: string }>;
|
|
46
|
+
}): Promise<Metadata> {
|
|
47
|
+
const { suite } = await params;
|
|
48
|
+
return { title: `Evals: ${SUITE_BY_KEY[suite]?.label ?? "Evals"}` };
|
|
49
|
+
}
|
|
50
|
+
|
|
41
51
|
/** A share as a whole percent, or a dash when there's nothing to show. */
|
|
42
52
|
const asPct = (x: number | null) => (x === null ? "—" : pct(x));
|
|
43
53
|
|
|
@@ -59,7 +69,7 @@ export default async function SuitePage({
|
|
|
59
69
|
if (!operation) notFound();
|
|
60
70
|
// The board and the settings load together: on a remote database each
|
|
61
71
|
// waits on round trips, so one after the other doubles the wait.
|
|
62
|
-
const [b, [history, liveSettings]] = await Promise.all([
|
|
72
|
+
const [b, [history, liveSettings], inInstructions] = await Promise.all([
|
|
63
73
|
runner.board(key),
|
|
64
74
|
// Records a deploy if the instructions changed under the live
|
|
65
75
|
// settings, before reading them.
|
|
@@ -68,6 +78,7 @@ export default async function SuitePage({
|
|
|
68
78
|
.then(() =>
|
|
69
79
|
Promise.all([settings.history(operation), settings.current(operation)]),
|
|
70
80
|
),
|
|
81
|
+
runner.casesInInstructions(key),
|
|
71
82
|
]);
|
|
72
83
|
const { suite, rows } = b;
|
|
73
84
|
const s = suggest(rows, suite.checks, suite.priority, MODELS);
|
|
@@ -101,27 +112,35 @@ export default async function SuitePage({
|
|
|
101
112
|
</p>
|
|
102
113
|
</div>
|
|
103
114
|
|
|
104
|
-
{
|
|
115
|
+
{/* Shown when nothing would change too, so a higher score that
|
|
116
|
+
isn't enough to switch for comes with its reason. */}
|
|
117
|
+
{s && (
|
|
105
118
|
<Card className="space-y-3">
|
|
106
119
|
<div className="flex flex-wrap items-start justify-between gap-3">
|
|
107
120
|
<h2 className="font-semibold">
|
|
108
|
-
Suggested
|
|
121
|
+
{s.same ? "No change suggested" : "Suggested"}
|
|
109
122
|
<InfoTip term="suggestion" />
|
|
110
123
|
</h2>
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
124
|
+
{/* Retesting live changes nothing until the fallback would. */}
|
|
125
|
+
{!s.same &&
|
|
126
|
+
!(s.retestLive && (!s.fallback || s.fallback.fallback)) && (
|
|
127
|
+
<form action={useSuggestion}>
|
|
128
|
+
<input type="hidden" name="suite" value={key} />
|
|
129
|
+
<Submit>Use these</Submit>
|
|
130
|
+
</form>
|
|
131
|
+
)}
|
|
115
132
|
</div>
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
133
|
+
{!s.same && (
|
|
134
|
+
<p>
|
|
135
|
+
Live: <strong>{s.live.label}</strong>
|
|
136
|
+
{s.fallback && (
|
|
137
|
+
<>
|
|
138
|
+
{" "}
|
|
139
|
+
· Fallback: <strong>{s.fallback.label}</strong>
|
|
140
|
+
</>
|
|
141
|
+
)}
|
|
142
|
+
</p>
|
|
143
|
+
)}
|
|
125
144
|
<ul className="readable list-disc space-y-1 pl-5 text-sm text-muted">
|
|
126
145
|
{s.reasons.map((r) => (
|
|
127
146
|
<li key={r}>{r}</li>
|
|
@@ -130,13 +149,42 @@ export default async function SuitePage({
|
|
|
130
149
|
</Card>
|
|
131
150
|
)}
|
|
132
151
|
|
|
152
|
+
{inInstructions.length > 0 && (
|
|
153
|
+
<Card className="space-y-2">
|
|
154
|
+
<h2 className="font-semibold text-warn">
|
|
155
|
+
Cases in the instructions
|
|
156
|
+
<InfoTip term="inInstructions" />
|
|
157
|
+
</h2>
|
|
158
|
+
<p className="readable text-sm text-muted">
|
|
159
|
+
These cases' words appear in what the model is told, so a test
|
|
160
|
+
grades it on answers it was handed. Take the example out of the
|
|
161
|
+
instructions, or rewrite or retire the case.
|
|
162
|
+
</p>
|
|
163
|
+
<ul className="readable list-disc space-y-1 pl-5 text-sm">
|
|
164
|
+
{inInstructions.map((c) => (
|
|
165
|
+
<li key={c.caseId}>
|
|
166
|
+
{c.title}: “{c.found}”
|
|
167
|
+
</li>
|
|
168
|
+
))}
|
|
169
|
+
</ul>
|
|
170
|
+
</Card>
|
|
171
|
+
)}
|
|
172
|
+
|
|
133
173
|
<section className="space-y-3">
|
|
134
174
|
<div className="flex items-center justify-between gap-4">
|
|
135
175
|
<h2 className="text-lg font-semibold">Models</h2>
|
|
136
|
-
<
|
|
137
|
-
<
|
|
138
|
-
|
|
139
|
-
|
|
176
|
+
<div className="flex items-center gap-4">
|
|
177
|
+
<Link
|
|
178
|
+
href={evalsPath(key, "compare")}
|
|
179
|
+
className="text-sm text-muted hover:text-ink"
|
|
180
|
+
>
|
|
181
|
+
Compare two tests
|
|
182
|
+
</Link>
|
|
183
|
+
<form action={testAll}>
|
|
184
|
+
<input type="hidden" name="suite" value={key} />
|
|
185
|
+
<Submit variant="quiet">Test every model</Submit>
|
|
186
|
+
</form>
|
|
187
|
+
</div>
|
|
140
188
|
</div>
|
|
141
189
|
<Card className="overflow-x-auto p-0 lg:overflow-visible">
|
|
142
190
|
<table className="w-full text-sm">
|
|
@@ -290,7 +338,19 @@ export default async function SuitePage({
|
|
|
290
338
|
<td className="p-3 tabular-nums">
|
|
291
339
|
{r.test ? perAnswer(r.test.costPerAnswer) : "—"}
|
|
292
340
|
</td>
|
|
293
|
-
<td className="p-3">
|
|
341
|
+
<td className="p-3">
|
|
342
|
+
{r.vsLive && live?.test && r.test && !r.live ? (
|
|
343
|
+
<Link
|
|
344
|
+
href={`${evalsPath(key, "compare")}?${new URLSearchParams({ a: live.test.runId, b: r.test.runId })}`}
|
|
345
|
+
>
|
|
346
|
+
{VS[r.vsLive]}
|
|
347
|
+
</Link>
|
|
348
|
+
) : r.vsLive ? (
|
|
349
|
+
VS[r.vsLive]
|
|
350
|
+
) : (
|
|
351
|
+
"—"
|
|
352
|
+
)}
|
|
353
|
+
</td>
|
|
294
354
|
<td className="p-3">
|
|
295
355
|
<div className="flex flex-col items-end gap-0.5">
|
|
296
356
|
<div className="flex justify-end gap-2">
|
|
@@ -406,7 +466,8 @@ export default async function SuitePage({
|
|
|
406
466
|
</div>
|
|
407
467
|
</section>
|
|
408
468
|
|
|
409
|
-
|
|
469
|
+
{/* The weekly check links here to review drafts. */}
|
|
470
|
+
<section id="answer-key" className="scroll-mt-4 space-y-3">
|
|
410
471
|
<AnswerKey
|
|
411
472
|
suite={suite}
|
|
412
473
|
rows={rows}
|
|
@@ -417,15 +478,27 @@ export default async function SuitePage({
|
|
|
417
478
|
</h2>
|
|
418
479
|
}
|
|
419
480
|
tools={
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
481
|
+
<>
|
|
482
|
+
{suite.caseKind === "imported" && suite.labelFromForm && (
|
|
483
|
+
<Tip control term="rateBlind" side="bottom" align="end">
|
|
484
|
+
<Link
|
|
485
|
+
href={evalsPath(key, "rate")}
|
|
486
|
+
className="inline-flex items-center rounded-md border border-accent/40 bg-card px-3 py-1.5 text-sm text-accent hover:bg-accent/10"
|
|
487
|
+
>
|
|
488
|
+
Rate blind
|
|
489
|
+
</Link>
|
|
490
|
+
</Tip>
|
|
491
|
+
)}
|
|
492
|
+
<form action={rescore}>
|
|
493
|
+
<input type="hidden" name="suite" value={key} />
|
|
494
|
+
<Tip control term="rescore" side="bottom" align="end">
|
|
495
|
+
<IconSubmit
|
|
496
|
+
label="Rescore tests"
|
|
497
|
+
icon={<RotateCw aria-hidden className="h-4 w-4" />}
|
|
498
|
+
/>
|
|
499
|
+
</Tip>
|
|
500
|
+
</form>
|
|
501
|
+
</>
|
|
429
502
|
}
|
|
430
503
|
/>
|
|
431
504
|
</section>
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import type { Metadata } from "next";
|
|
2
|
+
import Link from "next/link";
|
|
3
|
+
import { notFound } from "next/navigation";
|
|
4
|
+
import { rateQueue } from "@crowandraven/evalkeeper";
|
|
5
|
+
import { FieldValues, Fields } from "@/components/evalkeeper/Fields";
|
|
6
|
+
import { Submit } from "@/components/evalkeeper/Submit";
|
|
7
|
+
import { InfoTip, Tip } from "@/components/evalkeeper/Tip";
|
|
8
|
+
import { BackLink, Card } from "@/components/evalkeeper/ui";
|
|
9
|
+
import { requireAdmin, SUITE_BY_KEY, store } from "@/lib/evalkeeper";
|
|
10
|
+
import { rateBlind, skipCase } from "@/lib/evalkeeper/actions";
|
|
11
|
+
import { evalsPath } from "@/lib/evalkeeper/paths";
|
|
12
|
+
|
|
13
|
+
export const dynamic = "force-dynamic";
|
|
14
|
+
|
|
15
|
+
export async function generateMetadata({
|
|
16
|
+
params,
|
|
17
|
+
}: {
|
|
18
|
+
params: Promise<{ suite: string }>;
|
|
19
|
+
}): Promise<Metadata> {
|
|
20
|
+
const { suite } = await params;
|
|
21
|
+
return { title: `Rate blind: ${SUITE_BY_KEY[suite]?.label ?? "Evals"}` };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Rating an imported suite's cases blind: one case at a time, the oldest
|
|
26
|
+
* this person hasn't rated or skipped, shown by its input alone. The app's
|
|
27
|
+
* output, what anyone did with the item, other answers, tags, and notes
|
|
28
|
+
* stay hidden, because any of them anchors the rating.
|
|
29
|
+
*/
|
|
30
|
+
export default async function RateBlindPage({
|
|
31
|
+
params,
|
|
32
|
+
}: {
|
|
33
|
+
params: Promise<{ suite: string }>;
|
|
34
|
+
}) {
|
|
35
|
+
const admin = await requireAdmin();
|
|
36
|
+
const { suite: key } = await params;
|
|
37
|
+
const suite = SUITE_BY_KEY[key];
|
|
38
|
+
const fields = suite?.fields;
|
|
39
|
+
if (
|
|
40
|
+
!suite ||
|
|
41
|
+
suite.caseKind !== "imported" ||
|
|
42
|
+
!fields ||
|
|
43
|
+
!suite.labelFromForm
|
|
44
|
+
)
|
|
45
|
+
notFound();
|
|
46
|
+
const queue = rateQueue(await store.listCases(key), admin.id);
|
|
47
|
+
const next = queue.next;
|
|
48
|
+
const input = next ? suite.input.parse(next.input) : null;
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<div className="space-y-8">
|
|
52
|
+
<div className="space-y-2">
|
|
53
|
+
<BackLink href={evalsPath(key)}>{suite.label}</BackLink>
|
|
54
|
+
<h1 className="text-2xl font-semibold">
|
|
55
|
+
Rate blind
|
|
56
|
+
<InfoTip term="rateBlind" />
|
|
57
|
+
</h1>
|
|
58
|
+
<p className="readable text-muted">
|
|
59
|
+
One case at a time, from its input alone. You won't see what the
|
|
60
|
+
app decided or what anyone did with it, so nothing anchors your
|
|
61
|
+
answer. Give the answer and why, or skip it.
|
|
62
|
+
</p>
|
|
63
|
+
<p className="text-sm text-muted">
|
|
64
|
+
<Tip term="rateQueue" id="rate-queue">
|
|
65
|
+
<span>
|
|
66
|
+
{queue.rated} rated · {queue.skipped} skipped · {queue.left} left
|
|
67
|
+
</span>
|
|
68
|
+
</Tip>
|
|
69
|
+
</p>
|
|
70
|
+
</div>
|
|
71
|
+
|
|
72
|
+
{next && input !== null ? (
|
|
73
|
+
<Card className="space-y-6">
|
|
74
|
+
<section className="space-y-3">
|
|
75
|
+
<h2 className="font-semibold">{suite.title(input)}</h2>
|
|
76
|
+
{fields.input.length ? (
|
|
77
|
+
<FieldValues
|
|
78
|
+
fields={fields.input}
|
|
79
|
+
values={next.input}
|
|
80
|
+
prefix="rate-in-"
|
|
81
|
+
/>
|
|
82
|
+
) : (
|
|
83
|
+
<pre className="readable whitespace-pre-wrap text-sm">
|
|
84
|
+
{suite.describe?.(input) ?? JSON.stringify(next.input, null, 2)}
|
|
85
|
+
</pre>
|
|
86
|
+
)}
|
|
87
|
+
</section>
|
|
88
|
+
|
|
89
|
+
{/* Keyed by case, so the next case starts with an empty form. */}
|
|
90
|
+
<form key={next.id} action={rateBlind} className="space-y-4">
|
|
91
|
+
<input type="hidden" name="suite" value={key} />
|
|
92
|
+
<input type="hidden" name="case" value={next.id} />
|
|
93
|
+
<Fields fields={fields.label} prefix="rate-" />
|
|
94
|
+
<div className="space-y-1">
|
|
95
|
+
<label
|
|
96
|
+
htmlFor="rate-reason"
|
|
97
|
+
className="block text-sm font-medium"
|
|
98
|
+
>
|
|
99
|
+
Why
|
|
100
|
+
</label>
|
|
101
|
+
<textarea
|
|
102
|
+
id="rate-reason"
|
|
103
|
+
name="reason"
|
|
104
|
+
required
|
|
105
|
+
rows={3}
|
|
106
|
+
className="w-full rounded-md border border-line bg-card px-3 py-2 text-sm focus:border-accent focus:outline-none"
|
|
107
|
+
/>
|
|
108
|
+
<p className="readable text-xs text-muted">
|
|
109
|
+
What in the input decided it, in a sentence. Kept with your
|
|
110
|
+
answer, so anyone checking it later sees your reasoning.
|
|
111
|
+
</p>
|
|
112
|
+
</div>
|
|
113
|
+
<p className="readable text-xs text-muted">
|
|
114
|
+
Saves your own confirmed answer beside anyone else's, and
|
|
115
|
+
rescores tests for free.
|
|
116
|
+
</p>
|
|
117
|
+
<Submit>Save rating</Submit>
|
|
118
|
+
</form>
|
|
119
|
+
|
|
120
|
+
<form action={skipCase}>
|
|
121
|
+
<input type="hidden" name="suite" value={key} />
|
|
122
|
+
<input type="hidden" name="case" value={next.id} />
|
|
123
|
+
<Tip control term="skip" id="rate-skip">
|
|
124
|
+
<Submit variant="quiet">Skip</Submit>
|
|
125
|
+
</Tip>
|
|
126
|
+
</form>
|
|
127
|
+
</Card>
|
|
128
|
+
) : (
|
|
129
|
+
<Card className="space-y-2">
|
|
130
|
+
<h2 className="font-semibold">Nothing left for you to rate</h2>
|
|
131
|
+
<p className="readable text-sm text-muted">
|
|
132
|
+
You've rated or skipped every case in this suite.
|
|
133
|
+
{queue.skipped > 0 &&
|
|
134
|
+
" Cases you skipped are still in the answer key, where you can write their answers."}
|
|
135
|
+
</p>
|
|
136
|
+
<Link href={evalsPath(key)} className="text-sm text-accent">
|
|
137
|
+
Back to the answer key
|
|
138
|
+
</Link>
|
|
139
|
+
</Card>
|
|
140
|
+
)}
|
|
141
|
+
</div>
|
|
142
|
+
);
|
|
143
|
+
}
|
|
@@ -1,11 +1,30 @@
|
|
|
1
|
+
import Link from "next/link";
|
|
1
2
|
import { notFound } from "next/navigation";
|
|
2
3
|
import { allPassed, money, summarize } from "@crowandraven/evalkeeper";
|
|
4
|
+
import type { Metadata } from "next";
|
|
5
|
+
import { FieldValues } from "@/components/evalkeeper/Fields";
|
|
6
|
+
import { ReadableOutput } from "@/components/evalkeeper/ReadableOutput";
|
|
3
7
|
import { BackLink, Card, pct } from "@/components/evalkeeper/ui";
|
|
4
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
MODELS,
|
|
10
|
+
requireAdmin,
|
|
11
|
+
runner,
|
|
12
|
+
store,
|
|
13
|
+
SUITE_BY_KEY,
|
|
14
|
+
} from "@/lib/evalkeeper";
|
|
5
15
|
import { evalsPath } from "@/lib/evalkeeper/paths";
|
|
6
16
|
|
|
7
17
|
export const dynamic = "force-dynamic";
|
|
8
18
|
|
|
19
|
+
export async function generateMetadata({
|
|
20
|
+
params,
|
|
21
|
+
}: {
|
|
22
|
+
params: Promise<{ suite: string }>;
|
|
23
|
+
}): Promise<Metadata> {
|
|
24
|
+
const { suite } = await params;
|
|
25
|
+
return { title: `Test: ${SUITE_BY_KEY[suite]?.label ?? "Evals"}` };
|
|
26
|
+
}
|
|
27
|
+
|
|
9
28
|
/** One test: every answer, with what each check found. */
|
|
10
29
|
export default async function RunPage({
|
|
11
30
|
params,
|
|
@@ -29,7 +48,13 @@ export default async function RunPage({
|
|
|
29
48
|
const summary = metrics ? summarize(metrics, suite.checks) : null;
|
|
30
49
|
const label = (k: string) =>
|
|
31
50
|
suite.checks.find((c) => c.key === k)?.label ?? k;
|
|
32
|
-
type Check = {
|
|
51
|
+
type Check = {
|
|
52
|
+
key: string;
|
|
53
|
+
pass: boolean | null;
|
|
54
|
+
note?: string;
|
|
55
|
+
given?: string;
|
|
56
|
+
matches?: { expected: string; actual: string; why: string }[];
|
|
57
|
+
};
|
|
33
58
|
|
|
34
59
|
return (
|
|
35
60
|
<div className="space-y-6">
|
|
@@ -41,6 +66,17 @@ export default async function RunPage({
|
|
|
41
66
|
<p className="text-sm text-muted">
|
|
42
67
|
{run.startedAt.toLocaleString()} · {run.status.toLowerCase()}
|
|
43
68
|
{metrics && ` · spent ${money(metrics.costUsd)}`}
|
|
69
|
+
{run.status === "SUCCEEDED" && (
|
|
70
|
+
<>
|
|
71
|
+
{" · "}
|
|
72
|
+
<Link
|
|
73
|
+
href={`${evalsPath(key, "compare")}?${new URLSearchParams({ b: runId })}`}
|
|
74
|
+
className="hover:text-ink"
|
|
75
|
+
>
|
|
76
|
+
Compare with another test
|
|
77
|
+
</Link>
|
|
78
|
+
</>
|
|
79
|
+
)}
|
|
44
80
|
</p>
|
|
45
81
|
{run.error && <p className="readable text-bad">{run.error}</p>}
|
|
46
82
|
</div>
|
|
@@ -79,13 +115,58 @@ export default async function RunPage({
|
|
|
79
115
|
</span>
|
|
80
116
|
</div>
|
|
81
117
|
{o.error && <p className="text-bad">{o.error}</p>}
|
|
118
|
+
{!o.error && o.output !== null && (
|
|
119
|
+
<div className="mt-2">
|
|
120
|
+
{suite.fields && suite.labelFromOutput ? (
|
|
121
|
+
<FieldValues
|
|
122
|
+
fields={suite.fields.label}
|
|
123
|
+
values={suite.labelFromOutput(o.output)}
|
|
124
|
+
prefix={`${o.id}-`}
|
|
125
|
+
/>
|
|
126
|
+
) : (
|
|
127
|
+
<ReadableOutput value={o.output} />
|
|
128
|
+
)}
|
|
129
|
+
</div>
|
|
130
|
+
)}
|
|
131
|
+
{suite.decisions &&
|
|
132
|
+
checks?.some((c) => c.given !== undefined) && (
|
|
133
|
+
<ul className="mt-2 space-y-0.5 text-xs">
|
|
134
|
+
{checks
|
|
135
|
+
.filter((c) => c.given !== undefined)
|
|
136
|
+
.map((c) => (
|
|
137
|
+
<li key={c.key}>
|
|
138
|
+
<span className="text-muted">{label(c.key)}:</span>{" "}
|
|
139
|
+
{c.given}{" "}
|
|
140
|
+
<span className={c.pass ? "text-good" : "text-warn"}>
|
|
141
|
+
{c.pass ? "right" : "wrong"}
|
|
142
|
+
</span>
|
|
143
|
+
</li>
|
|
144
|
+
))}
|
|
145
|
+
</ul>
|
|
146
|
+
)}
|
|
82
147
|
{checks
|
|
83
148
|
?.filter((c) => c.pass === false)
|
|
84
149
|
.map((c) => (
|
|
85
|
-
<p key={c.key} className="readable text-muted">
|
|
150
|
+
<p key={c.key} className="readable mt-2 text-muted">
|
|
86
151
|
{label(c.key)}: {c.note ?? "failed"}
|
|
87
152
|
</p>
|
|
88
153
|
))}
|
|
154
|
+
{checks
|
|
155
|
+
?.flatMap((c) => c.matches ?? [])
|
|
156
|
+
.slice(0, 20)
|
|
157
|
+
.map((m, i) => (
|
|
158
|
+
<p key={i} className="readable mt-1 text-xs text-muted">
|
|
159
|
+
Matched “{m.expected}” with “{m.actual}”: {m.why}
|
|
160
|
+
</p>
|
|
161
|
+
))}
|
|
162
|
+
{cases.has(o.caseId) && (
|
|
163
|
+
<Link
|
|
164
|
+
href={`${evalsPath(key)}#case-${o.caseId}`}
|
|
165
|
+
className="mt-2 inline-block text-xs text-accent hover:underline"
|
|
166
|
+
>
|
|
167
|
+
Find the case in the answer key
|
|
168
|
+
</Link>
|
|
169
|
+
)}
|
|
89
170
|
</div>
|
|
90
171
|
);
|
|
91
172
|
})}
|