@crowandraven/evalkeeper 0.10.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 +8 -1
- package/dist/glossary.js +8 -1
- package/dist/glossary.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 +62 -2
- package/dist/runner.js +123 -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 +1 -1
- package/dist/suggest.js +7 -7
- 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.js +1 -1
- 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 +16 -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 +92 -61
- 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 +6 -6
- 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 +167 -3
- package/src/settings.ts +1 -1
- package/src/store.ts +1 -1
- package/src/suggest.ts +7 -7
- package/src/suiteContract.ts +35 -28
- package/src/testing.ts +2 -2
- package/src/types.ts +2 -2
- package/starter/index.ts +22 -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 -685
- package/templates/app/evals/[suite]/rate/page.tsx +6 -151
- 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 -397
- package/templates/lib/evalkeeper/actions.ts +34 -317
- 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
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import { evalsPath, type EvalAppConfig } from "./app.js";
|
|
2
|
+
import { BackLink, Card, Chip, InfoTip, Link, Tip } from "./pieces.js";
|
|
3
|
+
import { pct, momentOf, LINK } from "./format.js";
|
|
4
|
+
import {
|
|
5
|
+
checkBar,
|
|
6
|
+
perAnswer,
|
|
7
|
+
seconds,
|
|
8
|
+
verdictSentence,
|
|
9
|
+
type Rate,
|
|
10
|
+
type RunRecord,
|
|
11
|
+
type ModelCatalog,
|
|
12
|
+
} from "../index.js";
|
|
13
|
+
import { DisagreementChip } from "./DisagreementChip.js";
|
|
14
|
+
|
|
15
|
+
/** A search parameter as one string, or null when it's missing or repeated. */
|
|
16
|
+
const one = (v: string | string[] | undefined) =>
|
|
17
|
+
typeof v === "string" && v ? v : null;
|
|
18
|
+
|
|
19
|
+
/** A test's name: its model, reasoning setting, set, and when it ran. */
|
|
20
|
+
function testName(models: ModelCatalog, r: RunRecord): string {
|
|
21
|
+
const model = models[r.model]?.label ?? r.model;
|
|
22
|
+
const effort = r.reasoningEffort ? `, ${r.reasoningEffort} reasoning` : "";
|
|
23
|
+
const set = r.set === "ALL" ? "" : `, ${r.set.toLowerCase()} set`;
|
|
24
|
+
return `${model}${effort}${set} · ${momentOf(r.startedAt)}`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** A pass rate as "80% (8/10)", or a dash when the check never applied. */
|
|
28
|
+
function rateText(r: Rate | undefined): string {
|
|
29
|
+
return r && r.n > 0 ? `${pct(r.passed / r.n)} (${r.passed}/${r.n})` : "—";
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Two finished tests of a suite compared: the verdict in plain words, each
|
|
34
|
+
* check's pass rate side by side, and the cases they graded differently,
|
|
35
|
+
* each linked to its answers side by side. `a` is the test in place (the
|
|
36
|
+
* live model's latest when left out), `b` the challenger.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/** Two tests of a suite compared: the verdict, each check, and the cases they graded differently. Null when it doesn't exist. */
|
|
40
|
+
export async function CompareView({
|
|
41
|
+
app,
|
|
42
|
+
suite: key,
|
|
43
|
+
search,
|
|
44
|
+
}: {
|
|
45
|
+
/** Your screens' configuration. */
|
|
46
|
+
app: EvalAppConfig;
|
|
47
|
+
suite: string;
|
|
48
|
+
search: Record<string, string | string[] | undefined>;
|
|
49
|
+
}) {
|
|
50
|
+
const sp = search;
|
|
51
|
+
const suiteDef = app.suiteByKey[key];
|
|
52
|
+
if (!suiteDef) return null;
|
|
53
|
+
// Opened from an "Against live" verdict: the test in place and the
|
|
54
|
+
// challenger, both finished tests of this suite.
|
|
55
|
+
const a = one(sp.a);
|
|
56
|
+
const b = one(sp.b);
|
|
57
|
+
if (!a || !b) return null;
|
|
58
|
+
const result = await app.runner.compare(key, a, b);
|
|
59
|
+
if (!result) return null;
|
|
60
|
+
const titles = new Map(
|
|
61
|
+
(await app.store.listCases(key, { includeRetired: true })).map((c) => [
|
|
62
|
+
c.id,
|
|
63
|
+
suiteDef.title(suiteDef.input.parse(c.input)),
|
|
64
|
+
]),
|
|
65
|
+
);
|
|
66
|
+
const sideBySide = (caseId: string) =>
|
|
67
|
+
`${evalsPath(app, key, "side-by-side")}?${new URLSearchParams({ a: result.a.id, b: result.b.id, case: caseId })}`;
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<div className="space-y-8">
|
|
71
|
+
<div className="space-y-2">
|
|
72
|
+
<BackLink href={evalsPath(app, key)}>{suiteDef.label}</BackLink>
|
|
73
|
+
<h1 className="text-2xl font-semibold">
|
|
74
|
+
{app.models[result.b.model]?.label ?? result.b.model} against{" "}
|
|
75
|
+
{app.models[result.a.model]?.label ?? result.a.model}
|
|
76
|
+
<InfoTip term="comparison" />
|
|
77
|
+
</h1>
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
<>
|
|
81
|
+
<Card className="space-y-3">
|
|
82
|
+
<div className="flex flex-wrap items-start justify-between gap-3">
|
|
83
|
+
<h2 className="font-semibold">
|
|
84
|
+
Verdict
|
|
85
|
+
<InfoTip term="verdict" />
|
|
86
|
+
</h2>
|
|
87
|
+
</div>
|
|
88
|
+
<p className="readable text-lg">
|
|
89
|
+
{verdictSentence(
|
|
90
|
+
result.comparison,
|
|
91
|
+
app.models[result.b.model]?.label ?? result.b.model,
|
|
92
|
+
)}
|
|
93
|
+
</p>
|
|
94
|
+
<p className="readable text-sm text-muted">
|
|
95
|
+
<Link
|
|
96
|
+
href={evalsPath(app, key, "runs", result.a.id)}
|
|
97
|
+
className={LINK}
|
|
98
|
+
>
|
|
99
|
+
{testName(app.models, result.a)}
|
|
100
|
+
</Link>{" "}
|
|
101
|
+
(in place) against{" "}
|
|
102
|
+
<Link
|
|
103
|
+
href={evalsPath(app, key, "runs", result.b.id)}
|
|
104
|
+
className={LINK}
|
|
105
|
+
>
|
|
106
|
+
{testName(app.models, result.b)}
|
|
107
|
+
</Link>{" "}
|
|
108
|
+
(challenger), on{" "}
|
|
109
|
+
<Tip term="sharedCases">
|
|
110
|
+
<span>{result.comparison.n} shared cases</span>
|
|
111
|
+
</Tip>
|
|
112
|
+
.
|
|
113
|
+
</p>
|
|
114
|
+
<p className="text-sm text-muted">
|
|
115
|
+
<Tip term="cost" id="cost-compare">
|
|
116
|
+
<span>
|
|
117
|
+
Cost per answer: {perAnswer(result.comparison.cost.champion)} in
|
|
118
|
+
place, {perAnswer(result.comparison.cost.challenger)} challenger
|
|
119
|
+
</span>
|
|
120
|
+
</Tip>
|
|
121
|
+
{" · "}
|
|
122
|
+
<Tip term="time" id="time-compare" align="end">
|
|
123
|
+
<span>
|
|
124
|
+
Time: {seconds(result.comparison.avgMs.champion)} in place,{" "}
|
|
125
|
+
{seconds(result.comparison.avgMs.challenger)} challenger
|
|
126
|
+
</span>
|
|
127
|
+
</Tip>
|
|
128
|
+
</p>
|
|
129
|
+
{result.caveats.length > 0 && (
|
|
130
|
+
<div className="readable rounded-md bg-tint p-3 text-sm">
|
|
131
|
+
<p className="font-medium">
|
|
132
|
+
Measured differently
|
|
133
|
+
<InfoTip term="measuredDifferently" />
|
|
134
|
+
</p>
|
|
135
|
+
<ul className="list-disc pl-5 text-muted">
|
|
136
|
+
{result.caveats.map((c) => (
|
|
137
|
+
<li key={c}>{c}</li>
|
|
138
|
+
))}
|
|
139
|
+
</ul>
|
|
140
|
+
</div>
|
|
141
|
+
)}
|
|
142
|
+
</Card>
|
|
143
|
+
|
|
144
|
+
<section className="space-y-3">
|
|
145
|
+
<h2 className="text-lg font-semibold">
|
|
146
|
+
Checks
|
|
147
|
+
<InfoTip term="checks" />
|
|
148
|
+
</h2>
|
|
149
|
+
<Card className="overflow-x-auto p-0">
|
|
150
|
+
<table className="w-full text-sm">
|
|
151
|
+
<thead className="text-left text-muted">
|
|
152
|
+
<tr className="border-b border-line">
|
|
153
|
+
<th className="p-3 font-normal">Check</th>
|
|
154
|
+
<th className="p-3 font-normal">
|
|
155
|
+
<Tip term="inPlace" side="bottom" id="inPlace-col">
|
|
156
|
+
In place
|
|
157
|
+
</Tip>
|
|
158
|
+
</th>
|
|
159
|
+
<th className="p-3 font-normal">
|
|
160
|
+
<Tip term="challenger" side="bottom" id="challenger-col">
|
|
161
|
+
Challenger
|
|
162
|
+
</Tip>
|
|
163
|
+
</th>
|
|
164
|
+
<th className="p-3 font-normal">
|
|
165
|
+
<Tip term="bar" side="bottom" align="end">
|
|
166
|
+
Bar
|
|
167
|
+
</Tip>
|
|
168
|
+
</th>
|
|
169
|
+
</tr>
|
|
170
|
+
</thead>
|
|
171
|
+
<tbody>
|
|
172
|
+
{result.suite.checks.map((c) => {
|
|
173
|
+
const r = result.comparison.byCheck[c.key];
|
|
174
|
+
return (
|
|
175
|
+
<tr
|
|
176
|
+
key={c.key}
|
|
177
|
+
className="border-b border-line last:border-0"
|
|
178
|
+
>
|
|
179
|
+
<td className="p-3">
|
|
180
|
+
<span className="flex flex-wrap items-center gap-2">
|
|
181
|
+
{c.label}
|
|
182
|
+
<Tip
|
|
183
|
+
term={c.severity}
|
|
184
|
+
id={`severity-${c.key}`}
|
|
185
|
+
side="bottom"
|
|
186
|
+
>
|
|
187
|
+
<Chip
|
|
188
|
+
tone={
|
|
189
|
+
c.severity === "serious" ? "serious" : "neutral"
|
|
190
|
+
}
|
|
191
|
+
>
|
|
192
|
+
{c.severity}
|
|
193
|
+
</Chip>
|
|
194
|
+
</Tip>
|
|
195
|
+
</span>
|
|
196
|
+
</td>
|
|
197
|
+
<td className="p-3 tabular-nums">
|
|
198
|
+
<Tip term="passRate" id={`a-${c.key}`} side="bottom">
|
|
199
|
+
<span>{rateText(r?.champion)}</span>
|
|
200
|
+
</Tip>
|
|
201
|
+
</td>
|
|
202
|
+
<td className="p-3 tabular-nums">
|
|
203
|
+
<Tip term="passRate" id={`b-${c.key}`} side="bottom">
|
|
204
|
+
<span>{rateText(r?.challenger)}</span>
|
|
205
|
+
</Tip>
|
|
206
|
+
</td>
|
|
207
|
+
<td className="p-3 tabular-nums text-muted">
|
|
208
|
+
{pct(checkBar(c))}
|
|
209
|
+
</td>
|
|
210
|
+
</tr>
|
|
211
|
+
);
|
|
212
|
+
})}
|
|
213
|
+
</tbody>
|
|
214
|
+
</table>
|
|
215
|
+
</Card>
|
|
216
|
+
</section>
|
|
217
|
+
|
|
218
|
+
<section className="space-y-3">
|
|
219
|
+
<div className="flex flex-wrap items-center justify-between gap-3">
|
|
220
|
+
<h2 className="text-lg font-semibold">
|
|
221
|
+
Where they differ ({result.disagreements.length})
|
|
222
|
+
<InfoTip term="disagreements" />
|
|
223
|
+
</h2>
|
|
224
|
+
{result.disagreements[0] && (
|
|
225
|
+
<Link
|
|
226
|
+
href={sideBySide(result.disagreements[0].caseId)}
|
|
227
|
+
className={`text-sm ${LINK}`}
|
|
228
|
+
>
|
|
229
|
+
Read them side by side
|
|
230
|
+
</Link>
|
|
231
|
+
)}
|
|
232
|
+
</div>
|
|
233
|
+
{result.disagreements.length === 0 ? (
|
|
234
|
+
<p className="readable text-muted">
|
|
235
|
+
The two tests graded every shared case alike.
|
|
236
|
+
</p>
|
|
237
|
+
) : (
|
|
238
|
+
<Card className="space-y-2">
|
|
239
|
+
{result.disagreements.map((d) => (
|
|
240
|
+
<div
|
|
241
|
+
key={d.caseId}
|
|
242
|
+
className="flex flex-wrap items-center justify-between gap-3 rounded-md bg-tint p-3 text-sm"
|
|
243
|
+
>
|
|
244
|
+
<Link
|
|
245
|
+
href={sideBySide(d.caseId)}
|
|
246
|
+
className={`font-medium ${LINK}`}
|
|
247
|
+
>
|
|
248
|
+
{titles.get(d.caseId) ?? "A retired case"}
|
|
249
|
+
</Link>
|
|
250
|
+
<span className="flex items-center gap-3">
|
|
251
|
+
<Tip term="caseScore" id={`score-${d.caseId}`}>
|
|
252
|
+
<span className="text-xs text-muted tabular-nums">
|
|
253
|
+
{pct(d.champion)} → {pct(d.challenger)}
|
|
254
|
+
</span>
|
|
255
|
+
</Tip>
|
|
256
|
+
<DisagreementChip
|
|
257
|
+
kind={d.kind}
|
|
258
|
+
id={`kind-${d.caseId}`}
|
|
259
|
+
align="end"
|
|
260
|
+
/>
|
|
261
|
+
</span>
|
|
262
|
+
</div>
|
|
263
|
+
))}
|
|
264
|
+
</Card>
|
|
265
|
+
)}
|
|
266
|
+
</section>
|
|
267
|
+
</>
|
|
268
|
+
</div>
|
|
269
|
+
);
|
|
270
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { Submit } from "./
|
|
3
|
+
import type { FormAction } from "./app.js";
|
|
4
|
+
import { Submit } from "./pieces.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Confirms a case's pending answer and moves straight on: this case closes
|
|
@@ -12,13 +12,16 @@ import { Submit } from "./Submit";
|
|
|
12
12
|
export function ConfirmAnswer({
|
|
13
13
|
suite,
|
|
14
14
|
labelId,
|
|
15
|
+
action,
|
|
15
16
|
}: {
|
|
16
17
|
suite: string;
|
|
17
18
|
labelId: string;
|
|
19
|
+
/** Your confirmAnswer action. */
|
|
20
|
+
action: FormAction;
|
|
18
21
|
}) {
|
|
19
22
|
return (
|
|
20
23
|
<form
|
|
21
|
-
action={
|
|
24
|
+
action={action}
|
|
22
25
|
onSubmit={(e) => {
|
|
23
26
|
const here = e.currentTarget.closest("details");
|
|
24
27
|
if (!here) return;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { DisagreementKind } from "
|
|
2
|
-
import { Tip } from "./
|
|
3
|
-
import { Chip } from "./ui";
|
|
1
|
+
import type { DisagreementKind } from "../index.js";
|
|
2
|
+
import { Chip, Tip } from "./pieces.js";
|
|
4
3
|
|
|
5
4
|
/** How each kind of disagreement shows: its chip and its glossary entry. */
|
|
6
5
|
const KIND = {
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { daysAgo, type EvalAppConfig } from "./app.js";
|
|
2
|
+
import {
|
|
3
|
+
asText,
|
|
4
|
+
isInjectionSuite,
|
|
5
|
+
thumbsSummary,
|
|
6
|
+
whyNotACase,
|
|
7
|
+
type AnySuite,
|
|
8
|
+
type FeedbackRecord,
|
|
9
|
+
} from "../index.js";
|
|
10
|
+
import { FieldValues } from "./Fields.js";
|
|
11
|
+
import { BackLink, Card, Chip, InfoTip, Submit, Tip } from "./pieces.js";
|
|
12
|
+
import { pct, momentOf } from "./format.js";
|
|
13
|
+
import { ThumbsDown, ThumbsUp } from "lucide-react";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* What people thought of the AI's answers: thumbs per feature this week,
|
|
17
|
+
* and each rating waiting for a look, to make into a case or dismiss.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/** Thumbs up and down, and what to do with each. Null when it doesn't exist. */
|
|
21
|
+
export async function FeedbackView({
|
|
22
|
+
app,
|
|
23
|
+
}: {
|
|
24
|
+
/** Your screens' configuration. */
|
|
25
|
+
app: EvalAppConfig;
|
|
26
|
+
}) {
|
|
27
|
+
const all = await app.feedbackStore.listFeedback();
|
|
28
|
+
const summary = thumbsSummary(all, daysAgo(7));
|
|
29
|
+
const open = all
|
|
30
|
+
.filter((f) => f.status === "OPEN")
|
|
31
|
+
.sort((a, b) => Number(b.rating === "DOWN") - Number(a.rating === "DOWN"));
|
|
32
|
+
const suiteFor = (op: string) =>
|
|
33
|
+
app.suites.find((s) => s.operation === op && !isInjectionSuite(s));
|
|
34
|
+
const label = (op: string) => suiteFor(op)?.label ?? op;
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<div className="space-y-8">
|
|
38
|
+
<div className="space-y-2">
|
|
39
|
+
<BackLink href={app.basePath}>Evals</BackLink>
|
|
40
|
+
<h1 className="text-2xl font-semibold">Feedback</h1>
|
|
41
|
+
<p className="readable text-muted">
|
|
42
|
+
Thumbs up and down from people using the product. A rating on a kept
|
|
43
|
+
input can become a draft case, so the next model is tested on the
|
|
44
|
+
answer people didn't like.
|
|
45
|
+
</p>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<section className="space-y-3">
|
|
49
|
+
<h2 className="text-lg font-semibold">
|
|
50
|
+
This week
|
|
51
|
+
<InfoTip term="thumbs" />
|
|
52
|
+
</h2>
|
|
53
|
+
{summary.length === 0 ? (
|
|
54
|
+
<p className="text-sm text-muted">No ratings this week.</p>
|
|
55
|
+
) : (
|
|
56
|
+
<Card className="overflow-x-auto p-0 lg:overflow-visible">
|
|
57
|
+
<table className="w-full text-sm">
|
|
58
|
+
<thead className="text-left text-muted">
|
|
59
|
+
<tr className="border-b border-line">
|
|
60
|
+
<th className="p-3 font-normal">Feature</th>
|
|
61
|
+
<th className="p-3 font-normal">Thumbs up</th>
|
|
62
|
+
<th className="p-3 font-normal">Thumbs down</th>
|
|
63
|
+
<th className="p-3 font-normal">Share down</th>
|
|
64
|
+
<th className="p-3 font-normal">Waiting</th>
|
|
65
|
+
</tr>
|
|
66
|
+
</thead>
|
|
67
|
+
<tbody>
|
|
68
|
+
{summary.map((s) => (
|
|
69
|
+
<tr
|
|
70
|
+
key={s.operation}
|
|
71
|
+
className="border-b border-line last:border-0"
|
|
72
|
+
>
|
|
73
|
+
<td className="p-3">
|
|
74
|
+
<span className="mr-2 font-medium">
|
|
75
|
+
{label(s.operation)}
|
|
76
|
+
</span>
|
|
77
|
+
{s.alert && (
|
|
78
|
+
<Tip
|
|
79
|
+
text="At least 5 ratings, and at least 20% of them thumbs down: worth a look."
|
|
80
|
+
id={`alert-${s.operation}`}
|
|
81
|
+
side="bottom"
|
|
82
|
+
>
|
|
83
|
+
<Chip tone="warn">Needs a look</Chip>
|
|
84
|
+
</Tip>
|
|
85
|
+
)}
|
|
86
|
+
</td>
|
|
87
|
+
<td className="p-3 tabular-nums">{s.up}</td>
|
|
88
|
+
<td className="p-3 tabular-nums">{s.down}</td>
|
|
89
|
+
<td className="p-3 tabular-nums">
|
|
90
|
+
{s.downShare === null ? "—" : pct(s.downShare)}
|
|
91
|
+
</td>
|
|
92
|
+
<td className="p-3 tabular-nums">{s.open}</td>
|
|
93
|
+
</tr>
|
|
94
|
+
))}
|
|
95
|
+
</tbody>
|
|
96
|
+
</table>
|
|
97
|
+
</Card>
|
|
98
|
+
)}
|
|
99
|
+
</section>
|
|
100
|
+
|
|
101
|
+
<section className="space-y-3">
|
|
102
|
+
<h2 className="text-lg font-semibold">
|
|
103
|
+
Waiting for a look ({open.length})
|
|
104
|
+
</h2>
|
|
105
|
+
{open.length === 0 && (
|
|
106
|
+
<p className="text-sm text-muted">
|
|
107
|
+
Nothing waiting. Ratings show up here once an AI feature has a
|
|
108
|
+
thumbs up and down (step 8 of{" "}
|
|
109
|
+
<a
|
|
110
|
+
href="https://seanhudson.github.io/evalkeeper/guides/thumbs/#set-it-up"
|
|
111
|
+
target="_blank"
|
|
112
|
+
rel="noreferrer"
|
|
113
|
+
className="underline"
|
|
114
|
+
>
|
|
115
|
+
the guide
|
|
116
|
+
</a>
|
|
117
|
+
).
|
|
118
|
+
</p>
|
|
119
|
+
)}
|
|
120
|
+
<div className="space-y-3">
|
|
121
|
+
{open.map((f) => (
|
|
122
|
+
<Rating
|
|
123
|
+
app={app}
|
|
124
|
+
key={f.id}
|
|
125
|
+
fields={suiteFor(f.operation)?.fields}
|
|
126
|
+
f={f}
|
|
127
|
+
feature={label(f.operation)}
|
|
128
|
+
why={whyNotACase(f, suiteFor(f.operation))}
|
|
129
|
+
/>
|
|
130
|
+
))}
|
|
131
|
+
</div>
|
|
132
|
+
</section>
|
|
133
|
+
</div>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function Rating({
|
|
138
|
+
app,
|
|
139
|
+
f,
|
|
140
|
+
fields,
|
|
141
|
+
feature,
|
|
142
|
+
why,
|
|
143
|
+
}: {
|
|
144
|
+
app: EvalAppConfig;
|
|
145
|
+
f: FeedbackRecord;
|
|
146
|
+
fields: AnySuite["fields"];
|
|
147
|
+
feature: string;
|
|
148
|
+
why: string | null;
|
|
149
|
+
}) {
|
|
150
|
+
return (
|
|
151
|
+
<article
|
|
152
|
+
aria-label={`Rating: ${feature}${f.reason ? `, ${f.reason}` : ""}`}
|
|
153
|
+
>
|
|
154
|
+
<Card className="space-y-3 text-sm">
|
|
155
|
+
<div className="flex flex-wrap items-center justify-between gap-2">
|
|
156
|
+
<span className="flex items-center gap-2">
|
|
157
|
+
<Chip tone={f.rating === "DOWN" ? "serious" : "live"}>
|
|
158
|
+
{f.rating === "DOWN" ? (
|
|
159
|
+
<>
|
|
160
|
+
<ThumbsDown aria-hidden className="h-3.5 w-3.5" /> Thumbs down
|
|
161
|
+
</>
|
|
162
|
+
) : (
|
|
163
|
+
<>
|
|
164
|
+
<ThumbsUp aria-hidden className="h-3.5 w-3.5" /> Thumbs up
|
|
165
|
+
</>
|
|
166
|
+
)}
|
|
167
|
+
</Chip>
|
|
168
|
+
<span className="font-medium">{feature}</span>
|
|
169
|
+
</span>
|
|
170
|
+
<span className="text-xs text-muted">{momentOf(f.updatedAt)}</span>
|
|
171
|
+
</div>
|
|
172
|
+
{f.reason && <p className="readable">“{f.reason}”</p>}
|
|
173
|
+
<div className="grid gap-4 md:grid-cols-2">
|
|
174
|
+
<div className="space-y-1">
|
|
175
|
+
<p className="text-xs font-semibold uppercase tracking-wide text-muted">
|
|
176
|
+
Input
|
|
177
|
+
</p>
|
|
178
|
+
{f.input === null ? (
|
|
179
|
+
<p className="text-muted">Not kept</p>
|
|
180
|
+
) : fields ? (
|
|
181
|
+
<FieldValues
|
|
182
|
+
fields={fields.input}
|
|
183
|
+
values={f.input}
|
|
184
|
+
prefix={`${f.id}-in-`}
|
|
185
|
+
/>
|
|
186
|
+
) : (
|
|
187
|
+
<p className="whitespace-pre-wrap font-mono text-xs">
|
|
188
|
+
{asText(f.input)}
|
|
189
|
+
</p>
|
|
190
|
+
)}
|
|
191
|
+
</div>
|
|
192
|
+
<div className="space-y-1">
|
|
193
|
+
<p className="text-xs font-semibold uppercase tracking-wide text-muted">
|
|
194
|
+
Answer
|
|
195
|
+
</p>
|
|
196
|
+
{fields && f.output !== null ? (
|
|
197
|
+
<FieldValues
|
|
198
|
+
fields={fields.label}
|
|
199
|
+
values={f.output}
|
|
200
|
+
prefix={`${f.id}-out-`}
|
|
201
|
+
/>
|
|
202
|
+
) : (
|
|
203
|
+
<p className="whitespace-pre-wrap font-mono text-xs">
|
|
204
|
+
{asText(f.output) || f.excerpt || "—"}
|
|
205
|
+
</p>
|
|
206
|
+
)}
|
|
207
|
+
</div>
|
|
208
|
+
</div>
|
|
209
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
210
|
+
{why === null ? (
|
|
211
|
+
<form
|
|
212
|
+
action={app.actions.makeCase}
|
|
213
|
+
className="flex items-center gap-1"
|
|
214
|
+
>
|
|
215
|
+
<input type="hidden" name="feedback" value={f.id} />
|
|
216
|
+
<Submit>Make a case</Submit>
|
|
217
|
+
<InfoTip term="makeCase" id={`make-${f.id}`} />
|
|
218
|
+
</form>
|
|
219
|
+
) : (
|
|
220
|
+
<p className="readable text-xs text-muted">{why}</p>
|
|
221
|
+
)}
|
|
222
|
+
<form action={app.actions.dismissFeedback}>
|
|
223
|
+
<input type="hidden" name="feedback" value={f.id} />
|
|
224
|
+
<Submit variant="quiet">Dismiss</Submit>
|
|
225
|
+
</form>
|
|
226
|
+
</div>
|
|
227
|
+
</Card>
|
|
228
|
+
</article>
|
|
229
|
+
);
|
|
230
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { InfoTip, Select, TextArea, TextInput } from "./pieces.js";
|
|
1
2
|
import {
|
|
2
3
|
ANSWER_JSON_FIELD,
|
|
3
4
|
asText,
|
|
4
5
|
fieldValue,
|
|
5
6
|
type AnswerEditorProps,
|
|
6
7
|
type FormField,
|
|
7
|
-
} from "
|
|
8
|
-
import { InfoTip } from "./Tip";
|
|
8
|
+
} from "../index.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* A suite's form fields, rendered from its field specs: label, input, and
|
|
@@ -34,7 +34,7 @@ export function Fields({
|
|
|
34
34
|
{f.label}
|
|
35
35
|
</label>
|
|
36
36
|
{f.kind === "select" ? (
|
|
37
|
-
<
|
|
37
|
+
<Select
|
|
38
38
|
id={id}
|
|
39
39
|
name={f.name}
|
|
40
40
|
defaultValue={value || f.options?.[0]}
|
|
@@ -45,9 +45,9 @@ export function Fields({
|
|
|
45
45
|
{o.replace(/_/g, " ")}
|
|
46
46
|
</option>
|
|
47
47
|
))}
|
|
48
|
-
</
|
|
48
|
+
</Select>
|
|
49
49
|
) : f.kind === "text" ? (
|
|
50
|
-
<
|
|
50
|
+
<TextInput
|
|
51
51
|
id={id}
|
|
52
52
|
name={f.name}
|
|
53
53
|
defaultValue={value}
|
|
@@ -55,7 +55,7 @@ export function Fields({
|
|
|
55
55
|
className={box}
|
|
56
56
|
/>
|
|
57
57
|
) : (
|
|
58
|
-
<
|
|
58
|
+
<TextArea
|
|
59
59
|
id={id}
|
|
60
60
|
name={f.name}
|
|
61
61
|
defaultValue={value}
|