@crowandraven/evalkeeper 0.9.0 → 0.11.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 +1 -2
- package/dist/ai-sdk/decide.d.ts +35 -0
- package/dist/ai-sdk/decide.js +36 -0
- package/dist/ai-sdk/decide.js.map +1 -0
- package/dist/ai-sdk/hash.d.ts +50 -0
- package/dist/ai-sdk/hash.js +59 -0
- package/dist/ai-sdk/hash.js.map +1 -0
- package/dist/ai-sdk/index.d.ts +15 -0
- package/dist/ai-sdk/index.js +16 -0
- package/dist/ai-sdk/index.js.map +1 -0
- package/dist/ai-sdk/judge.d.ts +69 -0
- package/dist/ai-sdk/judge.js +105 -0
- package/dist/ai-sdk/judge.js.map +1 -0
- package/dist/ai-sdk/usage.d.ts +18 -0
- package/dist/ai-sdk/usage.js +19 -0
- package/dist/ai-sdk/usage.js.map +1 -0
- package/dist/board.d.ts +5 -0
- package/dist/cli/addPages.d.ts +6 -1
- package/dist/cli/addPages.js +14 -8
- package/dist/cli/addPages.js.map +1 -1
- package/dist/cli/main.d.ts +19 -5
- package/dist/cli/main.js +100 -4
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/migration.d.ts +95 -0
- package/dist/cli/migration.js +247 -0
- package/dist/cli/migration.js.map +1 -0
- package/dist/feedback.d.ts +1 -1
- package/dist/glossary.d.ts +9 -0
- package/dist/glossary.js +9 -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/inInstructions.d.ts +1 -1
- package/dist/inInstructions.js +1 -1
- package/dist/next/RefreshWhile.d.ts +11 -0
- package/dist/next/RefreshWhile.js +28 -0
- package/dist/next/RefreshWhile.js.map +1 -0
- package/dist/next/actions.d.ts +14 -0
- package/dist/next/actions.js +332 -0
- package/dist/next/actions.js.map +1 -0
- package/dist/next/components.d.ts +9 -0
- package/dist/next/components.js +27 -0
- package/dist/next/components.js.map +1 -0
- package/dist/next/cron.d.ts +9 -0
- package/dist/next/cron.js +17 -0
- package/dist/next/cron.js.map +1 -0
- package/dist/next/index.d.ts +15 -0
- package/dist/next/index.js +16 -0
- package/dist/next/index.js.map +1 -0
- package/dist/next/pages.d.ts +70 -0
- package/dist/next/pages.js +77 -0
- package/dist/next/pages.js.map +1 -0
- package/dist/next/route.d.ts +19 -0
- package/dist/next/route.js +31 -0
- package/dist/next/route.js.map +1 -0
- package/dist/next/weekly.d.ts +20 -0
- package/dist/next/weekly.js +55 -0
- package/dist/next/weekly.js.map +1 -0
- package/dist/next/wiring.d.ts +19 -0
- package/dist/next/wiring.js +2 -0
- package/dist/next/wiring.js.map +1 -0
- package/dist/prisma/contracts.d.ts +74 -0
- package/dist/prisma/contracts.js +178 -0
- package/dist/prisma/contracts.js.map +1 -0
- package/dist/prisma/index.d.ts +423 -0
- package/dist/prisma/index.js +622 -0
- package/dist/prisma/index.js.map +1 -0
- package/dist/prisma/mapping.d.ts +63 -0
- package/dist/prisma/mapping.js +111 -0
- package/dist/prisma/mapping.js.map +1 -0
- package/dist/prisma/moveIn.d.ts +106 -0
- package/dist/prisma/moveIn.js +299 -0
- package/dist/prisma/moveIn.js.map +1 -0
- package/dist/prune.d.ts +45 -0
- package/dist/prune.js +32 -0
- package/dist/prune.js.map +1 -1
- package/dist/react/AddCase.d.ts +10 -0
- package/dist/react/AddCase.js +19 -0
- package/dist/react/AddCase.js.map +1 -0
- package/dist/react/AnswerKey.d.ts +22 -0
- package/dist/react/AnswerKey.js +83 -0
- package/dist/react/AnswerKey.js.map +1 -0
- package/dist/react/CaseMenu.d.ts +17 -0
- package/dist/react/CaseMenu.js +41 -0
- package/dist/react/CaseMenu.js.map +1 -0
- package/dist/react/CompareView.d.ts +14 -0
- package/dist/react/CompareView.js +51 -0
- package/dist/react/CompareView.js.map +1 -0
- package/dist/react/ConfirmAnswer.d.ts +13 -0
- package/dist/react/ConfirmAnswer.js +27 -0
- package/dist/react/ConfirmAnswer.js.map +1 -0
- package/dist/react/DisagreementChip.d.ts +10 -0
- package/dist/react/DisagreementChip.js +21 -0
- package/dist/react/DisagreementChip.js.map +1 -0
- package/dist/react/FeedbackView.d.ts +10 -0
- package/dist/react/FeedbackView.js +26 -0
- package/dist/react/FeedbackView.js.map +1 -0
- package/dist/react/Fields.d.ts +32 -0
- package/dist/react/Fields.js +33 -0
- package/dist/react/Fields.js.map +1 -0
- package/dist/react/HubSections.d.ts +78 -0
- package/dist/react/HubSections.js +124 -0
- package/dist/react/HubSections.js.map +1 -0
- package/dist/react/ModelMenu.d.ts +16 -0
- package/dist/react/ModelMenu.js +38 -0
- package/dist/react/ModelMenu.js.map +1 -0
- package/dist/react/RateView.d.ts +18 -0
- package/dist/react/RateView.js +30 -0
- package/dist/react/RateView.js.map +1 -0
- package/dist/react/ReadableOutput.d.ts +3 -0
- package/dist/react/ReadableOutput.js +50 -0
- package/dist/react/ReadableOutput.js.map +1 -0
- package/dist/react/RollBack.d.ts +17 -0
- package/dist/react/RollBack.js +26 -0
- package/dist/react/RollBack.js.map +1 -0
- package/dist/react/RunView.d.ts +9 -0
- package/dist/react/RunView.js +41 -0
- package/dist/react/RunView.js.map +1 -0
- package/dist/react/SettingsHistory.d.ts +33 -0
- package/dist/react/SettingsHistory.js +79 -0
- package/dist/react/SettingsHistory.js.map +1 -0
- package/dist/react/SideBySideView.d.ts +14 -0
- package/dist/react/SideBySideView.js +67 -0
- package/dist/react/SideBySideView.js.map +1 -0
- package/dist/react/SuiteSections.d.ts +111 -0
- package/dist/react/SuiteSections.js +224 -0
- package/dist/react/SuiteSections.js.map +1 -0
- package/dist/react/Tabs.d.ts +15 -0
- package/dist/react/Tabs.js +18 -0
- package/dist/react/Tabs.js.map +1 -0
- package/dist/react/Thumbs.d.ts +13 -0
- package/dist/react/Thumbs.js +54 -0
- package/dist/react/Thumbs.js.map +1 -0
- package/dist/react/WeeklyCheck.d.ts +11 -0
- package/dist/react/WeeklyCheck.js +19 -0
- package/dist/react/WeeklyCheck.js.map +1 -0
- package/dist/react/app.d.ts +118 -0
- package/dist/react/app.js +87 -0
- package/dist/react/app.js.map +1 -0
- package/dist/react/format.d.ts +27 -0
- package/dist/react/format.js +38 -0
- package/dist/react/format.js.map +1 -0
- package/dist/react/index.d.ts +31 -0
- package/dist/react/index.js +32 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/pieces.d.ts +191 -0
- package/dist/react/pieces.js +191 -0
- package/dist/react/pieces.js.map +1 -0
- package/dist/readCheck.d.ts +1 -1
- package/dist/runner.d.ts +76 -3
- package/dist/runner.js +133 -3
- package/dist/runner.js.map +1 -1
- package/dist/settings.d.ts +1 -1
- package/dist/store.d.ts +1 -1
- package/dist/suggest.d.ts +52 -2
- package/dist/suggest.js +101 -8
- package/dist/suggest.js.map +1 -1
- package/dist/suiteContract.d.ts +3 -3
- package/dist/suiteContract.js +20 -16
- package/dist/suiteContract.js.map +1 -1
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +1 -1
- package/dist/types.d.ts +79 -2
- package/dist/types.js +96 -12
- package/dist/types.js.map +1 -1
- package/package.json +56 -6
- package/schema/evalkeeper.prisma +196 -0
- package/src/ai-sdk/decide.ts +57 -0
- package/src/ai-sdk/hash.ts +74 -0
- package/src/ai-sdk/index.ts +15 -0
- package/src/ai-sdk/judge.ts +163 -0
- package/src/ai-sdk/usage.ts +31 -0
- package/src/board.ts +5 -0
- package/src/cli/addPages.ts +15 -7
- package/src/cli/main.ts +135 -9
- package/src/cli/migration.ts +349 -0
- package/src/feedback.ts +1 -1
- package/src/glossary.ts +18 -0
- package/src/health.ts +4 -2
- package/src/inInstructions.ts +1 -1
- package/{templates/components/evalkeeper → src/next}/RefreshWhile.tsx +2 -2
- package/src/next/actions.ts +389 -0
- package/src/next/components.ts +31 -0
- package/{templates/lib/evalkeeper/cronAuth.ts → src/next/cron.ts} +3 -0
- package/src/next/index.ts +15 -0
- package/src/next/pages.tsx +106 -0
- package/src/next/route.ts +35 -0
- package/src/next/weekly.ts +70 -0
- package/src/next/wiring.ts +18 -0
- package/src/prisma/contracts.ts +249 -0
- package/src/prisma/index.ts +1169 -0
- package/src/prisma/mapping.ts +147 -0
- package/src/prisma/moveIn.ts +502 -0
- package/src/prune.ts +77 -0
- package/{templates/components/evalkeeper → src/react}/AddCase.tsx +6 -6
- package/{templates/components/evalkeeper → src/react}/AnswerKey.tsx +96 -59
- package/{templates/components/evalkeeper → src/react}/CaseMenu.tsx +9 -8
- package/src/react/CompareView.tsx +270 -0
- package/{templates/components/evalkeeper → src/react}/ConfirmAnswer.tsx +6 -3
- package/{templates/components/evalkeeper → src/react}/DisagreementChip.tsx +2 -3
- package/src/react/FeedbackView.tsx +230 -0
- package/{templates/components/evalkeeper → src/react}/Fields.tsx +54 -10
- package/src/react/HubSections.tsx +446 -0
- package/src/react/ModelMenu.tsx +89 -0
- package/src/react/RateView.tsx +143 -0
- package/{templates/components/evalkeeper → src/react}/ReadableOutput.tsx +1 -1
- package/{templates/components/evalkeeper → src/react}/RollBack.tsx +9 -10
- package/src/react/RunView.tsx +151 -0
- package/{templates/components/evalkeeper → src/react}/SettingsHistory.tsx +16 -9
- package/src/react/SideBySideView.tsx +307 -0
- package/src/react/SuiteSections.tsx +925 -0
- package/src/react/Tabs.tsx +61 -0
- package/{templates/components/evalkeeper → src/react}/Thumbs.tsx +7 -6
- package/{templates/components/evalkeeper → src/react}/WeeklyCheck.tsx +31 -20
- package/src/react/app.ts +173 -0
- package/src/react/format.ts +45 -0
- package/src/react/index.ts +31 -0
- package/src/react/pieces.tsx +412 -0
- package/src/readCheck.ts +1 -1
- package/src/runner.ts +182 -4
- package/src/settings.ts +1 -1
- package/src/store.ts +1 -1
- package/src/suggest.ts +145 -13
- package/src/suiteContract.ts +35 -28
- package/src/testing.ts +2 -2
- package/src/types.ts +147 -19
- package/starter/index.ts +33 -8
- package/templates/app/api/cron/evals-weekly/route.ts +5 -15
- package/templates/app/evals/[suite]/compare/page.tsx +6 -383
- package/templates/app/evals/[suite]/page.tsx +7 -532
- package/templates/app/evals/[suite]/rate/page.tsx +6 -141
- package/templates/app/evals/[suite]/runs/[runId]/page.tsx +6 -174
- package/templates/app/evals/[suite]/side-by-side/page.tsx +6 -318
- package/templates/app/evals/feedback/page.tsx +6 -227
- package/templates/app/evals/layout.tsx +10 -0
- package/templates/app/evals/page.tsx +7 -365
- package/templates/lib/evalkeeper/actions.ts +34 -296
- package/templates/lib/evalkeeper/appComponents.tsx +21 -0
- package/templates/lib/evalkeeper/evals.ts +14 -0
- package/templates/lib/evalkeeper/paths.ts +2 -7
- package/templates/components/evalkeeper/Submit.tsx +0 -67
- package/templates/components/evalkeeper/Tip.tsx +0 -98
- package/templates/components/evalkeeper/ui.tsx +0 -105
- package/templates/lib/evalkeeper/time.ts +0 -4
- package/templates/lib/evalkeeper/weekly.ts +0 -74
|
@@ -1,534 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Link from "next/link";
|
|
3
|
-
import { notFound } from "next/navigation";
|
|
4
|
-
import {
|
|
5
|
-
FAVOR_TEXT,
|
|
6
|
-
checkBar,
|
|
7
|
-
meanCalibrationError,
|
|
8
|
-
money,
|
|
9
|
-
probabilityQuality,
|
|
10
|
-
perAnswer,
|
|
11
|
-
retiresLabel,
|
|
12
|
-
seconds,
|
|
13
|
-
seriousMistakes,
|
|
14
|
-
suggest,
|
|
15
|
-
} from "@crowandraven/evalkeeper";
|
|
16
|
-
import { AnswerKey } from "@/components/evalkeeper/AnswerKey";
|
|
17
|
-
import { RefreshWhile } from "@/components/evalkeeper/RefreshWhile";
|
|
18
|
-
import { IconSubmit, Spinner, Submit } from "@/components/evalkeeper/Submit";
|
|
19
|
-
import { RotateCw } from "lucide-react";
|
|
20
|
-
import { BackLink, Card, Chip, Score, pct } from "@/components/evalkeeper/ui";
|
|
21
|
-
import {
|
|
22
|
-
MODELS,
|
|
23
|
-
requireAdmin,
|
|
24
|
-
runner,
|
|
25
|
-
settings,
|
|
26
|
-
SUITE_BY_KEY,
|
|
27
|
-
} from "@/lib/evalkeeper";
|
|
28
|
-
import { SettingsHistory } from "@/components/evalkeeper/SettingsHistory";
|
|
29
|
-
import {
|
|
30
|
-
makeFallback,
|
|
31
|
-
makeLive,
|
|
32
|
-
rescore,
|
|
33
|
-
testAll,
|
|
34
|
-
testModel,
|
|
35
|
-
useSuggestion,
|
|
36
|
-
} from "@/lib/evalkeeper/actions";
|
|
37
|
-
import { InfoTip, Tip } from "@/components/evalkeeper/Tip";
|
|
38
|
-
import { EVALS_BASE, evalsPath } from "@/lib/evalkeeper/paths";
|
|
1
|
+
import { pages } from "@/lib/evalkeeper/evals";
|
|
39
2
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
51
|
-
/** A share as a whole percent, or a dash when there's nothing to show. */
|
|
52
|
-
const asPct = (x: number | null) => (x === null ? "—" : pct(x));
|
|
53
|
-
|
|
54
|
-
const VS: Record<string, string> = {
|
|
55
|
-
BETTER: "More accurate",
|
|
56
|
-
SAME: "About as accurate",
|
|
57
|
-
WORSE: "Less accurate",
|
|
58
|
-
TOO_FEW: "Too few cases to tell",
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export default async function SuitePage({
|
|
62
|
-
params,
|
|
63
|
-
}: {
|
|
64
|
-
params: Promise<{ suite: string }>;
|
|
65
|
-
}) {
|
|
66
|
-
await requireAdmin();
|
|
67
|
-
const { suite: key } = await params;
|
|
68
|
-
const operation = SUITE_BY_KEY[key]?.operation;
|
|
69
|
-
if (!operation) notFound();
|
|
70
|
-
// The board and the settings load together: on a remote database each
|
|
71
|
-
// waits on round trips, so one after the other doubles the wait.
|
|
72
|
-
const [b, [history, liveSettings], inInstructions] = await Promise.all([
|
|
73
|
-
runner.board(key),
|
|
74
|
-
// Records a deploy if the instructions changed under the live
|
|
75
|
-
// settings, before reading them.
|
|
76
|
-
settings
|
|
77
|
-
.syncPrompt(operation)
|
|
78
|
-
.then(() =>
|
|
79
|
-
Promise.all([settings.history(operation), settings.current(operation)]),
|
|
80
|
-
),
|
|
81
|
-
runner.casesInInstructions(key),
|
|
82
|
-
]);
|
|
83
|
-
const { suite, rows } = b;
|
|
84
|
-
const s = suggest(rows, suite.checks, suite.priority, MODELS);
|
|
85
|
-
const testing = rows.some((r) => r.testing);
|
|
86
|
-
// What testing each model would cost now, counting answers it would reuse.
|
|
87
|
-
const estimates = new Map(
|
|
88
|
-
await Promise.all(
|
|
89
|
-
rows.map(
|
|
90
|
-
async (r) =>
|
|
91
|
-
[
|
|
92
|
-
r.key,
|
|
93
|
-
await runner.estimateRun(key, r.model, "ALL", 1, {
|
|
94
|
-
reasoningEffort: r.effort,
|
|
95
|
-
}),
|
|
96
|
-
] as const,
|
|
97
|
-
),
|
|
98
|
-
),
|
|
99
|
-
);
|
|
100
|
-
const live = rows.find((r) => r.live);
|
|
101
|
-
|
|
102
|
-
return (
|
|
103
|
-
<div className="space-y-8">
|
|
104
|
-
<RefreshWhile active={testing} />
|
|
105
|
-
<div className="space-y-2">
|
|
106
|
-
<BackLink href={EVALS_BASE}>Evals</BackLink>
|
|
107
|
-
<h1 className="text-2xl font-semibold">{suite.label}</h1>
|
|
108
|
-
<p className="readable text-muted">{suite.description}</p>
|
|
109
|
-
<p className="readable text-sm text-muted">
|
|
110
|
-
Priority: {FAVOR_TEXT[suite.priority.favor]}.
|
|
111
|
-
<InfoTip term="priority" />
|
|
112
|
-
</p>
|
|
113
|
-
</div>
|
|
114
|
-
|
|
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 && (
|
|
118
|
-
<Card className="space-y-3">
|
|
119
|
-
<div className="flex flex-wrap items-start justify-between gap-3">
|
|
120
|
-
<h2 className="font-semibold">
|
|
121
|
-
{s.same ? "No change suggested" : "Suggested"}
|
|
122
|
-
<InfoTip term="suggestion" />
|
|
123
|
-
</h2>
|
|
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
|
-
)}
|
|
132
|
-
</div>
|
|
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
|
-
)}
|
|
144
|
-
<ul className="readable list-disc space-y-1 pl-5 text-sm text-muted">
|
|
145
|
-
{s.reasons.map((r) => (
|
|
146
|
-
<li key={r}>{r}</li>
|
|
147
|
-
))}
|
|
148
|
-
</ul>
|
|
149
|
-
</Card>
|
|
150
|
-
)}
|
|
3
|
+
// Written by `npx @crowandraven/evalkeeper add pages`. To arrange
|
|
4
|
+
// a suite's page your own way, replace this file with the sections ("Arrange
|
|
5
|
+
// your own page" in the guide).
|
|
151
6
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
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
|
-
|
|
173
|
-
<section className="space-y-3">
|
|
174
|
-
<div className="flex items-center justify-between gap-4">
|
|
175
|
-
<h2 className="text-lg font-semibold">Models</h2>
|
|
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>
|
|
188
|
-
</div>
|
|
189
|
-
<Card className="overflow-x-auto p-0 lg:overflow-visible">
|
|
190
|
-
<table className="w-full text-sm">
|
|
191
|
-
<thead className="text-left text-muted">
|
|
192
|
-
<tr className="border-b border-line">
|
|
193
|
-
<th className="p-3 font-normal">Model</th>
|
|
194
|
-
<th className="p-3 font-normal">
|
|
195
|
-
<Tip term="score" side="bottom">
|
|
196
|
-
Score
|
|
197
|
-
</Tip>
|
|
198
|
-
</th>
|
|
199
|
-
<th className="p-3 font-normal">
|
|
200
|
-
<Tip term="seriousMistakes" side="bottom">
|
|
201
|
-
Serious mistakes
|
|
202
|
-
</Tip>
|
|
203
|
-
</th>
|
|
204
|
-
<th className="p-3 font-normal">
|
|
205
|
-
<Tip term="time" side="bottom" align="end">
|
|
206
|
-
Time
|
|
207
|
-
</Tip>
|
|
208
|
-
</th>
|
|
209
|
-
{suite.decisions && (
|
|
210
|
-
<>
|
|
211
|
-
<th className="p-3 font-normal">
|
|
212
|
-
<Tip term="probabilityQuality" side="bottom">
|
|
213
|
-
Probability quality
|
|
214
|
-
</Tip>
|
|
215
|
-
</th>
|
|
216
|
-
<th className="p-3 font-normal">
|
|
217
|
-
<Tip term="calibrationError" side="bottom" align="end">
|
|
218
|
-
Calibration error
|
|
219
|
-
</Tip>
|
|
220
|
-
</th>
|
|
221
|
-
</>
|
|
222
|
-
)}
|
|
223
|
-
<th className="p-3 font-normal">
|
|
224
|
-
<Tip term="cost" side="bottom" align="end">
|
|
225
|
-
Cost
|
|
226
|
-
</Tip>
|
|
227
|
-
</th>
|
|
228
|
-
<th className="p-3 font-normal">
|
|
229
|
-
<Tip term="againstLive" side="bottom" align="end">
|
|
230
|
-
Against live
|
|
231
|
-
</Tip>
|
|
232
|
-
</th>
|
|
233
|
-
<th className="p-3" />
|
|
234
|
-
</tr>
|
|
235
|
-
</thead>
|
|
236
|
-
<tbody>
|
|
237
|
-
{rows.map((r) => (
|
|
238
|
-
<tr key={r.key} className="border-b border-line last:border-0">
|
|
239
|
-
<td className="p-3">
|
|
240
|
-
<div className="flex flex-wrap items-center gap-2">
|
|
241
|
-
<span
|
|
242
|
-
className={r.live ? "font-semibold" : "font-medium"}
|
|
243
|
-
>
|
|
244
|
-
{r.label}
|
|
245
|
-
</span>
|
|
246
|
-
{r.live && (
|
|
247
|
-
<Tip term="live" side="bottom" id={`live-${r.key}`}>
|
|
248
|
-
<Chip tone="live">Live</Chip>
|
|
249
|
-
</Tip>
|
|
250
|
-
)}
|
|
251
|
-
{r.fallback && (
|
|
252
|
-
<Tip
|
|
253
|
-
term="fallback"
|
|
254
|
-
side="bottom"
|
|
255
|
-
id={`fallback-${r.key}`}
|
|
256
|
-
>
|
|
257
|
-
<Chip tone="fallback">Fallback</Chip>
|
|
258
|
-
</Tip>
|
|
259
|
-
)}
|
|
260
|
-
{retiresLabel(MODELS, r.model) && (
|
|
261
|
-
<Tip
|
|
262
|
-
term="retiring"
|
|
263
|
-
side="bottom"
|
|
264
|
-
id={`retiring-${r.key}`}
|
|
265
|
-
>
|
|
266
|
-
<Chip tone="warn">
|
|
267
|
-
Retires {retiresLabel(MODELS, r.model)}
|
|
268
|
-
</Chip>
|
|
269
|
-
</Tip>
|
|
270
|
-
)}
|
|
271
|
-
{suite.decisions && MODELS[r.model]?.decisions && (
|
|
272
|
-
<Tip
|
|
273
|
-
term={
|
|
274
|
-
MODELS[r.model]?.decisions === "native"
|
|
275
|
-
? "nativeProbabilities"
|
|
276
|
-
: "promptedProbabilities"
|
|
277
|
-
}
|
|
278
|
-
side="bottom"
|
|
279
|
-
id={`decisions-${r.key}`}
|
|
280
|
-
>
|
|
281
|
-
<Chip tone="neutral">
|
|
282
|
-
{MODELS[r.model]?.decisions === "native"
|
|
283
|
-
? "Native probabilities"
|
|
284
|
-
: "Prompted"}
|
|
285
|
-
</Chip>
|
|
286
|
-
</Tip>
|
|
287
|
-
)}
|
|
288
|
-
{r.test?.stale && (
|
|
289
|
-
<Tip
|
|
290
|
-
term="outOfDate"
|
|
291
|
-
side="bottom"
|
|
292
|
-
id={`stale-${r.key}`}
|
|
293
|
-
>
|
|
294
|
-
<Chip tone="neutral">Out of date</Chip>
|
|
295
|
-
</Tip>
|
|
296
|
-
)}
|
|
297
|
-
</div>
|
|
298
|
-
</td>
|
|
299
|
-
<td className="p-3">
|
|
300
|
-
{r.testing ? (
|
|
301
|
-
<span
|
|
302
|
-
role="status"
|
|
303
|
-
title="Testing"
|
|
304
|
-
className="inline-flex text-accent"
|
|
305
|
-
>
|
|
306
|
-
<Spinner />
|
|
307
|
-
</span>
|
|
308
|
-
) : r.test ? (
|
|
309
|
-
<Link href={evalsPath(key, "runs", r.test.runId)}>
|
|
310
|
-
<Score right={r.test.right} total={r.test.total} />
|
|
311
|
-
</Link>
|
|
312
|
-
) : (
|
|
313
|
-
<span className="text-muted">
|
|
314
|
-
{r.failed ?? "Not tested"}
|
|
315
|
-
</span>
|
|
316
|
-
)}
|
|
317
|
-
</td>
|
|
318
|
-
<td className="p-3 tabular-nums">
|
|
319
|
-
{r.test ? seriousMistakes(r, suite.checks) : "—"}
|
|
320
|
-
</td>
|
|
321
|
-
<td className="p-3 tabular-nums">
|
|
322
|
-
{r.test ? seconds(r.test.avgMs) : "—"}
|
|
323
|
-
</td>
|
|
324
|
-
{suite.decisions && (
|
|
325
|
-
<>
|
|
326
|
-
<td className="p-3 tabular-nums">
|
|
327
|
-
{asPct(
|
|
328
|
-
r.test ? probabilityQuality(r.test.measures) : null,
|
|
329
|
-
)}
|
|
330
|
-
</td>
|
|
331
|
-
<td className="p-3 tabular-nums">
|
|
332
|
-
{asPct(
|
|
333
|
-
r.test ? meanCalibrationError(r.test.measures) : null,
|
|
334
|
-
)}
|
|
335
|
-
</td>
|
|
336
|
-
</>
|
|
337
|
-
)}
|
|
338
|
-
<td className="p-3 tabular-nums">
|
|
339
|
-
{r.test ? perAnswer(r.test.costPerAnswer) : "—"}
|
|
340
|
-
</td>
|
|
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>
|
|
354
|
-
<td className="p-3">
|
|
355
|
-
<div className="flex flex-col items-end gap-0.5">
|
|
356
|
-
<div className="flex justify-end gap-2">
|
|
357
|
-
{r.canMakeFallback && (
|
|
358
|
-
<form action={makeFallback}>
|
|
359
|
-
<input type="hidden" name="suite" value={key} />
|
|
360
|
-
<input type="hidden" name="model" value={r.model} />
|
|
361
|
-
<Submit variant="quiet">Make fallback</Submit>
|
|
362
|
-
</form>
|
|
363
|
-
)}
|
|
364
|
-
{!r.live && r.canMakeLive && (
|
|
365
|
-
<form action={makeLive}>
|
|
366
|
-
<input type="hidden" name="suite" value={key} />
|
|
367
|
-
<input type="hidden" name="model" value={r.model} />
|
|
368
|
-
<Submit variant="quiet">Make live</Submit>
|
|
369
|
-
</form>
|
|
370
|
-
)}
|
|
371
|
-
<form action={testModel}>
|
|
372
|
-
<input type="hidden" name="suite" value={key} />
|
|
373
|
-
<input type="hidden" name="model" value={r.model} />
|
|
374
|
-
<Tip
|
|
375
|
-
control
|
|
376
|
-
id={`test-${r.key}`}
|
|
377
|
-
text={
|
|
378
|
-
r.test
|
|
379
|
-
? "Test this model again on every case in use."
|
|
380
|
-
: "Test this model on every case in use."
|
|
381
|
-
}
|
|
382
|
-
side="bottom"
|
|
383
|
-
align="end"
|
|
384
|
-
>
|
|
385
|
-
<IconSubmit
|
|
386
|
-
label="Test"
|
|
387
|
-
icon={
|
|
388
|
-
<RotateCw aria-hidden className="h-4 w-4" />
|
|
389
|
-
}
|
|
390
|
-
/>
|
|
391
|
-
</Tip>
|
|
392
|
-
</form>
|
|
393
|
-
</div>
|
|
394
|
-
<EstimateNote
|
|
395
|
-
id={r.key}
|
|
396
|
-
estimate={estimates.get(r.key)}
|
|
397
|
-
/>
|
|
398
|
-
{r.test && !r.test.stale && r.test.failedAnswers > 0 && (
|
|
399
|
-
<span className="text-right text-xs text-muted">
|
|
400
|
-
{r.test.failedAnswers}{" "}
|
|
401
|
-
{r.test.failedAnswers === 1 ? "answer" : "answers"}{" "}
|
|
402
|
-
failed on its last test
|
|
403
|
-
</span>
|
|
404
|
-
)}
|
|
405
|
-
</div>
|
|
406
|
-
</td>
|
|
407
|
-
</tr>
|
|
408
|
-
))}
|
|
409
|
-
</tbody>
|
|
410
|
-
</table>
|
|
411
|
-
</Card>
|
|
412
|
-
</section>
|
|
413
|
-
|
|
414
|
-
<SettingsHistory
|
|
415
|
-
suite={key}
|
|
416
|
-
entries={history}
|
|
417
|
-
liveId={liveSettings.version?.id ?? null}
|
|
418
|
-
label={(m) => MODELS[m]?.label ?? m}
|
|
419
|
-
defaults={liveSettings.settings}
|
|
420
|
-
/>
|
|
421
|
-
|
|
422
|
-
<section className="space-y-3">
|
|
423
|
-
<h2 className="text-lg font-semibold">
|
|
424
|
-
Checks
|
|
425
|
-
<InfoTip term="checks" />
|
|
426
|
-
</h2>
|
|
427
|
-
<div className="grid gap-3 md:grid-cols-2">
|
|
428
|
-
{suite.checks.map((c) => {
|
|
429
|
-
const rate = live?.test?.byCheck[c.key];
|
|
430
|
-
return (
|
|
431
|
-
<Card key={c.key} className="space-y-1">
|
|
432
|
-
<div className="flex justify-between gap-4">
|
|
433
|
-
<h3 className="font-medium">{c.label}</h3>
|
|
434
|
-
<Tip term={c.severity} id={`severity-${c.key}`}>
|
|
435
|
-
<Chip
|
|
436
|
-
tone={c.severity === "serious" ? "serious" : "neutral"}
|
|
437
|
-
>
|
|
438
|
-
{c.severity}
|
|
439
|
-
</Chip>
|
|
440
|
-
</Tip>
|
|
441
|
-
</div>
|
|
442
|
-
<p className="readable text-sm text-muted">{c.description}</p>
|
|
443
|
-
<p className="text-sm">
|
|
444
|
-
{rate && rate.n > 0 && (
|
|
445
|
-
<>
|
|
446
|
-
Live:{" "}
|
|
447
|
-
<span
|
|
448
|
-
className={
|
|
449
|
-
rate.passed / rate.n >= checkBar(c)
|
|
450
|
-
? "text-good"
|
|
451
|
-
: "text-warn"
|
|
452
|
-
}
|
|
453
|
-
>
|
|
454
|
-
{pct(rate.passed / rate.n)}
|
|
455
|
-
</span>{" "}
|
|
456
|
-
({rate.passed}/{rate.n}) ·{" "}
|
|
457
|
-
</>
|
|
458
|
-
)}
|
|
459
|
-
<Tip term="bar" id={`bar-${c.key}`}>
|
|
460
|
-
<span className="text-muted">Bar: {pct(checkBar(c))}</span>
|
|
461
|
-
</Tip>
|
|
462
|
-
</p>
|
|
463
|
-
</Card>
|
|
464
|
-
);
|
|
465
|
-
})}
|
|
466
|
-
</div>
|
|
467
|
-
</section>
|
|
468
|
-
|
|
469
|
-
{/* The weekly check links here to review drafts. */}
|
|
470
|
-
<section id="answer-key" className="scroll-mt-4 space-y-3">
|
|
471
|
-
<AnswerKey
|
|
472
|
-
suite={suite}
|
|
473
|
-
rows={rows}
|
|
474
|
-
heading={
|
|
475
|
-
<h2 className="text-lg font-semibold">
|
|
476
|
-
Answer key ({b.cases} cases in use)
|
|
477
|
-
<InfoTip term="answerKey" />
|
|
478
|
-
</h2>
|
|
479
|
-
}
|
|
480
|
-
tools={
|
|
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
|
-
</>
|
|
502
|
-
}
|
|
503
|
-
/>
|
|
504
|
-
</section>
|
|
505
|
-
</div>
|
|
506
|
-
);
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
/** "Free: all 16 reused" or "~$0.03, 4 of 16 reused", under a model's buttons. */
|
|
510
|
-
function EstimateNote({
|
|
511
|
-
id,
|
|
512
|
-
estimate,
|
|
513
|
-
}: {
|
|
514
|
-
id: string;
|
|
515
|
-
estimate:
|
|
516
|
-
{ answers: number; reused: number; costUsd: number | null } | undefined;
|
|
517
|
-
}) {
|
|
518
|
-
if (!estimate || estimate.answers === 0) return null;
|
|
519
|
-
const { answers, reused, costUsd } = estimate;
|
|
520
|
-
const text =
|
|
521
|
-
reused === answers
|
|
522
|
-
? `Free: all ${answers} reused`
|
|
523
|
-
: `${costUsd === null ? "Cost unknown" : `~${money(costUsd)}`}${reused ? `, ${reused} of ${answers} reused` : ""}`;
|
|
524
|
-
return (
|
|
525
|
-
<Tip
|
|
526
|
-
text="What testing this model costs now. Answers an identical request gave in the last 7 days are reused for free."
|
|
527
|
-
id={`estimate-${id}`}
|
|
528
|
-
side="bottom"
|
|
529
|
-
align="end"
|
|
530
|
-
>
|
|
531
|
-
<span className="whitespace-nowrap text-xs text-muted">{text}</span>
|
|
532
|
-
</Tip>
|
|
533
|
-
);
|
|
534
|
-
}
|
|
7
|
+
export const dynamic = "force-dynamic";
|
|
8
|
+
export const generateMetadata = pages.suite.generateMetadata;
|
|
9
|
+
export default pages.suite.Page;
|
|
@@ -1,143 +1,8 @@
|
|
|
1
|
-
import
|
|
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";
|
|
1
|
+
import { pages } from "@/lib/evalkeeper/evals";
|
|
12
2
|
|
|
13
|
-
|
|
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>
|
|
3
|
+
// Written by `npx @crowandraven/evalkeeper add pages`: don't edit it.
|
|
4
|
+
// Blind rating: one case at a time, by its input only.
|
|
71
5
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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
|
-
}
|
|
6
|
+
export const dynamic = "force-dynamic";
|
|
7
|
+
export const generateMetadata = pages.rate.generateMetadata;
|
|
8
|
+
export default pages.rate.Page;
|