Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions apps/cli/src/commands/pipeline/bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
* `agentv pipeline bench` — Merge code-grader and LLM grader scores into final
* benchmark artifacts.
*
* Reads code_grader_results from disk and LLM grader scores from stdin,
* computes weighted pass_rate per test, and writes:
* Reads code_grader_results from disk and LLM grader scores from a file
* (`--llm-scores <path>`) or stdin, computes weighted pass_rate per test,
* and writes:
* - <test-id>/grading.json (per-test grading breakdown)
* - index.jsonl (one line per test)
* - benchmark.json (aggregate statistics)
Expand All @@ -14,7 +15,7 @@
import { readFile, readdir, writeFile } from 'node:fs/promises';
import { join } from 'node:path';

import { command, positional, string } from 'cmd-ts';
import { command, option, optional, positional, string } from 'cmd-ts';

interface EvaluatorScore {
readonly name: string;
Expand All @@ -33,14 +34,24 @@ export const evalBenchCommand = command({
displayName: 'export-dir',
description: 'Export directory from pipeline input/grade',
}),
llmScores: option({
type: optional(string),
long: 'llm-scores',
description: 'Path to LLM scores JSON file (reads from stdin if omitted)',
}),
},
handler: async ({ exportDir }) => {
handler: async ({ exportDir, llmScores: llmScoresPath }) => {
const manifest = JSON.parse(await readFile(join(exportDir, 'manifest.json'), 'utf8'));
const testIds: string[] = manifest.test_ids;
const targetName: string = manifest.target?.name ?? 'unknown';

// Read LLM scores from stdin
const stdinData = await readStdin();
// Read LLM scores from file or stdin
let stdinData: string;
if (llmScoresPath) {
stdinData = await readFile(llmScoresPath, 'utf8');
} else {
stdinData = await readStdin();
}
const llmScores: Record<
string,
Record<
Expand Down
2 changes: 2 additions & 0 deletions apps/cli/src/commands/pipeline/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { subcommands } from 'cmd-ts';
import { evalBenchCommand } from './bench.js';
import { evalGradeCommand } from './grade.js';
import { evalInputCommand } from './input.js';
import { evalRunCommand } from './run.js';

export const pipelineCommand = subcommands({
name: 'pipeline',
Expand All @@ -11,5 +12,6 @@ export const pipelineCommand = subcommands({
input: evalInputCommand,
grade: evalGradeCommand,
bench: evalBenchCommand,
run: evalRunCommand,
},
});
Loading
Loading