@erdoai/cli 0.63.0 → 0.64.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/index.js +48 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -418,7 +418,7 @@ var ErdoClient = class {
|
|
|
418
418
|
`/v1/evals/suites/${encodeURIComponent(slug)}/cases/${encodeURIComponent(caseName)}`
|
|
419
419
|
);
|
|
420
420
|
}
|
|
421
|
-
runEvalSuite(slug, concurrency, commitSha, frontendCommitSha, backendCommitSha, source) {
|
|
421
|
+
runEvalSuite(slug, concurrency, commitSha, frontendCommitSha, backendCommitSha, source, modelOverride) {
|
|
422
422
|
return this.request(
|
|
423
423
|
"POST",
|
|
424
424
|
`/v1/evals/suites/${encodeURIComponent(slug)}/run`,
|
|
@@ -427,10 +427,15 @@ var ErdoClient = class {
|
|
|
427
427
|
commit_sha: commitSha,
|
|
428
428
|
frontend_commit_sha: frontendCommitSha,
|
|
429
429
|
backend_commit_sha: backendCommitSha,
|
|
430
|
-
source
|
|
430
|
+
source,
|
|
431
|
+
model_override: modelOverride
|
|
431
432
|
}
|
|
432
433
|
);
|
|
433
434
|
}
|
|
435
|
+
getEvalLeaderboard(slug, days) {
|
|
436
|
+
const q = days && days > 0 ? `?days=${days}` : "";
|
|
437
|
+
return this.request("GET", `/v1/evals/leaderboard/${encodeURIComponent(slug)}${q}`);
|
|
438
|
+
}
|
|
434
439
|
getEvalRun(runID) {
|
|
435
440
|
return this.request(
|
|
436
441
|
"GET",
|
|
@@ -2433,7 +2438,7 @@ evalCmd.command("create <name>").description("Create a suite (in the active org)
|
|
|
2433
2438
|
}
|
|
2434
2439
|
}
|
|
2435
2440
|
);
|
|
2436
|
-
evalCmd.command("run <slug>").description("Run a suite; --watch polls until it completes").option("-w, --watch", "poll until the run finishes and print results").option("-c, --concurrency <n>", "parallel cases", (v) => parseInt(v, 10)).option("--commit-sha <sha>", "full 40-character Git commit SHA to associate with the run").option("--frontend-commit-sha <sha>", "frontend revision in the evaluated production snapshot").option("--backend-commit-sha <sha>", "backend revision in the evaluated production snapshot").option("--source <source>", "staff-only run source: post_deploy, nightly, or rollback").action(async (slug, opts) => {
|
|
2441
|
+
evalCmd.command("run <slug>").description("Run a suite; --watch polls until it completes").option("-w, --watch", "poll until the run finishes and print results").option("-c, --concurrency <n>", "parallel cases", (v) => parseInt(v, 10)).option("--commit-sha <sha>", "full 40-character Git commit SHA to associate with the run").option("--frontend-commit-sha <sha>", "frontend revision in the evaluated production snapshot").option("--backend-commit-sha <sha>", "backend revision in the evaluated production snapshot").option("--source <source>", "staff-only run source: post_deploy, nightly, or rollback").option("--model <model>", "pin the suite's agent to a model for this run (e.g. glm-5.3) \u2014 for model comparisons").action(async (slug, opts) => {
|
|
2437
2442
|
try {
|
|
2438
2443
|
const api = new ErdoClient();
|
|
2439
2444
|
const { suite } = await api.getEvalSuite(slug);
|
|
@@ -2455,7 +2460,8 @@ evalCmd.command("run <slug>").description("Run a suite; --watch polls until it c
|
|
|
2455
2460
|
opts.commitSha,
|
|
2456
2461
|
opts.frontendCommitSha,
|
|
2457
2462
|
opts.backendCommitSha,
|
|
2458
|
-
opts.source
|
|
2463
|
+
opts.source,
|
|
2464
|
+
opts.model
|
|
2459
2465
|
);
|
|
2460
2466
|
console.log(`run_id: ${run_id}`);
|
|
2461
2467
|
if (!opts.watch) return;
|
|
@@ -2481,6 +2487,44 @@ ${run.status}: ${run.passed_cases}/${run.total_cases} passed, avg ${run.avg_scor
|
|
|
2481
2487
|
fail(e);
|
|
2482
2488
|
}
|
|
2483
2489
|
});
|
|
2490
|
+
evalCmd.command("leaderboard <slug>").description("Model-comparison table for a suite: cases as rows, models as columns").option("-d, --days <n>", "window in days (default: all time)", (v) => parseInt(v, 10)).action(async (slug, opts) => {
|
|
2491
|
+
try {
|
|
2492
|
+
const res = await new ErdoClient().getEvalLeaderboard(slug, opts.days);
|
|
2493
|
+
if (res.models.length === 0) {
|
|
2494
|
+
console.log(`No completed runs found for "${slug}"${opts.days ? ` in the last ${opts.days} days` : ""}.`);
|
|
2495
|
+
return;
|
|
2496
|
+
}
|
|
2497
|
+
const modelCol = (m) => m.padEnd(18);
|
|
2498
|
+
console.log(`
|
|
2499
|
+
${"Case".padEnd(34)}${res.models.map(modelCol).join("")}`);
|
|
2500
|
+
console.log("-".repeat(34 + 18 * res.models.length));
|
|
2501
|
+
for (const row of res.rows) {
|
|
2502
|
+
const byModel = new Map(row.cells.map((c) => [c.model, c]));
|
|
2503
|
+
let line = row.case_name.slice(0, 33).padEnd(34);
|
|
2504
|
+
for (const m of res.models) {
|
|
2505
|
+
const c = byModel.get(m);
|
|
2506
|
+
line += c ? `${c.avg_score.toFixed(1)} (${Math.round(c.pass_rate * 100)}%)\xD7${c.n}`.padEnd(18) : "\xB7".padEnd(18);
|
|
2507
|
+
}
|
|
2508
|
+
console.log(line);
|
|
2509
|
+
}
|
|
2510
|
+
console.log(`
|
|
2511
|
+
${"Summary (avg of all cases)".padEnd(34)}${res.models.map(modelCol).join("")}`);
|
|
2512
|
+
for (const stat of ["score", "pass", "cost", "secs"]) {
|
|
2513
|
+
let line = `${" " + stat}`.padEnd(34);
|
|
2514
|
+
for (const s of res.summary) {
|
|
2515
|
+
const v = stat === "score" ? s.avg_score.toFixed(2) : stat === "pass" ? `${Math.round(s.pass_rate * 100)}%` : stat === "cost" ? `$${(s.avg_cost_millicents / 1e5).toFixed(3)}/case` : `${(s.avg_duration_ms / 1e3).toFixed(0)}s`;
|
|
2516
|
+
line += v.padEnd(18);
|
|
2517
|
+
}
|
|
2518
|
+
console.log(line);
|
|
2519
|
+
}
|
|
2520
|
+
console.log(
|
|
2521
|
+
`
|
|
2522
|
+
Cell = avg score (pass rate) \xD7 runs. Cost is recorded judge cost per case; agent cost rides the run's tokens. "(unrec.)" = rows predating per-model capture.`
|
|
2523
|
+
);
|
|
2524
|
+
} catch (e) {
|
|
2525
|
+
fail(e);
|
|
2526
|
+
}
|
|
2527
|
+
});
|
|
2484
2528
|
evalCmd.command("results <runId>").description("Show a run's results").option("--json", "print the full JSON").action(async (runId, opts) => {
|
|
2485
2529
|
try {
|
|
2486
2530
|
const data = await new ErdoClient().getEvalRun(runId);
|