- Root LICENSE: replace the short-form notice with the full canonical Apache-2.0 text (fixes GitHub's "Other" license detection); update the OpenJev -> Umpirix copyright line in LICENSE/NOTICE, otsone/NOTICE and sdk/python/LICENSE+NOTICE (missed by the rebrand pass). - sdk/ai-sdk: was MIT with no LICENSE/NOTICE and no upstream fork trail (unlike sdk/js, sdk/python, adapters/python, skills, which are real TypeSafe AI SDK forks and correctly keep MIT per their NOTICE). It is original Umpirix code, so switch it to Apache-2.0 with its own LICENSE/NOTICE, matching the root. - README Licensing section: list sdk/ai-sdk under Apache-2.0 and sdk/scribase-decisions under MIT, and spell out why the TypeSafe-forked directories stay MIT (their MIT terms require preserving the notice). - Audited caelum0x/openjev-private (read-only clone): it's an older, mostly-superseded snapshot of this repo. Migrated the 3 self-contained, secret-free example scripts it had that this repo didn't (raw-HTTP, no SDK dependency): content-moderation, lead-scoring, support-ticket-routing (Python + Node.js, each with a sample JSONL), plus scripts/reproduce-leaderboard.mjs (wired to a new `npm run bench:reproduce`) for leaderboard reproducibility. Left behind in private: src/lib/seo/retired.ts (a reversed decision - this repo now has live /compare pages) and the hosted-SaaS pieces already superseded by this repo's own, newer versions of the same files. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
100 lines
4.7 KiB
JavaScript
100 lines
4.7 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Re-run the public leaderboard from scratch and check it against the committed
|
|
* numbers in src/lib/content/leaderboard.json.
|
|
*
|
|
* npm install
|
|
* npm run embed-download # pinned gte-small, ~33 MB; without it the embedding rows are "not_run"
|
|
* npm run bench:reproduce # full test splits; ~9 min on an M3 incl. downloads, ~3 min cached
|
|
*
|
|
* What it does:
|
|
* 1. runs scripts/leaderboard.mjs with LEADERBOARD_PUBLIC=1 and LEADERBOARD_PUBLIC_SAMPLE=all
|
|
* (Banking77, CLINC150 + out-of-scope and AG News test splits are downloaded into
|
|
* .cache/datasets/ on first run), writing to .cache/leaderboard-repro.json so the
|
|
* committed file is never touched;
|
|
* 2. prints the headline numbers side by side with the committed ones;
|
|
* 3. compares every field of both files (except generated_at) and exits 1 on any difference.
|
|
*
|
|
* Local rows are deterministic, so a clean checkout should reproduce the committed file
|
|
* exactly. Rows that need a sidecar, a paid LLM key or a hosted endpoint are recorded as
|
|
* "not_run" with the reason, in both files. Pass --skip-run to only compare an existing
|
|
* .cache/leaderboard-repro.json.
|
|
*/
|
|
import { spawnSync } from "node:child_process";
|
|
import { readFileSync } from "node:fs";
|
|
import { dirname, join } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
const committedPath = join(root, "src/lib/content/leaderboard.json");
|
|
const reproRel = ".cache/leaderboard-repro.json";
|
|
const reproPath = join(root, reproRel);
|
|
|
|
if (!process.argv.includes("--skip-run")) {
|
|
const started = Date.now();
|
|
const run = spawnSync(process.execPath, [join(root, "scripts/leaderboard.mjs")], {
|
|
cwd: root,
|
|
stdio: "inherit",
|
|
env: {
|
|
...process.env,
|
|
LEADERBOARD_PUBLIC: "1",
|
|
LEADERBOARD_PUBLIC_SAMPLE: process.env.LEADERBOARD_PUBLIC_SAMPLE ?? "all",
|
|
LEADERBOARD_OUT: reproRel,
|
|
},
|
|
});
|
|
if (run.status !== 0) {
|
|
console.error(`leaderboard run failed (exit ${run.status})`);
|
|
process.exit(run.status ?? 1);
|
|
}
|
|
console.log(`\nrun took ${((Date.now() - started) / 1000).toFixed(0)} s`);
|
|
}
|
|
|
|
const committed = JSON.parse(readFileSync(committedPath, "utf8"));
|
|
const repro = JSON.parse(readFileSync(reproPath, "utf8"));
|
|
|
|
// --- headline table -------------------------------------------------------
|
|
const pct = (x) => (typeof x === "number" ? `${(x * 100).toFixed(1)}%` : "n/a");
|
|
const num = (x) => (typeof x === "number" ? x.toFixed(3) : "n/a");
|
|
const row = (file, track, id) =>
|
|
file.public_tracks?.find((t) => t.id === track)?.rows.find((r) => r.id === id);
|
|
const headline = [
|
|
["Banking77 accuracy", (f) => pct(row(f, "banking77", "system-one")?.accuracy)],
|
|
["Banking77 ECE", (f) => num(row(f, "banking77", "system-one")?.ece)],
|
|
["CLINC150 accuracy", (f) => pct(row(f, "clinc150_oos", "system-one")?.accuracy)],
|
|
["CLINC150 ECE", (f) => num(row(f, "clinc150_oos", "system-one")?.ece)],
|
|
["CLINC150 OOD AUROC (ood field)", (f) => num(row(f, "clinc150_oos", "system-one")?.ood?.auroc_ood_field)],
|
|
["AG News accuracy", (f) => pct(row(f, "ag_news", "system-one")?.accuracy)],
|
|
["AG News ECE", (f) => num(row(f, "ag_news", "system-one")?.ece)],
|
|
["Lexical fallback, Banking77 acc", (f) => pct(row(f, "banking77", "system-one-lexical")?.accuracy)],
|
|
];
|
|
console.log(`\n${"metric (system-one, gte-small)".padEnd(34)}${"committed".padEnd(12)}reproduced`);
|
|
for (const [label, get] of headline) {
|
|
const a = get(committed);
|
|
const b = get(repro);
|
|
console.log(`${label.padEnd(34)}${a.padEnd(12)}${b}${a === b ? "" : " <- differs"}`);
|
|
}
|
|
|
|
// --- full comparison ------------------------------------------------------
|
|
function flatten(value, path, out) {
|
|
if (Array.isArray(value)) {
|
|
value.forEach((v, i) => flatten(v, `${path}[${v && typeof v === "object" && "id" in v ? v.id : i}]`, out));
|
|
} else if (value && typeof value === "object") {
|
|
for (const [k, v] of Object.entries(value)) flatten(v, path ? `${path}.${k}` : k, out);
|
|
} else {
|
|
out.set(path, value);
|
|
}
|
|
return out;
|
|
}
|
|
const a = flatten({ ...committed, generated_at: undefined }, "", new Map());
|
|
const b = flatten({ ...repro, generated_at: undefined }, "", new Map());
|
|
const diffs = [...new Set([...a.keys(), ...b.keys()])].filter((k) => a.get(k) !== b.get(k));
|
|
|
|
if (diffs.length === 0) {
|
|
console.log(`\nOK: all ${a.size} fields match the committed leaderboard (committed ${committed.generated_at}).`);
|
|
} else {
|
|
console.log(`\n${diffs.length} field(s) differ from the committed leaderboard:`);
|
|
for (const k of diffs.slice(0, 50)) console.log(` ${k}: committed=${a.get(k)} reproduced=${b.get(k)}`);
|
|
if (diffs.length > 50) console.log(` ... and ${diffs.length - 50} more`);
|
|
process.exit(1);
|
|
}
|