@crowandraven/evalkeeper 0.4.1 → 0.7.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 +7 -0
- package/dist/activity.d.ts +58 -0
- package/dist/activity.js +125 -0
- package/dist/activity.js.map +1 -0
- package/dist/assertExpect.d.ts +52 -0
- package/dist/assertExpect.js +104 -0
- package/dist/assertExpect.js.map +1 -0
- package/dist/blind.d.ts +79 -0
- package/dist/blind.js +113 -0
- package/dist/blind.js.map +1 -0
- package/dist/cli/addPages.d.ts +34 -0
- package/dist/cli/addPages.js +91 -11
- package/dist/cli/addPages.js.map +1 -1
- package/dist/cli/main.d.ts +1 -1
- package/dist/cli/main.js +9 -0
- package/dist/cli/main.js.map +1 -1
- package/dist/compare.d.ts +38 -0
- package/dist/compare.js +62 -0
- package/dist/compare.js.map +1 -1
- package/dist/glossary.d.ts +20 -0
- package/dist/glossary.js +20 -0
- package/dist/glossary.js.map +1 -1
- package/dist/health.js +5 -3
- package/dist/health.js.map +1 -1
- package/dist/importCases.d.ts +76 -5
- package/dist/importCases.js +114 -14
- package/dist/importCases.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/memoryStore.js +3 -1
- package/dist/memoryStore.js.map +1 -1
- package/dist/readCheck.d.ts +116 -0
- package/dist/readCheck.js +321 -0
- package/dist/readCheck.js.map +1 -0
- package/dist/runner.d.ts +7 -0
- package/dist/runner.js +25 -3
- package/dist/runner.js.map +1 -1
- package/dist/settings.d.ts +81 -3
- package/dist/settings.js +160 -23
- package/dist/settings.js.map +1 -1
- package/dist/store.d.ts +10 -3
- package/dist/suggest.d.ts +10 -1
- package/dist/suggest.js +22 -4
- package/dist/suggest.js.map +1 -1
- package/dist/suiteContract.d.ts +17 -0
- package/dist/suiteContract.js +69 -0
- package/dist/suiteContract.js.map +1 -0
- package/dist/suites/crisisRisk.d.ts +83 -0
- package/dist/suites/crisisRisk.js +176 -0
- package/dist/suites/crisisRisk.js.map +1 -0
- package/dist/suites/crisisRiskCases.d.ts +40 -0
- package/dist/suites/crisisRiskCases.js +179 -0
- package/dist/suites/crisisRiskCases.js.map +1 -0
- package/dist/suites/index.d.ts +9 -0
- package/dist/suites/index.js +10 -0
- package/dist/suites/index.js.map +1 -0
- package/dist/testing.d.ts +140 -8
- package/dist/testing.js +420 -125
- package/dist/testing.js.map +1 -1
- package/dist/types.d.ts +92 -0
- package/dist/types.js +68 -0
- package/dist/types.js.map +1 -1
- package/dist/weekly.d.ts +21 -3
- package/dist/weekly.js +18 -1
- package/dist/weekly.js.map +1 -1
- package/package.json +5 -1
- package/src/activity.ts +154 -0
- package/src/assertExpect.ts +168 -0
- package/src/blind.ts +138 -0
- package/src/cli/addPages.ts +119 -17
- package/src/cli/main.ts +11 -0
- package/src/compare.ts +85 -0
- package/src/glossary.ts +36 -0
- package/src/health.ts +5 -3
- package/src/importCases.ts +172 -33
- package/src/index.ts +4 -0
- package/src/memoryStore.ts +2 -1
- package/src/readCheck.ts +458 -0
- package/src/runner.ts +33 -4
- package/src/settings.ts +192 -26
- package/src/store.ts +11 -3
- package/src/suggest.ts +33 -4
- package/src/suiteContract.ts +101 -0
- package/src/suites/crisisRisk.ts +250 -0
- package/src/suites/crisisRiskCases.ts +205 -0
- package/src/suites/index.ts +9 -0
- package/src/testing.ts +564 -127
- package/src/types.ts +141 -0
- package/src/weekly.ts +39 -3
- package/templates/app/evals/[suite]/compare/page.tsx +375 -0
- package/templates/app/evals/[suite]/page.tsx +55 -19
- package/templates/app/evals/[suite]/rate/page.tsx +133 -0
- package/templates/app/evals/[suite]/runs/[runId]/page.tsx +12 -0
- package/templates/app/evals/[suite]/side-by-side/page.tsx +300 -0
- package/templates/components/evalkeeper/DisagreementChip.tsx +35 -0
- package/templates/components/evalkeeper/RollBack.tsx +21 -1
- package/templates/components/evalkeeper/SettingsHistory.tsx +20 -2
- package/templates/components/evalkeeper/WeeklyCheck.tsx +34 -2
- package/templates/lib/evalkeeper/actions.ts +68 -4
- package/templates/lib/evalkeeper/weekly.ts +27 -4
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Link from "next/link";
|
|
2
2
|
import {
|
|
3
|
+
GLOSSARY,
|
|
3
4
|
describeChange,
|
|
4
5
|
type ChangeKind,
|
|
5
6
|
type HistoryEntry,
|
|
@@ -34,6 +35,16 @@ const KIND: Record<
|
|
|
34
35
|
tone: "fallback",
|
|
35
36
|
help: "The instructions changed in code under the live settings.",
|
|
36
37
|
},
|
|
38
|
+
OUTSIDE: {
|
|
39
|
+
text: "Changed outside",
|
|
40
|
+
tone: "warn",
|
|
41
|
+
help: GLOSSARY.changedOutside,
|
|
42
|
+
},
|
|
43
|
+
INSTRUCTIONS: {
|
|
44
|
+
text: "Instructions edited",
|
|
45
|
+
tone: "fallback",
|
|
46
|
+
help: GLOSSARY.instructionsEdited,
|
|
47
|
+
},
|
|
37
48
|
};
|
|
38
49
|
|
|
39
50
|
type Evidence = { runId?: string | null; live?: string | null };
|
|
@@ -138,7 +149,11 @@ export function HistoryEntries({
|
|
|
138
149
|
{isLive && <Chip tone="live">Live now</Chip>}
|
|
139
150
|
</span>
|
|
140
151
|
<span className="text-xs text-muted">
|
|
141
|
-
{e.by ??
|
|
152
|
+
{e.by ??
|
|
153
|
+
(e.kind === "OUTSIDE"
|
|
154
|
+
? "Found by the system"
|
|
155
|
+
: "System")}{" "}
|
|
156
|
+
· {e.createdAt.toLocaleString()}
|
|
142
157
|
</span>
|
|
143
158
|
</div>
|
|
144
159
|
<ul className="readable list-disc pl-5">
|
|
@@ -146,7 +161,9 @@ export function HistoryEntries({
|
|
|
146
161
|
? [`Back to v${e.to.number}: ${label(e.to.model)} live`]
|
|
147
162
|
: e.kind === "DEPLOY"
|
|
148
163
|
? ["Same models, new instructions"]
|
|
149
|
-
:
|
|
164
|
+
: e.kind === "INSTRUCTIONS"
|
|
165
|
+
? ["Same models, instructions edited at runtime"]
|
|
166
|
+
: describeChange(e.from, e.to, label)
|
|
150
167
|
).map((line) => (
|
|
151
168
|
<li key={line}>{line}</li>
|
|
152
169
|
))}
|
|
@@ -166,6 +183,7 @@ export function HistoryEntries({
|
|
|
166
183
|
suite={suite}
|
|
167
184
|
versionId={e.to.id}
|
|
168
185
|
number={e.to.number}
|
|
186
|
+
kind={e.kind}
|
|
169
187
|
/>
|
|
170
188
|
)}
|
|
171
189
|
</div>
|
|
@@ -3,7 +3,7 @@ import { money, type WeeklySummary } from "@crowandraven/evalkeeper";
|
|
|
3
3
|
import { runWeeklyNow } from "@/lib/evalkeeper/actions";
|
|
4
4
|
import { RefreshWhile } from "./RefreshWhile";
|
|
5
5
|
import { Submit } from "./Submit";
|
|
6
|
-
import { InfoTip } from "./Tip";
|
|
6
|
+
import { InfoTip, Tip } from "./Tip";
|
|
7
7
|
import { Card, Chip, pct } from "./ui";
|
|
8
8
|
import { evalsPath } from "@/lib/evalkeeper/paths";
|
|
9
9
|
|
|
@@ -33,7 +33,8 @@ export function WeeklyCheck({ weekly }: { weekly: WeeklySummary }) {
|
|
|
33
33
|
: "Not run yet. "}
|
|
34
34
|
Every Monday, each live model answers its suite's quick set
|
|
35
35
|
again, so a quiet change by its provider shows up here. It also flags
|
|
36
|
-
models retiring soon and features people rate poorly.
|
|
36
|
+
models retiring soon and features people rate poorly. Suites that can
|
|
37
|
+
draft cases from the week's activity add a few for you to review.
|
|
37
38
|
</p>
|
|
38
39
|
|
|
39
40
|
{weekly.clear && (
|
|
@@ -118,6 +119,37 @@ export function WeeklyCheck({ weekly }: { weekly: WeeklySummary }) {
|
|
|
118
119
|
))}
|
|
119
120
|
</ul>
|
|
120
121
|
)}
|
|
122
|
+
|
|
123
|
+
{weekly.drafted.length > 0 && (
|
|
124
|
+
<ul className="readable space-y-2 text-sm">
|
|
125
|
+
{weekly.drafted.map((d) => (
|
|
126
|
+
<li
|
|
127
|
+
key={`drafted-${d.suite}`}
|
|
128
|
+
className="flex flex-wrap items-baseline gap-2"
|
|
129
|
+
>
|
|
130
|
+
<Tip term="activityDraft" id={`drafted-${d.suite}`}>
|
|
131
|
+
<Chip tone="neutral">Drafted</Chip>
|
|
132
|
+
</Tip>
|
|
133
|
+
<span>
|
|
134
|
+
{d.label}: {d.count} case{d.count === 1 ? "" : "s"} drafted
|
|
135
|
+
from this week's activity,{" "}
|
|
136
|
+
{d.waiting === 0
|
|
137
|
+
? "all reviewed."
|
|
138
|
+
: `${d.waiting} waiting for review. `}
|
|
139
|
+
{d.waiting > 0 && (
|
|
140
|
+
<Link
|
|
141
|
+
href={`${evalsPath(d.suite)}#answer-key`}
|
|
142
|
+
className="underline"
|
|
143
|
+
>
|
|
144
|
+
Review them
|
|
145
|
+
</Link>
|
|
146
|
+
)}
|
|
147
|
+
{d.waiting > 0 && "."}
|
|
148
|
+
</span>
|
|
149
|
+
</li>
|
|
150
|
+
))}
|
|
151
|
+
</ul>
|
|
152
|
+
)}
|
|
121
153
|
</Card>
|
|
122
154
|
</section>
|
|
123
155
|
);
|
|
@@ -2,7 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
import { after } from "next/server";
|
|
4
4
|
import { revalidatePath } from "next/cache";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
blindRating,
|
|
7
|
+
caseFromFeedback,
|
|
8
|
+
formText,
|
|
9
|
+
leakNote,
|
|
10
|
+
raterStatus,
|
|
11
|
+
skipMark,
|
|
12
|
+
suggest,
|
|
13
|
+
withoutLeaks,
|
|
14
|
+
} from "@crowandraven/evalkeeper";
|
|
6
15
|
import {
|
|
7
16
|
MODELS,
|
|
8
17
|
SUITES,
|
|
@@ -176,14 +185,22 @@ export async function rescore(form: FormData) {
|
|
|
176
185
|
revalidatePath(evalsPath(suite.key));
|
|
177
186
|
}
|
|
178
187
|
|
|
179
|
-
/**
|
|
188
|
+
/**
|
|
189
|
+
* A person adds a case. They wrote its answer, so it's confirmed. The
|
|
190
|
+
* suite's leak check runs first, and the case's note says what it removed.
|
|
191
|
+
*/
|
|
180
192
|
export async function addCase(form: FormData) {
|
|
181
193
|
await requireAdmin();
|
|
182
194
|
const suite = suiteFrom(form);
|
|
183
195
|
if (!suite.labelFromForm) throw new Error("This suite has no answer form");
|
|
196
|
+
const { input, removed } = withoutLeaks(
|
|
197
|
+
suite,
|
|
198
|
+
suite.inputFromForm(form),
|
|
199
|
+
null,
|
|
200
|
+
);
|
|
184
201
|
await store.createCase({
|
|
185
202
|
suite: suite.key,
|
|
186
|
-
input
|
|
203
|
+
input,
|
|
187
204
|
tags: formText(form, "tags")
|
|
188
205
|
.split(",")
|
|
189
206
|
.map((t) => t.trim())
|
|
@@ -192,7 +209,7 @@ export async function addCase(form: FormData) {
|
|
|
192
209
|
status: "ACTIVE",
|
|
193
210
|
source: "OWNER",
|
|
194
211
|
sourceRef: null,
|
|
195
|
-
note:
|
|
212
|
+
note: leakNote(removed),
|
|
196
213
|
labels: [
|
|
197
214
|
{
|
|
198
215
|
kind: "EXPECTED",
|
|
@@ -232,6 +249,53 @@ export async function editAnswer(form: FormData) {
|
|
|
232
249
|
revalidatePath(evalsPath(suite.key));
|
|
233
250
|
}
|
|
234
251
|
|
|
252
|
+
/**
|
|
253
|
+
* The case a blind rating or skip is for: in this imported suite, not
|
|
254
|
+
* retired, and not yet rated or skipped by this person, so nobody answers
|
|
255
|
+
* twice and nothing lands over another person's answer.
|
|
256
|
+
*/
|
|
257
|
+
async function caseToRate(form: FormData, raterId: string) {
|
|
258
|
+
const suite = suiteFrom(form);
|
|
259
|
+
if (suite.caseKind !== "imported" || !suite.labelFromForm)
|
|
260
|
+
throw new Error("This suite isn't rated blind");
|
|
261
|
+
const caseId = formText(form, "case");
|
|
262
|
+
const c = (await store.listCases(suite.key)).find((x) => x.id === caseId);
|
|
263
|
+
if (!c) throw new Error("Unknown case");
|
|
264
|
+
if (raterStatus(c, raterId))
|
|
265
|
+
throw new Error("You've already rated or skipped this case");
|
|
266
|
+
return { suite, c };
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* A person rates an imported case blind: their own confirmed answer, with
|
|
271
|
+
* their reason, added beside anyone else's. Tests are rescored for free.
|
|
272
|
+
*/
|
|
273
|
+
export async function rateBlind(form: FormData) {
|
|
274
|
+
const admin = await requireAdmin();
|
|
275
|
+
const { suite, c } = await caseToRate(form, admin.id);
|
|
276
|
+
if (!suite.labelFromForm) throw new Error("This suite has no answer form");
|
|
277
|
+
await store.addLabel(
|
|
278
|
+
c.id,
|
|
279
|
+
blindRating({
|
|
280
|
+
raterId: admin.id,
|
|
281
|
+
value: suite.labelFromForm(form),
|
|
282
|
+
reason: formText(form, "reason"),
|
|
283
|
+
}),
|
|
284
|
+
);
|
|
285
|
+
// A draft is in use once it has an answer.
|
|
286
|
+
if (c.status === "DRAFT") await store.setCaseStatus(c.id, "ACTIVE");
|
|
287
|
+
after(() => runner.rescoreRecent(suite.key));
|
|
288
|
+
revalidatePath(evalsPath(suite.key), "layout");
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/** A person passes on an imported case: it leaves their queue only. */
|
|
292
|
+
export async function skipCase(form: FormData) {
|
|
293
|
+
const admin = await requireAdmin();
|
|
294
|
+
const { suite, c } = await caseToRate(form, admin.id);
|
|
295
|
+
await store.addLabel(c.id, skipMark(admin.id));
|
|
296
|
+
revalidatePath(evalsPath(suite.key, "rate"));
|
|
297
|
+
}
|
|
298
|
+
|
|
235
299
|
/** Takes a case out of use; its stored answers stay. */
|
|
236
300
|
export async function retireCase(form: FormData) {
|
|
237
301
|
await requireAdmin();
|
|
@@ -10,9 +10,10 @@ import { daysAgo } from "./time";
|
|
|
10
10
|
/**
|
|
11
11
|
* The weekly check: each suite's quick set on its live model. `start`
|
|
12
12
|
* records every suite's test first (so the hub shows them running), then
|
|
13
|
-
* `run`
|
|
14
|
-
*
|
|
15
|
-
* carries on in a fresh
|
|
13
|
+
* `run` drafts cases from the week's activity and answers the tests one
|
|
14
|
+
* suite after another. On a platform with a request limit, give the runner
|
|
15
|
+
* `requestLimitMs` and `continueRun` so a slow suite carries on in a fresh
|
|
16
|
+
* request.
|
|
16
17
|
*/
|
|
17
18
|
export async function startWeeklyCheck(): Promise<string[]> {
|
|
18
19
|
const ids: string[] = [];
|
|
@@ -24,13 +25,31 @@ export async function startWeeklyCheck(): Promise<string[]> {
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
export async function runWeeklyCheck(ids: string[]): Promise<void> {
|
|
28
|
+
await draftWeekly();
|
|
27
29
|
// runEval never throws: a suite that fails says why on its own test.
|
|
28
30
|
for (const id of ids) await runner.runEval(id, { fresh: true });
|
|
29
31
|
}
|
|
30
32
|
|
|
33
|
+
/**
|
|
34
|
+
* New draft cases from the week's activity, for suites that can draft
|
|
35
|
+
* them: at most a few per suite a week, pending until a person reviews
|
|
36
|
+
* them, never the same input twice. One suite failing doesn't stop the
|
|
37
|
+
* rest.
|
|
38
|
+
*/
|
|
39
|
+
export async function draftWeekly(): Promise<void> {
|
|
40
|
+
for (const suite of SUITES) {
|
|
41
|
+
if (!suite.draftFromActivity) continue;
|
|
42
|
+
try {
|
|
43
|
+
await runner.draftFromActivity(suite.key);
|
|
44
|
+
} catch (e) {
|
|
45
|
+
console.error(`Drafting from activity failed for ${suite.key}`, e);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
31
50
|
/** Where the weekly check stands, for the evals hub. */
|
|
32
51
|
export async function loadWeekly(): Promise<WeeklySummary> {
|
|
33
|
-
const [runs, routes, feedback] = await Promise.all([
|
|
52
|
+
const [runs, routes, feedback, cases] = await Promise.all([
|
|
34
53
|
Promise.all(SUITES.map((s) => store.listRuns(s.key, { limit: 50 }))).then(
|
|
35
54
|
(r) => r.flat(),
|
|
36
55
|
),
|
|
@@ -40,6 +59,9 @@ export async function loadWeekly(): Promise<WeeklySummary> {
|
|
|
40
59
|
),
|
|
41
60
|
).then((r) => Object.fromEntries(r)),
|
|
42
61
|
feedbackStore.listFeedback({ since: daysAgo(7) }),
|
|
62
|
+
Promise.all(SUITES.map((s) => store.listCases(s.key))).then((c) =>
|
|
63
|
+
c.flat(),
|
|
64
|
+
),
|
|
43
65
|
]);
|
|
44
66
|
return weeklySummary({
|
|
45
67
|
runs,
|
|
@@ -47,5 +69,6 @@ export async function loadWeekly(): Promise<WeeklySummary> {
|
|
|
47
69
|
routes,
|
|
48
70
|
models: MODELS,
|
|
49
71
|
thumbs: thumbsSummary(feedback, daysAgo(7)),
|
|
72
|
+
cases,
|
|
50
73
|
});
|
|
51
74
|
}
|