@crowandraven/evalkeeper 0.17.1 → 0.19.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/decisions.js +1 -1
- package/dist/decisions.js.map +1 -1
- package/dist/drafts.d.ts +2 -0
- package/dist/drafts.js +1 -1
- package/dist/drafts.js.map +1 -1
- package/dist/glossary.d.ts +25 -14
- package/dist/glossary.js +25 -14
- package/dist/glossary.js.map +1 -1
- package/dist/health.js +2 -2
- package/dist/health.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/memoryStore.d.ts +2 -1
- package/dist/memoryStore.js +9 -0
- package/dist/memoryStore.js.map +1 -1
- package/dist/next/actions.js +58 -3
- package/dist/next/actions.js.map +1 -1
- package/dist/prisma/contracts.d.ts +5 -2
- package/dist/prisma/contracts.js +7 -1
- package/dist/prisma/contracts.js.map +1 -1
- package/dist/prisma/index.d.ts +40 -1
- package/dist/prisma/index.js +37 -1
- package/dist/prisma/index.js.map +1 -1
- package/dist/prune.d.ts +43 -10
- package/dist/prune.js +42 -13
- package/dist/prune.js.map +1 -1
- package/dist/react/AddCase.js +11 -5
- package/dist/react/AddCase.js.map +1 -1
- package/dist/react/AnswerKey.js +7 -4
- package/dist/react/AnswerKey.js.map +1 -1
- package/dist/react/CaseMenu.d.ts +2 -2
- package/dist/react/CaseMenu.js +10 -31
- package/dist/react/CaseMenu.js.map +1 -1
- package/dist/react/CompareView.js +3 -3
- package/dist/react/CompareView.js.map +1 -1
- package/dist/react/ConfirmAnswer.js +1 -1
- package/dist/react/ConfirmAnswer.js.map +1 -1
- package/dist/react/Drawer.d.ts +32 -0
- package/dist/react/Drawer.js +60 -0
- package/dist/react/Drawer.js.map +1 -0
- package/dist/react/HubSections.d.ts +34 -30
- package/dist/react/HubSections.js +104 -103
- package/dist/react/HubSections.js.map +1 -1
- package/dist/react/Menu.d.ts +37 -0
- package/dist/react/Menu.js +51 -0
- package/dist/react/Menu.js.map +1 -0
- package/dist/react/ModelMenu.d.ts +1 -1
- package/dist/react/ModelMenu.js +8 -32
- package/dist/react/ModelMenu.js.map +1 -1
- package/dist/react/RunView.js +24 -4
- package/dist/react/RunView.js.map +1 -1
- package/dist/react/Spending.d.ts +25 -0
- package/dist/react/Spending.js +51 -0
- package/dist/react/Spending.js.map +1 -0
- package/dist/react/SuiteSections.d.ts +27 -14
- package/dist/react/SuiteSections.js +227 -61
- package/dist/react/SuiteSections.js.map +1 -1
- package/dist/react/app.d.ts +18 -0
- package/dist/react/app.js.map +1 -1
- package/dist/react/format.d.ts +13 -0
- package/dist/react/format.js +13 -0
- package/dist/react/format.js.map +1 -1
- package/dist/react/index.d.ts +3 -0
- package/dist/react/index.js +3 -0
- package/dist/react/index.js.map +1 -1
- package/dist/react/pieces.d.ts +21 -8
- package/dist/react/pieces.js +44 -14
- package/dist/react/pieces.js.map +1 -1
- package/dist/runner.d.ts +18 -8
- package/dist/runner.js +148 -12
- package/dist/runner.js.map +1 -1
- package/dist/settings.d.ts +12 -0
- package/dist/settings.js +18 -0
- package/dist/settings.js.map +1 -1
- package/dist/spending.d.ts +100 -0
- package/dist/spending.js +133 -0
- package/dist/spending.js.map +1 -0
- package/dist/stats.d.ts +3 -1
- package/dist/stats.js +6 -2
- package/dist/stats.js.map +1 -1
- package/dist/store.d.ts +5 -0
- package/dist/suggest.js +17 -12
- package/dist/suggest.js.map +1 -1
- package/dist/suiteSettings.d.ts +78 -0
- package/dist/suiteSettings.js +142 -0
- package/dist/suiteSettings.js.map +1 -0
- package/dist/suites/crisisRisk.js +3 -3
- package/dist/suites/crisisRisk.js.map +1 -1
- package/dist/suites/hopelessness.js +6 -6
- package/dist/suites/hopelessness.js.map +1 -1
- package/dist/suites/injection.js +2 -2
- package/dist/suites/injection.js.map +1 -1
- package/dist/summary.d.ts +41 -4
- package/dist/summary.js +46 -8
- package/dist/summary.js.map +1 -1
- package/dist/testing.d.ts +19 -0
- package/dist/testing.js +61 -0
- package/dist/testing.js.map +1 -1
- package/dist/todo.d.ts +146 -0
- package/dist/todo.js +198 -0
- package/dist/todo.js.map +1 -0
- package/dist/types.d.ts +46 -7
- package/dist/types.js +28 -4
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/schema/evalkeeper.prisma +13 -0
- package/src/decisions.ts +1 -1
- package/src/drafts.ts +3 -1
- package/src/glossary.ts +35 -14
- package/src/health.ts +3 -2
- package/src/index.ts +3 -0
- package/src/memoryStore.ts +15 -1
- package/src/next/actions.ts +67 -2
- package/src/prisma/contracts.ts +16 -1
- package/src/prisma/index.ts +68 -1
- package/src/prune.ts +71 -14
- package/src/react/AddCase.tsx +13 -11
- package/src/react/AnswerKey.tsx +17 -5
- package/src/react/CaseMenu.tsx +23 -77
- package/src/react/CompareView.tsx +4 -10
- package/src/react/ConfirmAnswer.tsx +1 -1
- package/src/react/Drawer.tsx +130 -0
- package/src/react/HubSections.tsx +180 -414
- package/src/react/Menu.tsx +155 -0
- package/src/react/ModelMenu.tsx +23 -74
- package/src/react/RunView.tsx +46 -3
- package/src/react/Spending.tsx +200 -0
- package/src/react/SuiteSections.tsx +591 -148
- package/src/react/app.ts +18 -0
- package/src/react/format.ts +15 -0
- package/src/react/index.ts +3 -0
- package/src/react/pieces.tsx +57 -18
- package/src/runner.ts +199 -13
- package/src/settings.ts +20 -0
- package/src/spending.ts +209 -0
- package/src/stats.ts +8 -2
- package/src/store.ts +5 -0
- package/src/suggest.ts +21 -14
- package/src/suiteSettings.ts +201 -0
- package/src/suites/crisisRisk.ts +3 -3
- package/src/suites/hopelessness.ts +6 -6
- package/src/suites/injection.ts +2 -2
- package/src/summary.ts +59 -8
- package/src/testing.ts +77 -0
- package/src/todo.ts +318 -0
- package/src/types.ts +63 -9
- package/starter/index.ts +7 -0
- package/templates/lib/evalkeeper/actions.ts +20 -0
|
@@ -1,229 +1,237 @@
|
|
|
1
1
|
import {
|
|
2
|
+
answerKeyHealth,
|
|
2
3
|
attacksFrom,
|
|
3
|
-
|
|
4
|
+
currentSettings,
|
|
4
5
|
isInjectionSuite,
|
|
5
|
-
perAnswer,
|
|
6
6
|
priorityOf,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
replacedStarters,
|
|
8
|
+
SUITE_STATUS_LABEL,
|
|
9
|
+
SUITE_STATUS_ORDER,
|
|
10
|
+
suiteStatus,
|
|
11
|
+
suiteTodos,
|
|
12
|
+
targetCasesOf,
|
|
11
13
|
thumbsSummary,
|
|
12
|
-
type
|
|
13
|
-
type HistoryEntry,
|
|
14
|
-
type Settings,
|
|
15
|
-
type SettingsVersion,
|
|
14
|
+
type TodoInput,
|
|
16
15
|
} from "../index.js";
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
LocalDate,
|
|
22
|
-
StandingBadge,
|
|
23
|
-
HealthReasons,
|
|
24
|
-
} from "./pieces.js";
|
|
25
|
-
import { pct } from "./format.js";
|
|
26
|
-
import { HistoryEntries } from "./SettingsHistory.js";
|
|
27
|
-
import {
|
|
28
|
-
daysAgo,
|
|
29
|
-
evalsPath,
|
|
30
|
-
loadWeekly,
|
|
31
|
-
type EvalAppConfig,
|
|
32
|
-
attacksResisted,
|
|
33
|
-
} from "./app.js";
|
|
34
|
-
import type { Runner } from "../runner.js";
|
|
35
|
-
import { ChevronDown } from "lucide-react";
|
|
16
|
+
import { Link, Card, InfoTip, SuiteStatusBadge } from "./pieces.js";
|
|
17
|
+
import { LINK } from "./format.js";
|
|
18
|
+
import { daysAgo, evalsPath, loadWeekly, type EvalAppConfig } from "./app.js";
|
|
19
|
+
import { ChevronRight } from "lucide-react";
|
|
36
20
|
import { WeeklyCheck } from "./WeeklyCheck.js";
|
|
21
|
+
import { InfoPopover } from "./InfoPopover.js";
|
|
22
|
+
import { GLOSSARY } from "../glossary.js";
|
|
23
|
+
import { PageMenu } from "./Drawer.js";
|
|
24
|
+
import { SpendingAlert, SpendingForm } from "./Spending.js";
|
|
37
25
|
|
|
38
26
|
/**
|
|
39
27
|
* Everything the evals hub shows, loaded together. Sections read from
|
|
40
28
|
* this, so a hub of your own loads the same data once.
|
|
41
29
|
*/
|
|
42
30
|
export async function loadHub(app: EvalAppConfig) {
|
|
43
|
-
const [boards, weekly] = await Promise.all([
|
|
31
|
+
const [boards, weekly, feedback, spending] = await Promise.all([
|
|
44
32
|
Promise.all(app.suites.map((s) => app.runner.board(s.key))),
|
|
45
33
|
loadWeekly(app),
|
|
34
|
+
app.feedbackStore.listFeedback(),
|
|
35
|
+
// The hub must load even when spending can't be read.
|
|
36
|
+
app.spending ? app.spending.read().catch(() => null) : null,
|
|
46
37
|
]);
|
|
47
|
-
const
|
|
48
|
-
app.suites.map((s) =>
|
|
49
|
-
Promise.all([
|
|
50
|
-
app.settings.history(s.operation),
|
|
51
|
-
app.settings.current(s.operation),
|
|
52
|
-
]),
|
|
53
|
-
),
|
|
54
|
-
);
|
|
55
|
-
const thumbs = thumbsSummary(
|
|
56
|
-
await app.feedbackStore.listFeedback(),
|
|
57
|
-
daysAgo(7),
|
|
58
|
-
);
|
|
38
|
+
const thumbs = thumbsSummary(feedback, daysAgo(7));
|
|
59
39
|
const down = thumbs.reduce((t, s) => t + s.down, 0);
|
|
60
40
|
const waiting = thumbs.reduce((t, s) => t + s.open, 0);
|
|
61
41
|
const flagged = thumbs.filter((s) => s.alert).length;
|
|
62
|
-
// An injection suite shows on its base suite's
|
|
42
|
+
// An injection suite shows on its base suite's row, not its own.
|
|
63
43
|
const attacksOn = (key: string) =>
|
|
64
44
|
boards.filter((x) => isInjectionSuite(x.suite) && x.suite.base.key === key);
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
45
|
+
const features = boards.filter((b) => !isInjectionSuite(b.suite));
|
|
46
|
+
const suites = await Promise.all(
|
|
47
|
+
features.map(async (b) => {
|
|
48
|
+
const { suite } = b;
|
|
49
|
+
const [current, saved, cases] = await Promise.all([
|
|
50
|
+
// One feature with no settings yet mustn't break the hub.
|
|
51
|
+
currentSettings(app.settings, suite.operation),
|
|
52
|
+
app.runner.suiteSettings(suite.key),
|
|
53
|
+
app.store.listCases(suite.key),
|
|
54
|
+
]);
|
|
55
|
+
const attacked = attacksOn(suite.key);
|
|
56
|
+
const tested = b.rows.filter(
|
|
57
|
+
(r) => r.test && !r.test.stale && !r.baseline,
|
|
58
|
+
);
|
|
59
|
+
const testedAt = tested.reduce<Date | null>(
|
|
60
|
+
(m, r) => (r.test && (!m || r.test.at > m) ? r.test.at : m),
|
|
61
|
+
null,
|
|
62
|
+
);
|
|
63
|
+
const input: TodoInput = {
|
|
64
|
+
rows: b.rows,
|
|
65
|
+
checks: suite.checks,
|
|
66
|
+
priority: priorityOf(suite, current?.settings),
|
|
67
|
+
models: app.models,
|
|
68
|
+
attacks: attacksFrom(attacked),
|
|
69
|
+
cases: b.cases,
|
|
70
|
+
provisional: b.provisional,
|
|
71
|
+
target: targetCasesOf(suite, saved),
|
|
72
|
+
unmadeAttacks: app.actions.makeAttackCases
|
|
73
|
+
? attacked
|
|
74
|
+
.filter((a) => a.cases === 0)
|
|
75
|
+
.map((a) => ({ key: a.suite.key, label: a.suite.label }))
|
|
76
|
+
: [],
|
|
77
|
+
replacedStarters: replacedStarters(suite, cases).length,
|
|
78
|
+
splitCases: answerKeyHealth(cases, b.caseResults, new Date(), testedAt)
|
|
79
|
+
.split.length,
|
|
80
|
+
};
|
|
81
|
+
const todos = suiteTodos(input);
|
|
82
|
+
return {
|
|
83
|
+
suite,
|
|
84
|
+
board: b,
|
|
85
|
+
todos,
|
|
86
|
+
status: suiteStatus(input, todos),
|
|
87
|
+
settings: current,
|
|
88
|
+
};
|
|
89
|
+
}),
|
|
75
90
|
);
|
|
76
91
|
return {
|
|
77
92
|
app,
|
|
78
93
|
boards,
|
|
79
94
|
weekly,
|
|
80
|
-
histories,
|
|
81
95
|
thumbs,
|
|
82
96
|
down,
|
|
83
97
|
waiting,
|
|
84
98
|
flagged,
|
|
85
99
|
attacksOn,
|
|
86
|
-
|
|
87
|
-
|
|
100
|
+
suites,
|
|
101
|
+
spending,
|
|
88
102
|
};
|
|
89
103
|
}
|
|
90
104
|
|
|
91
105
|
/** What `loadHub` returns, for sections and custom pages. */
|
|
92
106
|
export type HubData = Awaited<ReturnType<typeof loadHub>>;
|
|
93
107
|
|
|
94
|
-
/**
|
|
95
|
-
|
|
108
|
+
/**
|
|
109
|
+
* What the evals hub is for, with its menu (Spending and daily limits)
|
|
110
|
+
* beside the title, and spending when it needs room: over a limit,
|
|
111
|
+
* stopped, or a test running.
|
|
112
|
+
*/
|
|
113
|
+
export function HubIntro({ data }: { data?: HubData }) {
|
|
114
|
+
const app = data?.app;
|
|
115
|
+
const spending = data?.spending ?? null;
|
|
116
|
+
const entries =
|
|
117
|
+
app && spending && app.actions.saveLimits
|
|
118
|
+
? [
|
|
119
|
+
{
|
|
120
|
+
key: "spending",
|
|
121
|
+
label: "Spending and daily limits",
|
|
122
|
+
body: <SpendingForm app={app} reading={spending} />,
|
|
123
|
+
},
|
|
124
|
+
]
|
|
125
|
+
: [];
|
|
96
126
|
return (
|
|
97
|
-
|
|
98
|
-
<div className="
|
|
99
|
-
|
|
100
|
-
<
|
|
127
|
+
<div className="space-y-4">
|
|
128
|
+
<div className="space-y-2">
|
|
129
|
+
{/* The menu at the page's right edge, as on a suite's page. */}
|
|
130
|
+
<div className="flex items-center justify-between gap-4">
|
|
131
|
+
<h1 className="text-2xl font-semibold">Evals</h1>
|
|
132
|
+
<PageMenu label="Evals menu" entries={entries} />
|
|
133
|
+
</div>
|
|
134
|
+
<p className="readable text-muted">
|
|
101
135
|
Each suite tests one AI feature against answers people confirmed. Test
|
|
102
136
|
models on it, then pick the live one on evidence.
|
|
103
137
|
</p>
|
|
104
138
|
</div>
|
|
105
|
-
|
|
139
|
+
{app && <SpendingAlert app={app} reading={spending} />}
|
|
140
|
+
</div>
|
|
106
141
|
);
|
|
107
142
|
}
|
|
108
143
|
|
|
109
|
-
/**
|
|
144
|
+
/**
|
|
145
|
+
* Thumbs down people gave this week, in one line linking to them, shown
|
|
146
|
+
* only when there's something to look at. The hub's one number: the rest
|
|
147
|
+
* (cost, speed, scores) is on each suite's page.
|
|
148
|
+
*/
|
|
110
149
|
export function HubStats({ data }: { data: HubData }) {
|
|
111
|
-
const { app, down, waiting, flagged
|
|
150
|
+
const { app, down, waiting, flagged } = data;
|
|
151
|
+
if (!down && !waiting) return null;
|
|
112
152
|
return (
|
|
113
|
-
|
|
114
|
-
<
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
/>
|
|
127
|
-
<Stat
|
|
128
|
-
title="Slowest live model"
|
|
129
|
-
term="slowest"
|
|
130
|
-
value={needs.slowest ? seconds(needs.slowest.ms) : "—"}
|
|
131
|
-
detail={
|
|
132
|
-
needs.slowest
|
|
133
|
-
? `${needs.slowest.label} on ${needs.slowest.model}`
|
|
134
|
-
: "—"
|
|
135
|
-
}
|
|
136
|
-
/>
|
|
137
|
-
<Stat
|
|
138
|
-
title="Costliest live model"
|
|
139
|
-
term="costliest"
|
|
140
|
-
value={needs.costliest ? perAnswer(needs.costliest.usd) : "—"}
|
|
141
|
-
detail={
|
|
142
|
-
needs.costliest
|
|
143
|
-
? `${needs.costliest.label} on ${needs.costliest.model}`
|
|
144
|
-
: "—"
|
|
145
|
-
}
|
|
146
|
-
/>
|
|
147
|
-
<Link href={evalsPath(app, "feedback")} className="block h-full">
|
|
148
|
-
<Stat
|
|
149
|
-
title="Thumbs down this week"
|
|
150
|
-
term="thumbs"
|
|
151
|
-
value={String(down)}
|
|
152
|
-
detail={
|
|
153
|
-
flagged
|
|
154
|
-
? `${flagged} feature${flagged === 1 ? "" : "s"} need a look · ${waiting} waiting`
|
|
155
|
-
: `${waiting} waiting for a look`
|
|
156
|
-
}
|
|
157
|
-
/>
|
|
158
|
-
</Link>
|
|
159
|
-
</div>
|
|
160
|
-
</>
|
|
153
|
+
<p className="text-sm">
|
|
154
|
+
<Link href={evalsPath(app, "feedback")} className={LINK}>
|
|
155
|
+
{down} thumbs down this week
|
|
156
|
+
</Link>
|
|
157
|
+
<InfoTip term="thumbs" />
|
|
158
|
+
<span className="text-muted">
|
|
159
|
+
{" "}
|
|
160
|
+
· {waiting} waiting for a look
|
|
161
|
+
{flagged
|
|
162
|
+
? ` · ${flagged} feature${flagged === 1 ? "" : "s"} need a look`
|
|
163
|
+
: ""}
|
|
164
|
+
</span>
|
|
165
|
+
</p>
|
|
161
166
|
);
|
|
162
167
|
}
|
|
163
168
|
|
|
164
169
|
/**
|
|
165
|
-
* One
|
|
166
|
-
*
|
|
170
|
+
* One short row per feature, its name and status, with what needs you
|
|
171
|
+
* first: Needs attention, then Can't tell yet, then Healthy. Each row
|
|
172
|
+
* opens the suite's page, where its to-do list and details are. An
|
|
173
|
+
* injection suite counts on its base feature's row.
|
|
167
174
|
*/
|
|
168
175
|
export function SuiteList({ data }: { data: HubData }) {
|
|
169
|
-
const { app,
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
const [history, current] = histories[i] ?? [[], null];
|
|
173
|
-
const health = suiteHealth(
|
|
174
|
-
b.rows,
|
|
175
|
-
b.suite.checks,
|
|
176
|
-
priorityOf(b.suite, current?.settings),
|
|
177
|
-
b.cases,
|
|
178
|
-
b.provisional,
|
|
179
|
-
app.models,
|
|
180
|
-
{ attacks: attacksFrom(attacked) },
|
|
181
|
-
);
|
|
182
|
-
return { b, attacked, history, current, health };
|
|
183
|
-
});
|
|
184
|
-
const card = (c: (typeof all)[number]) => (
|
|
185
|
-
<SuiteCard
|
|
186
|
-
app={app}
|
|
187
|
-
key={c.b.suite.key}
|
|
188
|
-
board={c.b}
|
|
189
|
-
attacked={c.attacked}
|
|
190
|
-
health={c.health}
|
|
191
|
-
history={c.history}
|
|
192
|
-
current={c.current}
|
|
193
|
-
/>
|
|
176
|
+
const { app, suites } = data;
|
|
177
|
+
const ordered = SUITE_STATUS_ORDER.flatMap((status) =>
|
|
178
|
+
suites.filter((s) => s.status === status),
|
|
194
179
|
);
|
|
195
180
|
return (
|
|
196
181
|
<section aria-labelledby="suites" className="space-y-3">
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
<
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
<
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
182
|
+
{/* The popover's list can't sit inside the heading; it sits beside it. */}
|
|
183
|
+
<div className="flex items-center">
|
|
184
|
+
<h2 id="suites" className="text-lg font-semibold">
|
|
185
|
+
Suites
|
|
186
|
+
</h2>
|
|
187
|
+
<InfoPopover label="About suites and their status">
|
|
188
|
+
<p className="text-muted">{GLOSSARY.suites}</p>
|
|
189
|
+
<ul className="space-y-1">
|
|
190
|
+
{SUITE_STATUS_ORDER.map((status) => (
|
|
191
|
+
<li key={status}>
|
|
192
|
+
<strong>{SUITE_STATUS_LABEL[status]}:</strong>{" "}
|
|
193
|
+
{STATUS_MEANS[status]}
|
|
194
|
+
</li>
|
|
195
|
+
))}
|
|
196
|
+
</ul>
|
|
197
|
+
</InfoPopover>
|
|
198
|
+
</div>
|
|
199
|
+
{suites.length === 0 ? (
|
|
200
|
+
<NoSuites />
|
|
201
|
+
) : (
|
|
202
|
+
<ul className="divide-y divide-line overflow-hidden rounded-lg border border-line bg-card">
|
|
203
|
+
{ordered.map((s) => (
|
|
204
|
+
<li key={s.suite.key}>
|
|
205
|
+
<Link
|
|
206
|
+
href={evalsPath(app, s.suite.key)}
|
|
207
|
+
className="flex items-center justify-between gap-4 px-4 py-3 hover:bg-tint"
|
|
208
|
+
title={`${s.suite.label}: ${SUITE_STATUS_LABEL[s.status]}`}
|
|
209
|
+
>
|
|
210
|
+
<span className="min-w-0 truncate font-medium">
|
|
211
|
+
{s.suite.label}
|
|
212
|
+
</span>
|
|
213
|
+
<span className="flex shrink-0 items-center gap-2">
|
|
214
|
+
<SuiteStatusBadge status={s.status} />
|
|
215
|
+
<ChevronRight aria-hidden className="h-4 w-4 text-muted" />
|
|
216
|
+
</span>
|
|
217
|
+
</Link>
|
|
218
|
+
</li>
|
|
219
|
+
))}
|
|
220
|
+
</ul>
|
|
221
|
+
)}
|
|
223
222
|
</section>
|
|
224
223
|
);
|
|
225
224
|
}
|
|
226
225
|
|
|
226
|
+
/** What each status means, for the Suites heading's info. */
|
|
227
|
+
const STATUS_MEANS: Readonly<
|
|
228
|
+
Record<(typeof SUITE_STATUS_ORDER)[number], string>
|
|
229
|
+
> = {
|
|
230
|
+
attention: "something is on the suite's to-do list.",
|
|
231
|
+
unknown: "no model tested yet, or too few cases to judge.",
|
|
232
|
+
healthy: "nothing to do.",
|
|
233
|
+
};
|
|
234
|
+
|
|
227
235
|
/** Before the first suite: what a suite is, and how to add one. */
|
|
228
236
|
function NoSuites() {
|
|
229
237
|
return (
|
|
@@ -263,249 +271,6 @@ function NoSuites() {
|
|
|
263
271
|
);
|
|
264
272
|
}
|
|
265
273
|
|
|
266
|
-
function Stat({
|
|
267
|
-
title,
|
|
268
|
-
term,
|
|
269
|
-
value,
|
|
270
|
-
detail,
|
|
271
|
-
}: {
|
|
272
|
-
title: string;
|
|
273
|
-
term: GlossaryTerm;
|
|
274
|
-
value: string;
|
|
275
|
-
detail: string;
|
|
276
|
-
}) {
|
|
277
|
-
return (
|
|
278
|
-
// Full height, so the four cards line up however much each says.
|
|
279
|
-
<Card className="h-full space-y-1">
|
|
280
|
-
<p className="text-sm text-muted">
|
|
281
|
-
{title}
|
|
282
|
-
<InfoTip term={term} />
|
|
283
|
-
</p>
|
|
284
|
-
<p className="text-2xl font-semibold tabular-nums">{value}</p>
|
|
285
|
-
<p className="text-sm text-muted">{detail}</p>
|
|
286
|
-
</Card>
|
|
287
|
-
);
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
type Board = Awaited<ReturnType<Runner["board"]>>;
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* The live model's check furthest under its bar, as a bar with a tick at
|
|
294
|
-
* the bar, so a card shows how far off it is, not only that it is.
|
|
295
|
-
*/
|
|
296
|
-
function WorstCheck({
|
|
297
|
-
worst: w,
|
|
298
|
-
}: {
|
|
299
|
-
worst: NonNullable<ReturnType<typeof suiteHealth>["worst"]>;
|
|
300
|
-
}) {
|
|
301
|
-
return (
|
|
302
|
-
<div className="flex flex-wrap items-center gap-3 text-sm text-muted">
|
|
303
|
-
<span>
|
|
304
|
-
{w.label}
|
|
305
|
-
{w.serious ? " (serious)" : ""}{" "}
|
|
306
|
-
<span
|
|
307
|
-
className={`font-semibold ${w.serious ? "text-bad" : "text-warn"}`}
|
|
308
|
-
>
|
|
309
|
-
{pct(w.rate)}
|
|
310
|
-
</span>
|
|
311
|
-
</span>
|
|
312
|
-
<span aria-hidden className="relative h-1.5 w-40 rounded-full bg-tint">
|
|
313
|
-
<span
|
|
314
|
-
className={`absolute inset-y-0 left-0 rounded-full ${w.serious ? "bg-bad" : "bg-warn"}`}
|
|
315
|
-
style={{ width: `${Math.round(w.rate * 100)}%` }}
|
|
316
|
-
/>
|
|
317
|
-
<span
|
|
318
|
-
className="absolute -inset-y-1 w-px bg-ink"
|
|
319
|
-
style={{ left: `${Math.round(w.bar * 100)}%` }}
|
|
320
|
-
/>
|
|
321
|
-
</span>
|
|
322
|
-
<span>
|
|
323
|
-
bar {pct(w.bar)}
|
|
324
|
-
<InfoTip term="bar" />
|
|
325
|
-
</span>
|
|
326
|
-
</div>
|
|
327
|
-
);
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
/** Green at 95% and up, amber from 80%, red below. */
|
|
331
|
-
const scoreTone = (rate: number) =>
|
|
332
|
-
rate >= 0.95 ? "text-good" : rate >= 0.8 ? "text-warn" : "text-bad";
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
* One feature on the hub: its live version and models, what the live
|
|
336
|
-
* model costs and how fast it is, its latest test, how it does under
|
|
337
|
-
* attack, what needs a look, and its settings history.
|
|
338
|
-
*/
|
|
339
|
-
function SuiteCard({
|
|
340
|
-
app,
|
|
341
|
-
board: b,
|
|
342
|
-
attacked,
|
|
343
|
-
health: h,
|
|
344
|
-
history,
|
|
345
|
-
current,
|
|
346
|
-
}: {
|
|
347
|
-
app: EvalAppConfig;
|
|
348
|
-
board: Board;
|
|
349
|
-
/** The injection suites that attack this feature. */
|
|
350
|
-
attacked: Board[];
|
|
351
|
-
health: ReturnType<typeof suiteHealth>;
|
|
352
|
-
history: HistoryEntry[];
|
|
353
|
-
current: { settings: Settings; version: SettingsVersion | null } | null;
|
|
354
|
-
}) {
|
|
355
|
-
const label = (model: string) => app.models[model]?.label ?? model;
|
|
356
|
-
const live = b.rows.find((r) => r.live && !r.variant);
|
|
357
|
-
const t = live?.test;
|
|
358
|
-
const version = current?.version ?? null;
|
|
359
|
-
const since = version
|
|
360
|
-
? (history.find((e) => e.to.id === version.id)?.createdAt ??
|
|
361
|
-
version.createdAt)
|
|
362
|
-
: null;
|
|
363
|
-
const s = current?.settings;
|
|
364
|
-
const price = s ? app.models[s.model] : undefined;
|
|
365
|
-
const versions = Math.max(1, ...history.map((e) => e.to.number));
|
|
366
|
-
return (
|
|
367
|
-
<Card className="relative space-y-4 transition-colors hover:border-muted">
|
|
368
|
-
<div className="flex flex-wrap items-start justify-between gap-4">
|
|
369
|
-
<div className="min-w-0 space-y-2">
|
|
370
|
-
<div className="flex flex-wrap items-center gap-2">
|
|
371
|
-
<h2 className="font-semibold">
|
|
372
|
-
{/* Covers the whole card; the versions toggle sits above it. */}
|
|
373
|
-
<Link
|
|
374
|
-
href={evalsPath(app, b.suite.key)}
|
|
375
|
-
className="after:absolute after:inset-0 after:rounded-lg"
|
|
376
|
-
>
|
|
377
|
-
{b.suite.label}
|
|
378
|
-
</Link>
|
|
379
|
-
</h2>
|
|
380
|
-
<StandingBadge standing={h.standing} />
|
|
381
|
-
<InfoTip term="standing" />
|
|
382
|
-
</div>
|
|
383
|
-
<HealthReasons flags={h.flags} />
|
|
384
|
-
<p className="readable text-sm text-muted">{b.suite.description}</p>
|
|
385
|
-
</div>
|
|
386
|
-
{t && (
|
|
387
|
-
<div className="shrink-0 space-y-0.5 text-right text-sm">
|
|
388
|
-
<p className="font-semibold tabular-nums">
|
|
389
|
-
{perAnswer(t.costPerAnswer)} / answer
|
|
390
|
-
</p>
|
|
391
|
-
<p className="text-xs text-muted">{seconds(t.avgMs)} avg</p>
|
|
392
|
-
{price?.inputPer1M !== undefined &&
|
|
393
|
-
price.outputPer1M !== undefined && (
|
|
394
|
-
<p className="text-xs text-muted">
|
|
395
|
-
${price.inputPer1M} / ${price.outputPer1M} per 1M
|
|
396
|
-
</p>
|
|
397
|
-
)}
|
|
398
|
-
</div>
|
|
399
|
-
)}
|
|
400
|
-
</div>
|
|
401
|
-
|
|
402
|
-
{/* The models and how live does, read together. */}
|
|
403
|
-
<div className="space-y-1">
|
|
404
|
-
{s && (
|
|
405
|
-
<p className="text-sm text-muted">
|
|
406
|
-
<span className="font-semibold text-ink">{label(s.model)}</span>
|
|
407
|
-
{s.fallbackModel ? (
|
|
408
|
-
<>
|
|
409
|
-
{" "}
|
|
410
|
-
· fallback{" "}
|
|
411
|
-
<span className="font-semibold text-ink">
|
|
412
|
-
{label(s.fallbackModel)}
|
|
413
|
-
</span>
|
|
414
|
-
</>
|
|
415
|
-
) : (
|
|
416
|
-
" · no fallback"
|
|
417
|
-
)}
|
|
418
|
-
{s.reasoningEffort ? ` · reasoning ${s.reasoningEffort}` : ""}
|
|
419
|
-
</p>
|
|
420
|
-
)}
|
|
421
|
-
|
|
422
|
-
<p className="text-sm">
|
|
423
|
-
{t ? (
|
|
424
|
-
<>
|
|
425
|
-
Accuracy{" "}
|
|
426
|
-
<span className={`font-semibold ${scoreTone(t.right / t.total)}`}>
|
|
427
|
-
{pct(t.right / t.total)}
|
|
428
|
-
</span>
|
|
429
|
-
</>
|
|
430
|
-
) : (
|
|
431
|
-
"Live model not tested yet"
|
|
432
|
-
)}{" "}
|
|
433
|
-
· {b.cases} cases · {h.testedModels} models tested
|
|
434
|
-
</p>
|
|
435
|
-
{h.worst && <WorstCheck worst={h.worst} />}
|
|
436
|
-
</div>
|
|
437
|
-
|
|
438
|
-
{h.details.length > 0 && (
|
|
439
|
-
<ul className="readable list-disc space-y-1 pl-5 text-sm text-muted">
|
|
440
|
-
{h.details.slice(0, 3).map((d) => (
|
|
441
|
-
<li key={d}>{d}</li>
|
|
442
|
-
))}
|
|
443
|
-
</ul>
|
|
444
|
-
)}
|
|
445
|
-
|
|
446
|
-
{/* Once the feature has attack cases (a test makes them). */}
|
|
447
|
-
{attacked
|
|
448
|
-
.filter((a) => a.cases > 0)
|
|
449
|
-
.map((a) => {
|
|
450
|
-
const r = live ? attacksResisted(live.key, [a]) : null;
|
|
451
|
-
return (
|
|
452
|
-
<p key={a.suite.key} className="relative text-sm">
|
|
453
|
-
Attacks resisted
|
|
454
|
-
<InfoTip term="attacksResisted" />:{" "}
|
|
455
|
-
{r === null ? (
|
|
456
|
-
<span className="text-muted">not tested yet</span>
|
|
457
|
-
) : (
|
|
458
|
-
<Link
|
|
459
|
-
href={evalsPath(app, a.suite.key)}
|
|
460
|
-
className={`font-semibold hover:underline ${scoreTone(r.resisted / r.of)}`}
|
|
461
|
-
>
|
|
462
|
-
{pct(r.resisted / r.of)}
|
|
463
|
-
</Link>
|
|
464
|
-
)}{" "}
|
|
465
|
-
of {a.cases} {a.cases === 1 ? "attack" : "attacks"}
|
|
466
|
-
</p>
|
|
467
|
-
);
|
|
468
|
-
})}
|
|
469
|
-
|
|
470
|
-
{s && (
|
|
471
|
-
<details className="group/history relative rounded-md bg-tint">
|
|
472
|
-
<summary className="flex list-none items-center justify-between gap-2 p-3 text-sm font-medium">
|
|
473
|
-
Versions
|
|
474
|
-
<span className="flex items-center gap-1 text-xs font-normal text-muted">
|
|
475
|
-
<span className="font-medium text-ink">
|
|
476
|
-
v{version?.number ?? 1}
|
|
477
|
-
</span>{" "}
|
|
478
|
-
{since ? (
|
|
479
|
-
<>
|
|
480
|
-
live since <LocalDate date={since} />
|
|
481
|
-
</>
|
|
482
|
-
) : (
|
|
483
|
-
"defaults from code"
|
|
484
|
-
)}{" "}
|
|
485
|
-
· {versions} version{versions === 1 ? "" : "s"}
|
|
486
|
-
<ChevronDown
|
|
487
|
-
aria-hidden
|
|
488
|
-
className="h-4 w-4 transition-transform group-open/history:rotate-180"
|
|
489
|
-
/>
|
|
490
|
-
</span>
|
|
491
|
-
</summary>
|
|
492
|
-
<div className="px-3 pb-3">
|
|
493
|
-
<HistoryEntries
|
|
494
|
-
app={app}
|
|
495
|
-
suite={b.suite.key}
|
|
496
|
-
entries={history}
|
|
497
|
-
liveId={version?.id ?? null}
|
|
498
|
-
label={label}
|
|
499
|
-
defaults={s}
|
|
500
|
-
plain
|
|
501
|
-
/>
|
|
502
|
-
</div>
|
|
503
|
-
</details>
|
|
504
|
-
)}
|
|
505
|
-
</Card>
|
|
506
|
-
);
|
|
507
|
-
}
|
|
508
|
-
|
|
509
274
|
/**
|
|
510
275
|
* The AI features no suite tests yet, from your app's `features`: where
|
|
511
276
|
* an eval would tell you the most next. Shows nothing without them.
|
|
@@ -519,6 +284,7 @@ export function NoEvalYet({ data }: { data: HubData }) {
|
|
|
519
284
|
<section aria-labelledby="no-eval-yet" className="space-y-2">
|
|
520
285
|
<h2 id="no-eval-yet" className="text-lg font-semibold">
|
|
521
286
|
No eval yet
|
|
287
|
+
<InfoTip term="noEvalYet" />
|
|
522
288
|
</h2>
|
|
523
289
|
<p className="readable text-sm text-muted">
|
|
524
290
|
Nothing tells you yet whether{" "}
|
|
@@ -541,18 +307,18 @@ export function NoEvalYet({ data }: { data: HubData }) {
|
|
|
541
307
|
);
|
|
542
308
|
}
|
|
543
309
|
/**
|
|
544
|
-
* The hub as Evalkeeper arranges it: where each suite stands
|
|
545
|
-
*
|
|
546
|
-
*
|
|
310
|
+
* The hub as Evalkeeper arranges it: where each suite stands, in one row
|
|
311
|
+
* each. A hub of your own loads the same data (`loadHub`) and arranges
|
|
312
|
+
* these sections another way.
|
|
547
313
|
*/
|
|
548
314
|
export async function HubPage({ app }: { app: EvalAppConfig }) {
|
|
549
315
|
const data = await loadHub(app);
|
|
550
316
|
return (
|
|
551
317
|
<div className="space-y-8">
|
|
552
|
-
<HubIntro />
|
|
553
|
-
<HubStats data={data} />
|
|
318
|
+
<HubIntro data={data} />
|
|
554
319
|
<WeeklyCheck app={app} weekly={data.weekly} />
|
|
555
320
|
<SuiteList data={data} />
|
|
321
|
+
<HubStats data={data} />
|
|
556
322
|
<NoEvalYet data={data} />
|
|
557
323
|
</div>
|
|
558
324
|
);
|