@crowandraven/evalkeeper 0.13.0 → 0.15.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/InfoPopover.d.ts +19 -0
- package/dist/react/InfoPopover.js +46 -0
- package/dist/react/InfoPopover.js.map +1 -0
- package/dist/react/PriorityPicker.d.ts +21 -0
- package/dist/react/PriorityPicker.js +33 -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.d.ts +2 -1
- package/dist/react/SettingsHistory.js +34 -26
- package/dist/react/SettingsHistory.js.map +1 -1
- package/dist/react/ShowEarlier.d.ts +11 -0
- package/dist/react/ShowEarlier.js +19 -0
- package/dist/react/ShowEarlier.js.map +1 -0
- package/dist/react/SuiteSections.d.ts +10 -8
- package/dist/react/SuiteSections.js +99 -55
- 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 +12 -3
- package/dist/runner.js.map +1 -1
- package/dist/suggest.js +25 -7
- package/dist/suggest.js.map +1 -1
- package/dist/types.d.ts +2 -1
- package/dist/types.js.map +1 -1
- package/dist/weekly.js +4 -2
- package/dist/weekly.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/InfoPopover.tsx +100 -0
- package/src/react/PriorityPicker.tsx +122 -0
- package/src/react/RunView.tsx +41 -6
- package/src/react/SettingsHistory.tsx +114 -76
- package/src/react/ShowEarlier.tsx +57 -0
- package/src/react/SuiteSections.tsx +318 -260
- package/src/react/WeeklyCheck.tsx +26 -9
- 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 +18 -5
- package/src/suggest.ts +26 -7
- package/src/types.ts +2 -1
- package/src/weekly.ts +7 -2
- package/templates/lib/evalkeeper/actions.ts +4 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FAVOR_TEXT,
|
|
3
|
+
allPassed,
|
|
3
4
|
answerKeyHealth,
|
|
4
5
|
attacksFrom,
|
|
5
6
|
barStatus,
|
|
6
7
|
checkBar,
|
|
7
8
|
draftAnswers,
|
|
8
|
-
draftsToTarget,
|
|
9
9
|
newStarters,
|
|
10
10
|
orderRows,
|
|
11
11
|
pctBeside,
|
|
@@ -24,6 +24,10 @@ import {
|
|
|
24
24
|
} from "../index.js";
|
|
25
25
|
import { AnswerKey } from "./AnswerKey.js";
|
|
26
26
|
import { ModelMenu } from "./ModelMenu.js";
|
|
27
|
+
import { PriorityPicker } from "./PriorityPicker.js";
|
|
28
|
+
import { InfoPopover } from "./InfoPopover.js";
|
|
29
|
+
import { GLOSSARY } from "../glossary.js";
|
|
30
|
+
import type { AnswerGuide } from "../types.js";
|
|
27
31
|
import { Tabs } from "./Tabs.js";
|
|
28
32
|
import {
|
|
29
33
|
Link,
|
|
@@ -37,17 +41,11 @@ import {
|
|
|
37
41
|
Select,
|
|
38
42
|
Spinner,
|
|
39
43
|
Submit,
|
|
40
|
-
TextInput,
|
|
41
44
|
Tip,
|
|
42
45
|
} from "./pieces.js";
|
|
43
|
-
import { pct, LINK } from "./format.js";
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
evalsPath,
|
|
47
|
-
type EvalAppConfig,
|
|
48
|
-
type FormAction,
|
|
49
|
-
attacksResisted,
|
|
50
|
-
} from "./app.js";
|
|
46
|
+
import { pct, LINK, QUIET_BUTTON } from "./format.js";
|
|
47
|
+
import { Plus, RotateCw, ShieldAlert, Sparkles } from "lucide-react";
|
|
48
|
+
import { evalsPath, type EvalAppConfig, attacksResisted } from "./app.js";
|
|
51
49
|
import { SettingsHistory } from "./SettingsHistory.js";
|
|
52
50
|
|
|
53
51
|
/**
|
|
@@ -86,12 +84,14 @@ export async function loadSuitePage(app: EvalAppConfig, key: string) {
|
|
|
86
84
|
const choosesHere = !isInjectionSuite(suite);
|
|
87
85
|
// The suite's priority, or the one an admin chose in its settings.
|
|
88
86
|
const priority = priorityOf(suite, liveSettings.settings);
|
|
89
|
-
const s = choosesHere
|
|
90
|
-
? suggest(rows, suite.checks, priority, app.models, { attacks })
|
|
91
|
-
: null;
|
|
92
87
|
const testing =
|
|
93
88
|
rows.some((r) => r.testing) ||
|
|
94
89
|
attackBoards.some((a) => a.rows.some((r) => r.testing));
|
|
90
|
+
// No suggestion while a test runs: it would weigh half a board.
|
|
91
|
+
const s =
|
|
92
|
+
choosesHere && !testing
|
|
93
|
+
? suggest(rows, suite.checks, priority, app.models, { attacks })
|
|
94
|
+
: null;
|
|
95
95
|
// What testing each model would cost now, attack cases included,
|
|
96
96
|
// counting answers it would reuse.
|
|
97
97
|
const estimates = new Map(
|
|
@@ -112,7 +112,30 @@ export async function loadSuitePage(app: EvalAppConfig, key: string) {
|
|
|
112
112
|
const showAttacks = attackBoards.some((a) => a.cases > 0);
|
|
113
113
|
const live = rows.find((r) => r.live);
|
|
114
114
|
// What would keep the answer key useful, from the same tests.
|
|
115
|
-
const
|
|
115
|
+
const current = rows.filter((r) => r.test && !r.test.stale && !r.baseline);
|
|
116
|
+
const testedAt = current.reduce<Date | null>(
|
|
117
|
+
(m, r) => (r.test && (!m || r.test.at > m) ? r.test.at : m),
|
|
118
|
+
null,
|
|
119
|
+
);
|
|
120
|
+
const health = answerKeyHealth(cases, b.caseResults, new Date(), testedAt);
|
|
121
|
+
// For each split case, which models got it fully right and which didn't,
|
|
122
|
+
// so a person sees the disagreement before deciding.
|
|
123
|
+
const split = new Set(health.split.map((c) => c.id));
|
|
124
|
+
const splitBy: Record<string, { right: string[]; wrong: string[] }> = {};
|
|
125
|
+
if (split.size)
|
|
126
|
+
await Promise.all(
|
|
127
|
+
current
|
|
128
|
+
.filter((r) => !r.variant)
|
|
129
|
+
.map(async (r) => {
|
|
130
|
+
if (!r.test) return;
|
|
131
|
+
for (const o of await app.store.listOutputs(r.test.runId)) {
|
|
132
|
+
if (!split.has(o.caseId) || o.error) continue;
|
|
133
|
+
const side = allPassed(o.scores) ? "right" : "wrong";
|
|
134
|
+
const entry = (splitBy[o.caseId] ??= { right: [], wrong: [] });
|
|
135
|
+
if (!entry[side].includes(r.label)) entry[side].push(r.label);
|
|
136
|
+
}
|
|
137
|
+
}),
|
|
138
|
+
);
|
|
116
139
|
|
|
117
140
|
return {
|
|
118
141
|
app,
|
|
@@ -135,6 +158,7 @@ export async function loadSuitePage(app: EvalAppConfig, key: string) {
|
|
|
135
158
|
health,
|
|
136
159
|
cases,
|
|
137
160
|
priority,
|
|
161
|
+
splitBy,
|
|
138
162
|
};
|
|
139
163
|
}
|
|
140
164
|
|
|
@@ -146,12 +170,14 @@ export type SuitePageData = NonNullable<
|
|
|
146
170
|
/** A share as a whole percent, or a dash when there's nothing to show. */
|
|
147
171
|
const asPct = (x: number | null) => (x === null ? "—" : pct(x));
|
|
148
172
|
|
|
149
|
-
/**
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
173
|
+
/**
|
|
174
|
+
* What a priority means for the suggestion, as a sentence: the
|
|
175
|
+
* explanation without its leading name ("cost: this runs…").
|
|
176
|
+
*/
|
|
177
|
+
const whyFavor = (favor: SuitePriority["favor"]) => {
|
|
178
|
+
const text = FAVOR_TEXT[favor].replace(/^\w+: /, "");
|
|
179
|
+
return `${text.charAt(0).toUpperCase()}${text.slice(1)}.`;
|
|
180
|
+
};
|
|
155
181
|
|
|
156
182
|
/** The suite's priority, as the page names it. */
|
|
157
183
|
const FAVORS = { cost: "cost", speed: "speed", quality: "accuracy" } as const;
|
|
@@ -165,17 +191,13 @@ const VS: Record<string, string> = {
|
|
|
165
191
|
|
|
166
192
|
/** The suite's name, what it tests, and its priority. */
|
|
167
193
|
export function SuiteHeader({ data }: { data: SuitePageData }) {
|
|
168
|
-
const { app, suite
|
|
194
|
+
const { app, suite } = data;
|
|
169
195
|
return (
|
|
170
196
|
<>
|
|
171
197
|
<div className="space-y-2">
|
|
172
198
|
<BackLink href={app.basePath}>Evals</BackLink>
|
|
173
199
|
<h1 className="text-2xl font-semibold">{suite.label}</h1>
|
|
174
200
|
<p className="readable text-muted">{suite.description}</p>
|
|
175
|
-
<p className="readable text-sm text-muted">
|
|
176
|
-
Priority: {FAVOR_TEXT[priority.favor]}.
|
|
177
|
-
<InfoTip term="priority" />
|
|
178
|
-
</p>
|
|
179
201
|
</div>
|
|
180
202
|
</>
|
|
181
203
|
);
|
|
@@ -212,15 +234,31 @@ export function ChosenOnBase({ data }: { data: SuitePageData }) {
|
|
|
212
234
|
|
|
213
235
|
/** Which models to make live and the fallback, and why; shown when nothing would change too. */
|
|
214
236
|
export function SuggestionCard({ data }: { data: SuitePageData }) {
|
|
215
|
-
const { app, key, s } = data;
|
|
237
|
+
const { app, key, s, choosesHere, testing } = data;
|
|
238
|
+
if (choosesHere && testing)
|
|
239
|
+
return (
|
|
240
|
+
<section className="space-y-3" aria-labelledby="suggestion">
|
|
241
|
+
<h2 id="suggestion" className="text-lg font-semibold">
|
|
242
|
+
Suggested
|
|
243
|
+
<InfoTip term="suggestion" />
|
|
244
|
+
</h2>
|
|
245
|
+
<Card>
|
|
246
|
+
<p className="readable text-sm text-muted">
|
|
247
|
+
Waiting for the tests running now to finish. The suggestion weighs
|
|
248
|
+
every model's finished test, so it follows then.
|
|
249
|
+
</p>
|
|
250
|
+
</Card>
|
|
251
|
+
</section>
|
|
252
|
+
);
|
|
216
253
|
return (
|
|
217
254
|
<>
|
|
218
255
|
{/* Shown when nothing would change too, so a higher score that
|
|
219
|
-
isn't enough to switch for comes with its reason.
|
|
256
|
+
isn't enough to switch for comes with its reason. A section like
|
|
257
|
+
Models: the heading outside, Use these beside it. */}
|
|
220
258
|
{s && (
|
|
221
|
-
<
|
|
222
|
-
<div className="flex
|
|
223
|
-
<h2 className="font-semibold">
|
|
259
|
+
<section className="space-y-3" aria-labelledby="suggestion">
|
|
260
|
+
<div className="flex items-center justify-between gap-4">
|
|
261
|
+
<h2 id="suggestion" className="text-lg font-semibold">
|
|
224
262
|
{s.same ? "No change suggested" : "Suggested"}
|
|
225
263
|
<InfoTip term="suggestion" />
|
|
226
264
|
</h2>
|
|
@@ -233,23 +271,25 @@ export function SuggestionCard({ data }: { data: SuitePageData }) {
|
|
|
233
271
|
</form>
|
|
234
272
|
)}
|
|
235
273
|
</div>
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
274
|
+
<Card className="space-y-3">
|
|
275
|
+
{!s.same && (
|
|
276
|
+
<p>
|
|
277
|
+
Live: <strong>{s.live.label}</strong>
|
|
278
|
+
{s.fallback && (
|
|
279
|
+
<>
|
|
280
|
+
{" "}
|
|
281
|
+
· Fallback: <strong>{s.fallback.label}</strong>
|
|
282
|
+
</>
|
|
283
|
+
)}
|
|
284
|
+
</p>
|
|
285
|
+
)}
|
|
286
|
+
<ul className="readable list-disc space-y-1 pl-5 text-sm text-muted">
|
|
287
|
+
{s.reasons.map((r) => (
|
|
288
|
+
<li key={r}>{r}</li>
|
|
289
|
+
))}
|
|
290
|
+
</ul>
|
|
291
|
+
</Card>
|
|
292
|
+
</section>
|
|
253
293
|
)}
|
|
254
294
|
</>
|
|
255
295
|
);
|
|
@@ -305,22 +345,28 @@ export function ModelTable({ data }: { data: SuitePageData }) {
|
|
|
305
345
|
const ordered = orderRows(rows, suite.checks, priority, {
|
|
306
346
|
live: suggestedLive,
|
|
307
347
|
});
|
|
348
|
+
const tunable = tunableModels(data);
|
|
349
|
+
const columns = 7 + (showAttacks ? 1 : 0) + (suite.decisions ? 2 : 0);
|
|
308
350
|
return (
|
|
309
351
|
<>
|
|
310
352
|
<section className="space-y-3">
|
|
311
353
|
<div className="flex items-center justify-between gap-4">
|
|
312
354
|
<div className="flex flex-wrap items-center gap-2">
|
|
313
355
|
<h2 className="text-lg font-semibold">Models</h2>
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
{choosesHere && app.actions.setPriority && (
|
|
318
|
-
<PriorityControl
|
|
356
|
+
{/* Why this priority, in its words: the page says it once. */}
|
|
357
|
+
{choosesHere && app.actions.setPriority ? (
|
|
358
|
+
<PriorityPicker
|
|
319
359
|
action={app.actions.setPriority}
|
|
320
360
|
suite={key}
|
|
321
361
|
favor={priority.favor}
|
|
322
362
|
own={suite.priority.favor}
|
|
363
|
+
label={`Favors ${FAVORS[priority.favor]}`}
|
|
364
|
+
why={whyFavor(priority.favor)}
|
|
323
365
|
/>
|
|
366
|
+
) : (
|
|
367
|
+
<Tip text={whyFavor(priority.favor)} side="bottom" id="favors">
|
|
368
|
+
<Chip tone="neutral">Favors {FAVORS[priority.favor]}</Chip>
|
|
369
|
+
</Tip>
|
|
324
370
|
)}
|
|
325
371
|
</div>
|
|
326
372
|
<div className="flex items-center gap-4">
|
|
@@ -476,11 +522,14 @@ export function ModelTable({ data }: { data: SuitePageData }) {
|
|
|
476
522
|
<Score right={r.test.right} total={r.test.total} />
|
|
477
523
|
</Link>
|
|
478
524
|
{!r.test.stale && r.test.failedAnswers > 0 && (
|
|
479
|
-
<
|
|
525
|
+
<Link
|
|
526
|
+
href={`${evalsPath(app, key, "runs", r.test.runId)}#failed`}
|
|
527
|
+
className="text-xs text-muted hover:underline"
|
|
528
|
+
>
|
|
480
529
|
{r.test.failedAnswers}{" "}
|
|
481
530
|
{r.test.failedAnswers === 1 ? "answer" : "answers"}{" "}
|
|
482
|
-
failed:
|
|
483
|
-
</
|
|
531
|
+
failed: see why
|
|
532
|
+
</Link>
|
|
484
533
|
)}
|
|
485
534
|
</div>
|
|
486
535
|
) : (
|
|
@@ -573,6 +622,15 @@ export function ModelTable({ data }: { data: SuitePageData }) {
|
|
|
573
622
|
</tr>
|
|
574
623
|
))}
|
|
575
624
|
</tbody>
|
|
625
|
+
{tunable.length > 0 && (
|
|
626
|
+
<tfoot>
|
|
627
|
+
<tr>
|
|
628
|
+
<td colSpan={columns} className="p-2">
|
|
629
|
+
<TestSettingForm data={data} tunable={tunable} />
|
|
630
|
+
</td>
|
|
631
|
+
</tr>
|
|
632
|
+
</tfoot>
|
|
633
|
+
)}
|
|
576
634
|
</table>
|
|
577
635
|
</Card>
|
|
578
636
|
</section>
|
|
@@ -581,52 +639,71 @@ export function ModelTable({ data }: { data: SuitePageData }) {
|
|
|
581
639
|
}
|
|
582
640
|
|
|
583
641
|
/**
|
|
584
|
-
*
|
|
585
|
-
*
|
|
586
|
-
* gets its own row in the model table. Shows only when a model the feature
|
|
587
|
-
* may use lists its settings in your catalog.
|
|
642
|
+
* The models a feature may use that list reasoning settings in your
|
|
643
|
+
* catalog, each with its settings; empty when there's nothing to test.
|
|
588
644
|
*/
|
|
589
|
-
|
|
590
|
-
const { app,
|
|
591
|
-
|
|
645
|
+
function tunableModels(data: SuitePageData) {
|
|
646
|
+
const { app, operation, choosesHere } = data;
|
|
647
|
+
if (!choosesHere) return [];
|
|
648
|
+
return app.runner.modelsFor(operation).flatMap((m) => {
|
|
592
649
|
const efforts = app.models[m]?.efforts;
|
|
593
650
|
return efforts?.length
|
|
594
651
|
? [{ model: m, label: app.models[m]?.label ?? m, efforts }]
|
|
595
652
|
: [];
|
|
596
653
|
});
|
|
597
|
-
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
/**
|
|
657
|
+
* Testing a model at a reasoning setting other than the feature's: less
|
|
658
|
+
* reasoning is faster and cheaper, more can be more accurate. Each setting
|
|
659
|
+
* gets its own row in the model table. The table's last row, inset.
|
|
660
|
+
*/
|
|
661
|
+
function TestSettingForm({
|
|
662
|
+
data,
|
|
663
|
+
tunable,
|
|
664
|
+
}: {
|
|
665
|
+
data: SuitePageData;
|
|
666
|
+
tunable: ReturnType<typeof tunableModels>;
|
|
667
|
+
}) {
|
|
668
|
+
const { app, key } = data;
|
|
598
669
|
return (
|
|
599
670
|
<form
|
|
600
671
|
action={app.actions.testModel}
|
|
601
|
-
className="flex flex-wrap items-
|
|
672
|
+
className="flex flex-wrap items-center gap-x-3 gap-y-2 rounded-md bg-tint px-3 py-2.5"
|
|
602
673
|
>
|
|
603
674
|
<input type="hidden" name="suite" value={key} />
|
|
604
|
-
<
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
{
|
|
615
|
-
|
|
616
|
-
{t.
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
</Select>
|
|
624
|
-
</div>
|
|
675
|
+
<label htmlFor="test-setting" className="text-sm font-medium">
|
|
676
|
+
Test a reasoning setting
|
|
677
|
+
<InfoTip term="reasoningSetting" id="test-setting" />
|
|
678
|
+
</label>
|
|
679
|
+
<Select
|
|
680
|
+
id="test-setting"
|
|
681
|
+
name="setting"
|
|
682
|
+
className="rounded-md border border-line bg-card px-3 py-1.5 text-sm"
|
|
683
|
+
>
|
|
684
|
+
{tunable.map((t) => (
|
|
685
|
+
<optgroup key={t.model} label={t.label}>
|
|
686
|
+
{t.efforts.map((e) => (
|
|
687
|
+
<option key={e} value={JSON.stringify([t.model, e])}>
|
|
688
|
+
{t.label} · {e} reasoning
|
|
689
|
+
</option>
|
|
690
|
+
))}
|
|
691
|
+
</optgroup>
|
|
692
|
+
))}
|
|
693
|
+
</Select>
|
|
625
694
|
<Submit variant="quiet">Test this setting</Submit>
|
|
626
695
|
</form>
|
|
627
696
|
);
|
|
628
697
|
}
|
|
629
698
|
|
|
699
|
+
/**
|
|
700
|
+
* @deprecated The model table's last row holds this now; it renders
|
|
701
|
+
* nothing. Remove it from your page.
|
|
702
|
+
*/
|
|
703
|
+
export function TestSettingSection(_props: { data: SuitePageData }) {
|
|
704
|
+
return null;
|
|
705
|
+
}
|
|
706
|
+
|
|
630
707
|
const BAR_TONE = {
|
|
631
708
|
meets:
|
|
632
709
|
"bg-emerald-100 text-emerald-900 dark:bg-emerald-500/15 dark:text-emerald-200",
|
|
@@ -809,8 +886,8 @@ export function ChecksSection({ data }: { data: SuitePageData }) {
|
|
|
809
886
|
}
|
|
810
887
|
|
|
811
888
|
/**
|
|
812
|
-
* Ways to fill the answer key, beside adding a case by hand:
|
|
813
|
-
*
|
|
889
|
+
* Ways to fill the answer key, beside adding a case by hand: testing with
|
|
890
|
+
* draft answers before review, an injection
|
|
814
891
|
* suite's attack cases, starter cases not added yet, and more drafts from
|
|
815
892
|
* the suite's `draftMore`. Each shows only when it applies and your app
|
|
816
893
|
* passes its action.
|
|
@@ -821,42 +898,8 @@ export function AnswerKeyToolsSection({ data }: { data: SuitePageData }) {
|
|
|
821
898
|
const inUse = cases.filter((c) => c.status !== "RETIRED");
|
|
822
899
|
const drafts = draftAnswers(cases);
|
|
823
900
|
const fresh = newStarters(suite.starter, cases);
|
|
824
|
-
const guide =
|
|
825
|
-
suite.answerGuide ??
|
|
826
|
-
(suite.labelHelp ? { points: [{ text: suite.labelHelp }] } : null);
|
|
827
901
|
const injection = isInjectionSuite(suite) ? suite : null;
|
|
828
902
|
const parts = [
|
|
829
|
-
guide && (
|
|
830
|
-
<details
|
|
831
|
-
key="guide"
|
|
832
|
-
className="group rounded-lg border border-line bg-card"
|
|
833
|
-
>
|
|
834
|
-
<summary className="flex cursor-pointer list-none items-center justify-between gap-3 p-4 text-sm font-medium">
|
|
835
|
-
How to judge an answer
|
|
836
|
-
<ChevronDown
|
|
837
|
-
aria-hidden
|
|
838
|
-
className="h-4 w-4 transition-transform group-open:rotate-180"
|
|
839
|
-
/>
|
|
840
|
-
</summary>
|
|
841
|
-
<div className="readable space-y-2 px-4 pb-4 text-sm">
|
|
842
|
-
{guide.lead && <p className="font-medium">{guide.lead}</p>}
|
|
843
|
-
{(() => {
|
|
844
|
-
const items = guide.points.map((p, n) => (
|
|
845
|
-
<li key={n}>
|
|
846
|
-
{p.term && <strong>{p.term} </strong>}
|
|
847
|
-
{p.text}
|
|
848
|
-
</li>
|
|
849
|
-
));
|
|
850
|
-
return guide.ordered ? (
|
|
851
|
-
<ol className="list-decimal space-y-1 pl-5">{items}</ol>
|
|
852
|
-
) : (
|
|
853
|
-
<ul className="list-disc space-y-1 pl-5">{items}</ul>
|
|
854
|
-
);
|
|
855
|
-
})()}
|
|
856
|
-
{guide.note && <p className="text-muted">{guide.note}</p>}
|
|
857
|
-
</div>
|
|
858
|
-
</details>
|
|
859
|
-
),
|
|
860
903
|
actions.useDraftsProvisionally && drafts.length > 0 && (
|
|
861
904
|
<Card key="provisional" className="space-y-3">
|
|
862
905
|
<p className="readable text-sm">
|
|
@@ -907,63 +950,63 @@ export function AnswerKeyToolsSection({ data }: { data: SuitePageData }) {
|
|
|
907
950
|
</form>
|
|
908
951
|
</Card>
|
|
909
952
|
),
|
|
910
|
-
actions.draftMore && suite.draftMore && inUse.length > 0 && (
|
|
911
|
-
<details
|
|
912
|
-
key="draft"
|
|
913
|
-
className="group rounded-lg border border-line bg-card"
|
|
914
|
-
>
|
|
915
|
-
<summary className="flex cursor-pointer list-none items-center justify-between gap-3 p-4 text-sm font-medium">
|
|
916
|
-
<span className="flex items-center gap-1.5">
|
|
917
|
-
<Sparkles aria-hidden className="h-4 w-4" />
|
|
918
|
-
Draft {draftsToTarget(inUse.length)} more cases
|
|
919
|
-
</span>
|
|
920
|
-
<ChevronDown
|
|
921
|
-
aria-hidden
|
|
922
|
-
className="h-4 w-4 transition-transform group-open:rotate-180"
|
|
923
|
-
/>
|
|
924
|
-
</summary>
|
|
925
|
-
<form action={actions.draftMore} className="space-y-3 px-4 pb-4">
|
|
926
|
-
<input type="hidden" name="suite" value={key} />
|
|
927
|
-
<div>
|
|
928
|
-
<label htmlFor="draft-focus" className="block text-sm font-medium">
|
|
929
|
-
Anything to focus on? (optional)
|
|
930
|
-
</label>
|
|
931
|
-
<TextInput
|
|
932
|
-
id="draft-focus"
|
|
933
|
-
name="focus"
|
|
934
|
-
maxLength={500}
|
|
935
|
-
placeholder="e.g. longer, messier notes; more than one owner"
|
|
936
|
-
className="mt-1 w-full rounded-md border border-line bg-card px-3 py-2 text-sm"
|
|
937
|
-
/>
|
|
938
|
-
<p className="readable mt-1 text-xs text-muted">
|
|
939
|
-
A model looks at the cases you have and covers what's
|
|
940
|
-
missing. Drafts need your review and count only once you confirm
|
|
941
|
-
them.
|
|
942
|
-
</p>
|
|
943
|
-
</div>
|
|
944
|
-
<Submit>Draft cases</Submit>
|
|
945
|
-
</form>
|
|
946
|
-
</details>
|
|
947
|
-
),
|
|
948
953
|
].filter(Boolean);
|
|
949
954
|
if (!parts.length) return null;
|
|
950
955
|
return <div className="space-y-3">{parts}</div>;
|
|
951
956
|
}
|
|
957
|
+
/** A suite's answer guide: its lead-in, points (numbered when in order), and note. */
|
|
958
|
+
function AnswerGuideText({ guide }: { guide: AnswerGuide }) {
|
|
959
|
+
const items = guide.points.map((p, n) => (
|
|
960
|
+
<li key={n}>
|
|
961
|
+
{p.term && <strong>{p.term} </strong>}
|
|
962
|
+
{p.text}
|
|
963
|
+
</li>
|
|
964
|
+
));
|
|
965
|
+
return (
|
|
966
|
+
<div className="space-y-2">
|
|
967
|
+
{guide.lead && <p>{guide.lead}</p>}
|
|
968
|
+
{guide.ordered ? (
|
|
969
|
+
<ol className="list-decimal space-y-1 pl-5">{items}</ol>
|
|
970
|
+
) : (
|
|
971
|
+
<ul className="list-disc space-y-1 pl-5">{items}</ul>
|
|
972
|
+
)}
|
|
973
|
+
{guide.note && <p className="text-muted">{guide.note}</p>}
|
|
974
|
+
</div>
|
|
975
|
+
);
|
|
976
|
+
}
|
|
977
|
+
|
|
952
978
|
/** The answer key: the cases in use and their answers, with ways to add and rate them. */
|
|
953
979
|
export function AnswerKeySection({ data }: { data: SuitePageData }) {
|
|
954
980
|
const { app, key, b, suite, rows, attackBoards } = data;
|
|
955
981
|
// A feature's attack cases are a tab of its answer key.
|
|
956
982
|
const attacked = attackBoards.filter((a) => a.cases > 0);
|
|
983
|
+
const guide =
|
|
984
|
+
suite.answerGuide ??
|
|
985
|
+
(suite.labelHelp ? { points: [{ text: suite.labelHelp }] } : null);
|
|
957
986
|
const cases = (
|
|
958
987
|
<AnswerKey
|
|
959
988
|
app={app}
|
|
960
989
|
suite={suite}
|
|
961
990
|
rows={rows}
|
|
962
991
|
heading={
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
<
|
|
966
|
-
|
|
992
|
+
guide ? (
|
|
993
|
+
// The guide's list can't sit inside the heading; its button sits beside it.
|
|
994
|
+
<div className="flex items-center">
|
|
995
|
+
<h2 className="text-lg font-semibold">
|
|
996
|
+
Answer key ({b.cases} cases in use)
|
|
997
|
+
</h2>
|
|
998
|
+
<InfoPopover label="About the answer key">
|
|
999
|
+
<p className="text-muted">{GLOSSARY.answerKey}</p>
|
|
1000
|
+
<p className="font-medium">How to judge an answer</p>
|
|
1001
|
+
<AnswerGuideText guide={guide} />
|
|
1002
|
+
</InfoPopover>
|
|
1003
|
+
</div>
|
|
1004
|
+
) : (
|
|
1005
|
+
<h2 className="text-lg font-semibold">
|
|
1006
|
+
Answer key ({b.cases} cases in use)
|
|
1007
|
+
<InfoTip term="answerKey" />
|
|
1008
|
+
</h2>
|
|
1009
|
+
)
|
|
967
1010
|
}
|
|
968
1011
|
tools={
|
|
969
1012
|
<>
|
|
@@ -1049,69 +1092,6 @@ export function AnswerKeySection({ data }: { data: SuitePageData }) {
|
|
|
1049
1092
|
);
|
|
1050
1093
|
}
|
|
1051
1094
|
|
|
1052
|
-
/** "Free: all 16 reused" or "~$0.03, 4 of 16 reused", under a model's buttons. */
|
|
1053
|
-
/**
|
|
1054
|
-
* Changing what a feature's suggestion favors: accuracy, speed, or cost.
|
|
1055
|
-
* It's saved as a new settings version, with an optional reason, so it
|
|
1056
|
-
* shows under Versions and can be rolled back.
|
|
1057
|
-
*/
|
|
1058
|
-
function PriorityControl({
|
|
1059
|
-
action,
|
|
1060
|
-
suite,
|
|
1061
|
-
favor,
|
|
1062
|
-
own,
|
|
1063
|
-
}: {
|
|
1064
|
-
action: FormAction;
|
|
1065
|
-
suite: string;
|
|
1066
|
-
favor: SuitePriority["favor"];
|
|
1067
|
-
/** The suite's own priority, from its code. */
|
|
1068
|
-
own: SuitePriority["favor"];
|
|
1069
|
-
}) {
|
|
1070
|
-
return (
|
|
1071
|
-
<details className="group relative text-sm font-normal">
|
|
1072
|
-
<summary className="cursor-pointer list-none text-accent hover:underline">
|
|
1073
|
-
Change
|
|
1074
|
-
</summary>
|
|
1075
|
-
<form
|
|
1076
|
-
action={action}
|
|
1077
|
-
className="absolute left-0 z-20 mt-2 w-72 space-y-3 rounded-md border border-line bg-card p-4 shadow-lg"
|
|
1078
|
-
>
|
|
1079
|
-
<input type="hidden" name="suite" value={suite} />
|
|
1080
|
-
<div>
|
|
1081
|
-
<label htmlFor="favor" className="block font-medium">
|
|
1082
|
-
Once accuracy holds, favor
|
|
1083
|
-
</label>
|
|
1084
|
-
<Select
|
|
1085
|
-
id="favor"
|
|
1086
|
-
name="favor"
|
|
1087
|
-
defaultValue={favor}
|
|
1088
|
-
className="mt-1 w-full rounded-md border border-line bg-card px-3 py-2"
|
|
1089
|
-
>
|
|
1090
|
-
{(["quality", "speed", "cost"] as const).map((f) => (
|
|
1091
|
-
<option key={f} value={f}>
|
|
1092
|
-
{CHOICES[f]}
|
|
1093
|
-
{f === own ? " (the suite's own)" : ""}
|
|
1094
|
-
</option>
|
|
1095
|
-
))}
|
|
1096
|
-
</Select>
|
|
1097
|
-
</div>
|
|
1098
|
-
<div>
|
|
1099
|
-
<label htmlFor="favor-reason" className="block font-medium">
|
|
1100
|
-
Why? <span className="font-normal text-muted">(optional)</span>
|
|
1101
|
-
</label>
|
|
1102
|
-
<TextInput
|
|
1103
|
-
id="favor-reason"
|
|
1104
|
-
name="reason"
|
|
1105
|
-
maxLength={300}
|
|
1106
|
-
className="mt-1 w-full rounded-md border border-line bg-card px-3 py-2"
|
|
1107
|
-
/>
|
|
1108
|
-
</div>
|
|
1109
|
-
<Submit>Save as a new version</Submit>
|
|
1110
|
-
</form>
|
|
1111
|
-
</details>
|
|
1112
|
-
);
|
|
1113
|
-
}
|
|
1114
|
-
|
|
1115
1095
|
/**
|
|
1116
1096
|
* What testing a model costs now, as the menu says it: "free, all 34
|
|
1117
1097
|
* reused", "~$0.10, 15 of 34 reused". Null before any cases.
|
|
@@ -1195,7 +1175,7 @@ function UnderAttack({
|
|
|
1195
1175
|
* an injection suite, whose cases are made from its base suite's.
|
|
1196
1176
|
*/
|
|
1197
1177
|
export function AnswerKeyHealthSection({ data }: { data: SuitePageData }) {
|
|
1198
|
-
const { app, key, suite, health: h, choosesHere } = data;
|
|
1178
|
+
const { app, key, suite, health: h, choosesHere, splitBy } = data;
|
|
1199
1179
|
const thin = h.tags.filter(([, n]) => n === 1).map(([t]) => t);
|
|
1200
1180
|
const needs =
|
|
1201
1181
|
h.easyToRetire.length ||
|
|
@@ -1213,7 +1193,7 @@ export function AnswerKeyHealthSection({ data }: { data: SuitePageData }) {
|
|
|
1213
1193
|
{title(c)}
|
|
1214
1194
|
</a>
|
|
1215
1195
|
);
|
|
1216
|
-
const { retireEasy, retireStaleDrafts } = app.actions;
|
|
1196
|
+
const { retireEasy, retireStaleDrafts, keepAnswer } = app.actions;
|
|
1217
1197
|
const cases = (n: number) => `${n} ${n === 1 ? "case" : "cases"}`;
|
|
1218
1198
|
const drafts = (n: number) => `${n} ${n === 1 ? "draft" : "drafts"}`;
|
|
1219
1199
|
const { draftMore } = app.actions;
|
|
@@ -1228,26 +1208,68 @@ export function AnswerKeyHealthSection({ data }: { data: SuitePageData }) {
|
|
|
1228
1208
|
{/* What to do, in order: fix doubtful answers, fill thin spots, prune. */}
|
|
1229
1209
|
<Card className="space-y-6 text-sm">
|
|
1230
1210
|
{check && (
|
|
1231
|
-
<div className="
|
|
1232
|
-
<h3 className="font-medium">
|
|
1211
|
+
<div className="space-y-3">
|
|
1212
|
+
<h3 className="font-medium">Answers worth a second look</h3>
|
|
1233
1213
|
{h.split.length > 0 && (
|
|
1234
|
-
<div className="space-y-
|
|
1235
|
-
<p>
|
|
1236
|
-
Models split about evenly on {cases(h.split.length)}
|
|
1237
|
-
|
|
1238
|
-
answer
|
|
1239
|
-
|
|
1214
|
+
<div className="space-y-2">
|
|
1215
|
+
<p className="readable">
|
|
1216
|
+
Models split about evenly on {cases(h.split.length)}: some
|
|
1217
|
+
give the answer key's answer, some don't. That often
|
|
1218
|
+
means the answer is wrong or the case is unclear, and either
|
|
1219
|
+
one makes every score less trustworthy. For each, decide
|
|
1220
|
+
who's right: keep the answer, fix it, or retire the case
|
|
1221
|
+
if there's no right answer.
|
|
1240
1222
|
<InfoTip term="splitCases" />
|
|
1241
1223
|
</p>
|
|
1242
|
-
<ul className="
|
|
1243
|
-
{h.split.map((c) =>
|
|
1244
|
-
|
|
1245
|
-
|
|
1224
|
+
<ul className="space-y-2">
|
|
1225
|
+
{h.split.map((c) => {
|
|
1226
|
+
const by = splitBy[c.id];
|
|
1227
|
+
const names = (xs: string[]) =>
|
|
1228
|
+
new Intl.ListFormat("en-US").format(xs);
|
|
1229
|
+
return (
|
|
1230
|
+
<li
|
|
1231
|
+
key={c.id}
|
|
1232
|
+
className="space-y-2 rounded-md bg-tint p-3"
|
|
1233
|
+
>
|
|
1234
|
+
<div className="font-medium">{caseLink(c)}</div>
|
|
1235
|
+
{by && (
|
|
1236
|
+
<p className="readable text-xs text-muted">
|
|
1237
|
+
{by.right.length > 0 &&
|
|
1238
|
+
`Gave the answer key's answer: ${names(by.right)}. `}
|
|
1239
|
+
{by.wrong.length > 0 &&
|
|
1240
|
+
`Didn't: ${names(by.wrong)}.`}
|
|
1241
|
+
</p>
|
|
1242
|
+
)}
|
|
1243
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
1244
|
+
{keepAnswer && (
|
|
1245
|
+
<form action={keepAnswer}>
|
|
1246
|
+
<input type="hidden" name="suite" value={key} />
|
|
1247
|
+
<input type="hidden" name="case" value={c.id} />
|
|
1248
|
+
<Submit variant="quiet">
|
|
1249
|
+
The answer is right
|
|
1250
|
+
</Submit>
|
|
1251
|
+
</form>
|
|
1252
|
+
)}
|
|
1253
|
+
<a
|
|
1254
|
+
href={`#case-${c.id}`}
|
|
1255
|
+
className={`inline-flex items-center rounded-md px-3 py-1.5 text-sm ${QUIET_BUTTON}`}
|
|
1256
|
+
>
|
|
1257
|
+
Fix the answer
|
|
1258
|
+
</a>
|
|
1259
|
+
<form action={app.actions.retireCase}>
|
|
1260
|
+
<input type="hidden" name="suite" value={key} />
|
|
1261
|
+
<input type="hidden" name="case" value={c.id} />
|
|
1262
|
+
<Submit variant="quiet">Retire it</Submit>
|
|
1263
|
+
</form>
|
|
1264
|
+
</div>
|
|
1265
|
+
</li>
|
|
1266
|
+
);
|
|
1267
|
+
})}
|
|
1246
1268
|
</ul>
|
|
1247
1269
|
</div>
|
|
1248
1270
|
)}
|
|
1249
1271
|
{h.duplicates.length > 0 && (
|
|
1250
|
-
<div className="space-y-1">
|
|
1272
|
+
<div className="readable space-y-1">
|
|
1251
1273
|
<p>
|
|
1252
1274
|
These pairs share nearly all their words, so each counts
|
|
1253
1275
|
twice. Keep the clearer one and retire the other.
|
|
@@ -1274,26 +1296,63 @@ export function AnswerKeyHealthSection({ data }: { data: SuitePageData }) {
|
|
|
1274
1296
|
or two to each.
|
|
1275
1297
|
<InfoTip term="tagCoverage" />
|
|
1276
1298
|
</p>
|
|
1277
|
-
|
|
1278
|
-
{
|
|
1279
|
-
<li key={t}>
|
|
1280
|
-
<Chip tone="warn">{t}</Chip>
|
|
1281
|
-
</li>
|
|
1282
|
-
))}
|
|
1283
|
-
</ul>
|
|
1284
|
-
{draftMore && suite.draftMore && (
|
|
1285
|
-
<form action={draftMore}>
|
|
1299
|
+
{draftMore && suite.draftMore ? (
|
|
1300
|
+
<form action={draftMore} className="space-y-2">
|
|
1286
1301
|
<input type="hidden" name="suite" value={key} />
|
|
1287
|
-
<
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1302
|
+
<ul className="flex flex-wrap gap-1.5">
|
|
1303
|
+
{thin.map((t) => (
|
|
1304
|
+
<li key={t}>
|
|
1305
|
+
<label className="inline-flex cursor-pointer items-center gap-1 rounded-full bg-amber-100 px-2 py-0.5 text-xs text-amber-800 has-[:checked]:bg-amber-300 dark:bg-amber-500/15 dark:text-amber-200 dark:has-[:checked]:bg-amber-500/40">
|
|
1306
|
+
<input
|
|
1307
|
+
type="checkbox"
|
|
1308
|
+
name="topic"
|
|
1309
|
+
value={t}
|
|
1310
|
+
className="h-3 w-3 accent-amber-700"
|
|
1311
|
+
/>
|
|
1312
|
+
{t}
|
|
1313
|
+
</label>
|
|
1314
|
+
</li>
|
|
1315
|
+
))}
|
|
1316
|
+
</ul>
|
|
1317
|
+
<Submit variant="quiet">
|
|
1318
|
+
Draft cases for the topics you picked
|
|
1319
|
+
</Submit>
|
|
1320
|
+
<p className="readable text-xs text-muted">
|
|
1321
|
+
Two drafts a topic, to confirm like any draft. Pick none to
|
|
1322
|
+
cover them all.
|
|
1323
|
+
</p>
|
|
1296
1324
|
</form>
|
|
1325
|
+
) : (
|
|
1326
|
+
<div className="space-y-2">
|
|
1327
|
+
<p className="readable text-muted">
|
|
1328
|
+
Pick a topic to open Add a case with it already tagged.
|
|
1329
|
+
</p>
|
|
1330
|
+
<div className="flex flex-wrap items-center gap-3">
|
|
1331
|
+
<ul className="flex flex-wrap gap-1.5">
|
|
1332
|
+
{thin.map((t) => (
|
|
1333
|
+
<li key={t}>
|
|
1334
|
+
<a
|
|
1335
|
+
href={`#add-case=${encodeURIComponent(t)}`}
|
|
1336
|
+
className="inline-flex rounded-full bg-amber-100 px-2 py-0.5 text-xs text-amber-800 hover:underline dark:bg-amber-500/15 dark:text-amber-200"
|
|
1337
|
+
>
|
|
1338
|
+
{t}
|
|
1339
|
+
</a>
|
|
1340
|
+
</li>
|
|
1341
|
+
))}
|
|
1342
|
+
</ul>
|
|
1343
|
+
<a
|
|
1344
|
+
href="#add-case="
|
|
1345
|
+
className={`inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-sm ${QUIET_BUTTON}`}
|
|
1346
|
+
>
|
|
1347
|
+
<Plus aria-hidden className="h-4 w-4" />
|
|
1348
|
+
Add a case
|
|
1349
|
+
</a>
|
|
1350
|
+
</div>
|
|
1351
|
+
<p className="readable text-xs text-muted">
|
|
1352
|
+
A suite with <code>draftMore</code> drafts whole cases for the
|
|
1353
|
+
topics you pick instead.
|
|
1354
|
+
</p>
|
|
1355
|
+
</div>
|
|
1297
1356
|
)}
|
|
1298
1357
|
<details className="group">
|
|
1299
1358
|
<summary className="cursor-pointer text-muted">
|
|
@@ -1383,7 +1442,6 @@ export async function SuitePage({
|
|
|
1383
1442
|
<SuggestionCard data={data} />
|
|
1384
1443
|
<CasesInInstructions data={data} />
|
|
1385
1444
|
<ModelTable data={data} />
|
|
1386
|
-
<TestSettingSection data={data} />
|
|
1387
1445
|
<CheckBreakdownSection data={data} />
|
|
1388
1446
|
<Versions data={data} />
|
|
1389
1447
|
<ChecksSection data={data} />
|