@tangle-network/agent-bench 2.0.0 → 3.0.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/CHANGELOG.md +20 -0
- package/README.md +24 -2
- package/dist/adapters.d.ts +3 -3
- package/dist/adapters.js +3 -5
- package/dist/adapters.js.map +1 -1
- package/dist/benchmarks/_harness.d.ts +4 -4
- package/dist/benchmarks/_harness.js +5 -2
- package/dist/benchmarks/_harness.js.map +1 -1
- package/dist/benchmarks/aec-bench.d.ts +2 -2
- package/dist/benchmarks/aec-bench.js +49 -42
- package/dist/benchmarks/aec-bench.js.map +1 -1
- package/dist/benchmarks/agentbench.d.ts +2 -2
- package/dist/benchmarks/agentbench.js +41 -34
- package/dist/benchmarks/agentbench.js.map +1 -1
- package/dist/benchmarks/appworld.d.ts +4 -4
- package/dist/benchmarks/appworld.js +67 -53
- package/dist/benchmarks/appworld.js.map +1 -1
- package/dist/benchmarks/bfcl.d.ts +2 -2
- package/dist/benchmarks/bfcl.js +52 -44
- package/dist/benchmarks/bfcl.js.map +1 -1
- package/dist/benchmarks/cad-design.d.ts +2 -2
- package/dist/benchmarks/cad-design.js +53 -44
- package/dist/benchmarks/cad-design.js.map +1 -1
- package/dist/benchmarks/cadbench.d.ts +2 -2
- package/dist/benchmarks/cadbench.js +1 -1
- package/dist/benchmarks/cadgenbench.d.ts +2 -2
- package/dist/benchmarks/cadgenbench.js +1 -1
- package/dist/benchmarks/commit0.d.ts +2 -2
- package/dist/benchmarks/commit0.js +38 -31
- package/dist/benchmarks/commit0.js.map +1 -1
- package/dist/benchmarks/crag.d.ts +2 -2
- package/dist/benchmarks/crag.js +37 -32
- package/dist/benchmarks/crag.js.map +1 -1
- package/dist/benchmarks/dabstep.d.ts +2 -2
- package/dist/benchmarks/dabstep.js +41 -34
- package/dist/benchmarks/dabstep.js.map +1 -1
- package/dist/benchmarks/finresearchbench.d.ts +4 -4
- package/dist/benchmarks/finresearchbench.js +61 -48
- package/dist/benchmarks/finresearchbench.js.map +1 -1
- package/dist/benchmarks/finsearchcomp.d.ts +3 -3
- package/dist/benchmarks/finsearchcomp.js +54 -43
- package/dist/benchmarks/finsearchcomp.js.map +1 -1
- package/dist/benchmarks/frames.d.ts +2 -2
- package/dist/benchmarks/frames.js +66 -51
- package/dist/benchmarks/frames.js.map +1 -1
- package/dist/benchmarks/hotpotqa.d.ts +2 -2
- package/dist/benchmarks/hotpotqa.js +59 -47
- package/dist/benchmarks/hotpotqa.js.map +1 -1
- package/dist/benchmarks/humaneval.d.ts +3 -3
- package/dist/benchmarks/humaneval.js +39 -35
- package/dist/benchmarks/humaneval.js.map +1 -1
- package/dist/benchmarks/mcad-bench.d.ts +2 -2
- package/dist/benchmarks/mcad-bench.js +68 -56
- package/dist/benchmarks/mcad-bench.js.map +1 -1
- package/dist/benchmarks/mcad-cq-bench.d.ts +2 -2
- package/dist/benchmarks/mcad-cq-bench.js +69 -57
- package/dist/benchmarks/mcad-cq-bench.js.map +1 -1
- package/dist/benchmarks/mcad-cq-golds.d.ts +1 -1
- package/dist/benchmarks/mcad-cq-golds.js +1 -1
- package/dist/benchmarks/mcad-cq-golds.js.map +1 -1
- package/dist/benchmarks/mcad-golds.d.ts +1 -1
- package/dist/benchmarks/mcad-golds.js.map +1 -1
- package/dist/benchmarks/mind2web.d.ts +3 -3
- package/dist/benchmarks/mind2web.js +62 -49
- package/dist/benchmarks/mind2web.js.map +1 -1
- package/dist/benchmarks/nomiracl.d.ts +2 -2
- package/dist/benchmarks/nomiracl.js +43 -36
- package/dist/benchmarks/nomiracl.js.map +1 -1
- package/dist/benchmarks/open-rag-bench.d.ts +2 -2
- package/dist/benchmarks/open-rag-bench.js +37 -32
- package/dist/benchmarks/open-rag-bench.js.map +1 -1
- package/dist/benchmarks/programbench.d.ts +2 -2
- package/dist/benchmarks/programbench.js +28 -23
- package/dist/benchmarks/programbench.js.map +1 -1
- package/dist/benchmarks/rag-shared.d.ts +2 -2
- package/dist/benchmarks/rag-shared.js +15 -13
- package/dist/benchmarks/rag-shared.js.map +1 -1
- package/dist/benchmarks/ragbench.d.ts +2 -2
- package/dist/benchmarks/ragbench.js +34 -29
- package/dist/benchmarks/ragbench.js.map +1 -1
- package/dist/benchmarks/simpleqa.d.ts +2 -2
- package/dist/benchmarks/simpleqa.js +62 -51
- package/dist/benchmarks/simpleqa.js.map +1 -1
- package/dist/benchmarks/swe-bench.d.ts +4 -4
- package/dist/benchmarks/swe-bench.js +47 -41
- package/dist/benchmarks/swe-bench.js.map +1 -1
- package/dist/benchmarks/t2-ragbench.d.ts +2 -2
- package/dist/benchmarks/t2-ragbench.js +37 -32
- package/dist/benchmarks/t2-ragbench.js.map +1 -1
- package/dist/benchmarks/tau-bench-shared.d.ts +2 -2
- package/dist/benchmarks/tau-bench-shared.js +43 -36
- package/dist/benchmarks/tau-bench-shared.js.map +1 -1
- package/dist/benchmarks/tau2-bench.d.ts +2 -2
- package/dist/benchmarks/tau2-bench.js.map +1 -1
- package/dist/benchmarks/tau3-banking.d.ts +2 -2
- package/dist/benchmarks/tau3-banking.js.map +1 -1
- package/dist/benchmarks/terminal-bench.d.ts +2 -2
- package/dist/benchmarks/terminal-bench.js +29 -23
- package/dist/benchmarks/terminal-bench.js.map +1 -1
- package/dist/benchmarks/toollm.d.ts +2 -2
- package/dist/benchmarks/toollm.js +40 -34
- package/dist/benchmarks/toollm.js.map +1 -1
- package/dist/benchmarks/trata-hedge.d.ts +2 -2
- package/dist/benchmarks/trata-hedge.js +46 -38
- package/dist/benchmarks/trata-hedge.js.map +1 -1
- package/dist/benchmarks/types.d.ts +33 -63
- package/dist/benchmarks/types.js +36 -1
- package/dist/benchmarks/types.js.map +1 -0
- package/dist/benchmarks/webarena-verified.d.ts +2 -2
- package/dist/benchmarks/webarena-verified.js +29 -24
- package/dist/benchmarks/webarena-verified.js.map +1 -1
- package/dist/{cadbench-Byr5gO1M.js → cadbench-htzAmMaI.js} +39 -32
- package/dist/cadbench-htzAmMaI.js.map +1 -0
- package/dist/{cadgenbench-Tvk16YKT.js → cadgenbench-BLvEtnxU.js} +28 -22
- package/dist/cadgenbench-BLvEtnxU.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +667 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +9 -8
- package/dist/index.js +61 -56
- package/dist/index.js.map +1 -1
- package/package.json +7 -4
- package/scripts/enterpriseops-gym-run.sh +82 -0
- package/scripts/grade-recorded-evidence.mjs +6 -6
- package/scripts/harvey-lab-judge.py +50 -0
- package/scripts/harvey-lab-run.sh +53 -0
- package/scripts/harvey-lab-sandbox.sh +21 -0
- package/scripts/healthbench-professional-run.sh +30 -0
- package/scripts/healthbench_professional_run.py +112 -0
- package/scripts/mlcr-run.sh +17 -0
- package/scripts/mlcr_run.py +133 -0
- package/scripts/prbench-run.sh +39 -0
- package/scripts/prbench_run.py +53 -0
- package/scripts/verify-packed-consumer.mjs +32 -27
- package/src/adapters.ts +5 -7
- package/src/benchmarks/_harness.test.mts +18 -1
- package/src/benchmarks/_harness.ts +12 -7
- package/src/benchmarks/aec-bench.test.mts +14 -14
- package/src/benchmarks/aec-bench.ts +62 -56
- package/src/benchmarks/agent-eval-contract.test.mts +38 -0
- package/src/benchmarks/agentbench.ts +44 -37
- package/src/benchmarks/appworld.test.mts +7 -7
- package/src/benchmarks/appworld.ts +88 -75
- package/src/benchmarks/bfcl.ts +60 -53
- package/src/benchmarks/cad-design.ts +34 -32
- package/src/benchmarks/cadbench.ts +34 -32
- package/src/benchmarks/cadgenbench.ts +30 -28
- package/src/benchmarks/commit0.test.mts +9 -9
- package/src/benchmarks/commit0.ts +50 -43
- package/src/benchmarks/crag.ts +45 -40
- package/src/benchmarks/dabstep-official.test.mts +8 -8
- package/src/benchmarks/dabstep.test.mts +11 -11
- package/src/benchmarks/dabstep.ts +47 -40
- package/src/benchmarks/external-adapters.test.mts +43 -44
- package/src/benchmarks/finresearchbench.ts +57 -47
- package/src/benchmarks/finsearchcomp.ts +72 -67
- package/src/benchmarks/frames.ts +76 -69
- package/src/benchmarks/hotpotqa.ts +69 -64
- package/src/benchmarks/humaneval.ts +37 -35
- package/src/benchmarks/mcad-bench.test.mts +30 -30
- package/src/benchmarks/mcad-bench.ts +66 -60
- package/src/benchmarks/mcad-cq-bench.ts +69 -63
- package/src/benchmarks/mcad-cq-golds.ts +1 -1
- package/src/benchmarks/mcad-cq.test.mts +40 -40
- package/src/benchmarks/mcad-golds.ts +1 -1
- package/src/benchmarks/mind2web.ts +66 -58
- package/src/benchmarks/nomiracl.ts +53 -46
- package/src/benchmarks/open-rag-bench.ts +47 -42
- package/src/benchmarks/programbench.test.mts +10 -10
- package/src/benchmarks/programbench.ts +38 -33
- package/src/benchmarks/rag-benchmarks.test.mts +31 -31
- package/src/benchmarks/rag-shared.ts +13 -16
- package/src/benchmarks/ragbench.ts +44 -39
- package/src/benchmarks/simpleqa.ts +78 -73
- package/src/benchmarks/swe-bench.test.mts +3 -3
- package/src/benchmarks/swe-bench.ts +66 -61
- package/src/benchmarks/t2-ragbench.ts +47 -42
- package/src/benchmarks/tau-bench-shared.ts +51 -44
- package/src/benchmarks/tau-pin.test.mts +1 -1
- package/src/benchmarks/tau2-bench.ts +2 -2
- package/src/benchmarks/tau3-banking.ts +2 -2
- package/src/benchmarks/terminal-bench.test.mts +3 -3
- package/src/benchmarks/terminal-bench.ts +41 -36
- package/src/benchmarks/toollm.ts +54 -47
- package/src/benchmarks/trata-hedge.ts +57 -52
- package/src/benchmarks/types.ts +70 -59
- package/src/benchmarks/webarena-verified.ts +49 -42
- package/src/cli.ts +74 -0
- package/src/corpus-replay.mts +9 -9
- package/src/examples/benchmark-matrix.mts +13 -10
- package/src/gate-cli.mts +5 -5
- package/src/gate.test.mts +14 -12
- package/src/gate.ts +23 -22
- package/src/index.ts +17 -11
- package/src/published.test.mts +534 -0
- package/src/published.ts +524 -0
- package/src/run-benchmarks-cli.mts +2 -2
- package/src/run-benchmarks.test.mts +58 -48
- package/src/run-benchmarks.ts +64 -57
- package/src/swe-bench-env.ts +6 -6
- package/src/worker.ts +1 -1
- package/dist/benchmarks/enterpriseops-gym.d.ts +0 -6
- package/dist/benchmarks/enterpriseops-gym.js +0 -236
- package/dist/benchmarks/enterpriseops-gym.js.map +0 -1
- package/dist/cadbench-Byr5gO1M.js.map +0 -1
- package/dist/cadgenbench-Tvk16YKT.js.map +0 -1
- package/fixtures/enterpriseops-gym.json +0 -103
- package/scripts/enterpriseops_gym_judge.py +0 -281
- package/src/benchmarks/enterpriseops-gym.test.mts +0 -77
- package/src/benchmarks/enterpriseops-gym.ts +0 -343
- package/src/eops-skills/address-every-subtask.md +0 -5
- package/src/eops-skills/exact-tools-and-args.md +0 -5
- package/src/eops-skills/full-sequence-to-goal.md +0 -5
- package/src/eops-skills/ground-every-value.md +0 -5
- package/src/eops-skills/honor-the-policies.md +0 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Offline ProgramBench adapter test. The judge needs the official `programbench`
|
|
3
3
|
* harness + Docker on linux/amd64, neither installed in CI, so this exercises the
|
|
4
|
-
* offline parts (fixtures
|
|
4
|
+
* offline parts (fixtures loadAll, the file-manifest OutputAdapter, goldArtifact)
|
|
5
5
|
* and asserts the harness-backed path FAILS LOUD with the documented fix — never a
|
|
6
6
|
* fake score. Run: PROGRAMBENCH_FIXTURES=1 npx tsx --test src/benchmarks/programbench.test.mts
|
|
7
7
|
*/
|
|
@@ -14,21 +14,21 @@ process.env.PROGRAMBENCH_FIXTURES = '1'
|
|
|
14
14
|
type Events = Parameters<typeof programbenchSubmissionOutput.parse>[0]
|
|
15
15
|
const stream = (text: string): Events => [{ data: { finalText: text } }] as unknown as Events
|
|
16
16
|
|
|
17
|
-
test('
|
|
17
|
+
test('loadAll (fixtures) yields cleanroom tasks with instance metadata + submission contract', async () => {
|
|
18
18
|
const a = createProgrambenchAdapter()
|
|
19
|
-
const tasks = await a.
|
|
19
|
+
const tasks = await a.loadAll({ ids: ['abishekvashok__cmatrix.5c082c6'] })
|
|
20
20
|
assert.equal(tasks.length, 1)
|
|
21
21
|
const t = tasks[0]
|
|
22
22
|
assert.equal(t.id, 'abishekvashok__cmatrix.5c082c6')
|
|
23
|
-
assert.match(t.prompt, /compile\.sh/)
|
|
24
|
-
assert.match(t.prompt, /path:<relative\/path>/)
|
|
23
|
+
assert.match(t.payload.prompt, /compile\.sh/)
|
|
24
|
+
assert.match(t.payload.prompt, /path:<relative\/path>/)
|
|
25
25
|
const md = t.metadata as Record<string, unknown>
|
|
26
26
|
assert.equal(md.instanceId, 'abishekvashok__cmatrix.5c082c6')
|
|
27
27
|
})
|
|
28
28
|
|
|
29
|
-
test('
|
|
29
|
+
test('loadAll limit slices the fixture set', async () => {
|
|
30
30
|
const a = createProgrambenchAdapter()
|
|
31
|
-
const tasks = await a.
|
|
31
|
+
const tasks = await a.loadAll({ limit: 2 })
|
|
32
32
|
assert.equal(tasks.length, 2)
|
|
33
33
|
})
|
|
34
34
|
|
|
@@ -46,13 +46,13 @@ test('submission OutputAdapter: no file block → empty (fail-closed, harness sc
|
|
|
46
46
|
|
|
47
47
|
test('goldArtifact is undefined — oracle is stripped original source, documented, not fabricated', async () => {
|
|
48
48
|
const a = createProgrambenchAdapter()
|
|
49
|
-
const [t] = await a.
|
|
50
|
-
assert.equal(await a.goldArtifact(t), undefined)
|
|
49
|
+
const [t] = await a.loadAll({ ids: ['abishekvashok__cmatrix.5c082c6'] })
|
|
50
|
+
assert.equal(await a.runtime.goldArtifact?.(t), undefined)
|
|
51
51
|
})
|
|
52
52
|
|
|
53
53
|
test('preflight FAILS LOUD with the install/Docker fix when the harness is absent', async () => {
|
|
54
54
|
const a = createProgrambenchAdapter()
|
|
55
|
-
await assert.rejects(a.preflight(), (e: Error) => {
|
|
55
|
+
await assert.rejects(a.runtime.preflight!(), (e: Error) => {
|
|
56
56
|
assert.match(e.message, /pip install programbench/)
|
|
57
57
|
assert.match(e.message, /amd64/)
|
|
58
58
|
return true
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* harness: it extracts the submission, runs compile.sh in the per-task cleanroom
|
|
8
8
|
* Docker image, then runs the HIDDEN behavioral pytest suites (pulled via
|
|
9
9
|
* `programbench blob sync`). Score = fraction of non-ignored tests passed
|
|
10
|
-
* (GRADED, applying the tests.json ignore mask);
|
|
10
|
+
* (GRADED, applying the tests.json ignore mask); passed = all non-ignored tests
|
|
11
11
|
* pass. Fully deterministic — no LLM judge.
|
|
12
12
|
*
|
|
13
13
|
* OutputAdapter is stream-only, so the worker emits its codebase as fenced
|
|
@@ -27,7 +27,7 @@ import { join } from 'node:path'
|
|
|
27
27
|
import { readFile } from 'node:fs/promises'
|
|
28
28
|
import type { OutputAdapter } from '@tangle-network/agent-runtime/kernel'
|
|
29
29
|
import { benchRoot, preflightVenvImports, runVenvScriptStdin } from './_harness'
|
|
30
|
-
import
|
|
30
|
+
import { type BenchEvaluation, type BenchTask, type LoadOptions, type RuntimeBenchmark, runtimeBenchmark } from './types'
|
|
31
31
|
|
|
32
32
|
const FIXTURES = join(benchRoot, 'fixtures', 'programbench.json')
|
|
33
33
|
|
|
@@ -56,7 +56,7 @@ function fixtureToTask(f: PbFixture): BenchTask {
|
|
|
56
56
|
const meta: PbMeta = { instanceId: f.instance_id, imageName: f.image_name }
|
|
57
57
|
return {
|
|
58
58
|
id: f.instance_id,
|
|
59
|
-
prompt: PROMPT,
|
|
59
|
+
payload: { prompt: PROMPT },
|
|
60
60
|
metadata: meta as unknown as Record<string, unknown>,
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -64,7 +64,7 @@ function fixtureToTask(f: PbFixture): BenchTask {
|
|
|
64
64
|
function readMeta(task: BenchTask): PbMeta {
|
|
65
65
|
const md = task.metadata
|
|
66
66
|
if (!md || typeof md.instanceId !== 'string') {
|
|
67
|
-
throw new Error(`programbench task ${task.id} missing metadata.instanceId —
|
|
67
|
+
throw new Error(`programbench task ${task.id} missing metadata.instanceId — loadAll did not populate it`)
|
|
68
68
|
}
|
|
69
69
|
return md as unknown as PbMeta
|
|
70
70
|
}
|
|
@@ -111,7 +111,7 @@ async function fetchInstanceIds(): Promise<PbFixture[]> {
|
|
|
111
111
|
* then parses <instance_id>.eval.json applying the tests.json ignore mask via
|
|
112
112
|
* `programbench info` logic. Emits {passed,total,resolved} as the last stdout line.
|
|
113
113
|
*/
|
|
114
|
-
async function runHarness(meta: PbMeta, submission: string): Promise<
|
|
114
|
+
async function runHarness(meta: PbMeta, submission: string): Promise<BenchEvaluation> {
|
|
115
115
|
const judge = join(benchRoot, 'scripts', 'programbench_judge.py')
|
|
116
116
|
let stdout: string
|
|
117
117
|
try {
|
|
@@ -134,10 +134,12 @@ async function runHarness(meta: PbMeta, submission: string): Promise<BenchScore>
|
|
|
134
134
|
throw new Error(`programbench judge returned no {passed,total}: ${stdout.slice(0, 400)}`)
|
|
135
135
|
}
|
|
136
136
|
const score = report.total > 0 ? report.passed / report.total : 0
|
|
137
|
+
const raw = { instanceId: meta.instanceId, passed: report.passed, total: report.total }
|
|
137
138
|
return {
|
|
138
|
-
|
|
139
|
+
passed: report.resolved ?? (report.total > 0 && report.passed === report.total),
|
|
139
140
|
score,
|
|
140
|
-
|
|
141
|
+
notes: JSON.stringify(raw),
|
|
142
|
+
raw,
|
|
141
143
|
}
|
|
142
144
|
}
|
|
143
145
|
|
|
@@ -162,26 +164,13 @@ export const programbenchSubmissionOutput: OutputAdapter<string> = {
|
|
|
162
164
|
},
|
|
163
165
|
}
|
|
164
166
|
|
|
165
|
-
export function createProgrambenchAdapter():
|
|
167
|
+
export function createProgrambenchAdapter(): RuntimeBenchmark {
|
|
166
168
|
const fixturesMode = process.env.PROGRAMBENCH_FIXTURES === '1'
|
|
167
169
|
|
|
168
|
-
return {
|
|
169
|
-
|
|
170
|
-
output: programbenchSubmissionOutput,
|
|
171
|
-
|
|
172
|
-
async preflight() {
|
|
173
|
-
await preflightVenvImports({
|
|
174
|
-
modules: ['programbench'],
|
|
175
|
-
requireDocker: true,
|
|
176
|
-
fix:
|
|
177
|
-
`Fix: (1) python3 -m venv bench/.venv && bench/.venv/bin/pip install programbench ; ` +
|
|
178
|
-
`(2) Docker on linux/amd64 (per-task <image>:task_cleanroom images; will NOT run on ARM) ; ` +
|
|
179
|
-
`(3) HF access for the hidden test blobs (the driver runs \`programbench blob sync\`). ` +
|
|
180
|
-
`Set PROGRAMBENCH_FIXTURES=1 to list the committed instance ids offline.`,
|
|
181
|
-
})
|
|
182
|
-
},
|
|
170
|
+
return runtimeBenchmark({
|
|
171
|
+
id: 'programbench',
|
|
183
172
|
|
|
184
|
-
async
|
|
173
|
+
async loadAll(opts: LoadOptions = {}) {
|
|
185
174
|
if (fixturesMode) return loadFixtures(opts)
|
|
186
175
|
let fixtures: PbFixture[]
|
|
187
176
|
try {
|
|
@@ -195,16 +184,32 @@ export function createProgrambenchAdapter(): BenchmarkAdapter {
|
|
|
195
184
|
return selectTasks(fixtures, opts)
|
|
196
185
|
},
|
|
197
186
|
|
|
198
|
-
async
|
|
199
|
-
// The oracle is the original repo's source (stripped from the task image),
|
|
200
|
-
// not redistributable as a portable submission string. Judge correctness is
|
|
201
|
-
// proven by running the real harness on a real solve, not a synthetic gold.
|
|
202
|
-
return undefined
|
|
203
|
-
},
|
|
204
|
-
|
|
205
|
-
async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
|
|
187
|
+
async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
|
|
206
188
|
const meta = readMeta(task)
|
|
207
189
|
return runHarness(meta, artifact)
|
|
208
190
|
},
|
|
209
|
-
|
|
191
|
+
|
|
192
|
+
runtime: {
|
|
193
|
+
output: programbenchSubmissionOutput,
|
|
194
|
+
|
|
195
|
+
async preflight() {
|
|
196
|
+
await preflightVenvImports({
|
|
197
|
+
modules: ['programbench'],
|
|
198
|
+
requireDocker: true,
|
|
199
|
+
fix:
|
|
200
|
+
`Fix: (1) python3 -m venv bench/.venv && bench/.venv/bin/pip install programbench ; ` +
|
|
201
|
+
`(2) Docker on linux/amd64 (per-task <image>:task_cleanroom images; will NOT run on ARM) ; ` +
|
|
202
|
+
`(3) HF access for the hidden test blobs (the driver runs \`programbench blob sync\`). ` +
|
|
203
|
+
`Set PROGRAMBENCH_FIXTURES=1 to list the committed instance ids offline.`,
|
|
204
|
+
})
|
|
205
|
+
},
|
|
206
|
+
|
|
207
|
+
async goldArtifact() {
|
|
208
|
+
// The oracle is the original repo's source (stripped from the task image),
|
|
209
|
+
// not redistributable as a portable submission string. Judge correctness is
|
|
210
|
+
// proven by running the real harness on a real solve, not a synthetic gold.
|
|
211
|
+
return undefined
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
})
|
|
210
215
|
}
|
|
@@ -30,7 +30,7 @@ async function withEnv<T>(patch: Record<string, string | undefined>, fn: () => P
|
|
|
30
30
|
|
|
31
31
|
test('RAG benchmark adapters are registered', () => {
|
|
32
32
|
for (const key of ['ragbench', 'crag', 'nomiracl', 'open-rag-bench', 't2-ragbench']) {
|
|
33
|
-
assert.equal(resolveAdapter(key).
|
|
33
|
+
assert.equal(resolveAdapter(key).id, key)
|
|
34
34
|
}
|
|
35
35
|
})
|
|
36
36
|
|
|
@@ -51,50 +51,50 @@ test('RAG JSON reader accepts object-starting JSONL exports', async () => {
|
|
|
51
51
|
test('RAGBench fixture mode loads rows and scores final answers', async () => {
|
|
52
52
|
await withEnv({ RAGBENCH_FIXTURES: '1', RAGBENCH_DATA_FILE: undefined }, async () => {
|
|
53
53
|
const adapter = createRagBenchAdapter()
|
|
54
|
-
await adapter.preflight()
|
|
55
|
-
const [task] = await adapter.
|
|
54
|
+
await adapter.runtime.preflight!()
|
|
55
|
+
const [task] = await adapter.loadAll({ limit: 1 })
|
|
56
56
|
assert.equal(task.id, 'ragbench-fixture-0')
|
|
57
|
-
const gold = await adapter.goldArtifact(task)
|
|
58
|
-
assert.equal((await adapter.
|
|
59
|
-
assert.equal((await adapter.
|
|
57
|
+
const gold = await adapter.runtime.goldArtifact!(task)
|
|
58
|
+
assert.equal((await adapter.evaluate(task, gold ?? '')).passed, true)
|
|
59
|
+
assert.equal((await adapter.evaluate(task, `${FINAL_ANSWER_SENTINEL} 90 days`)).passed, false)
|
|
60
60
|
})
|
|
61
61
|
|
|
62
62
|
await withEnv({ RAGBENCH_FIXTURES: undefined, RAGBENCH_DATA_FILE: undefined }, async () => {
|
|
63
|
-
await assert.rejects(() => createRagBenchAdapter().preflight(), /RAGBENCH_DATA_FILE is required/)
|
|
63
|
+
await assert.rejects(() => createRagBenchAdapter().runtime.preflight!(), /RAGBENCH_DATA_FILE is required/)
|
|
64
64
|
})
|
|
65
65
|
})
|
|
66
66
|
|
|
67
67
|
test('CRAG fixture mode exposes domain slices and answer judging', async () => {
|
|
68
68
|
await withEnv({ CRAG_FIXTURES: '1', CRAG_DATA_FILE: undefined }, async () => {
|
|
69
69
|
const adapter = createCragAdapter()
|
|
70
|
-
await adapter.preflight()
|
|
71
|
-
const [task] = await adapter.
|
|
72
|
-
assert.equal(task.
|
|
73
|
-
assert.equal((await adapter.
|
|
74
|
-
assert.equal((await adapter.
|
|
70
|
+
await adapter.runtime.preflight!()
|
|
71
|
+
const [task] = await adapter.loadAll({ limit: 1 })
|
|
72
|
+
assert.equal(task.payload.subset, 'finance')
|
|
73
|
+
assert.equal((await adapter.evaluate(task, `${FINAL_ANSWER_SENTINEL} 12.4 billion dollars`)).score, 1)
|
|
74
|
+
assert.equal((await adapter.evaluate(task, `${FINAL_ANSWER_SENTINEL} 9 billion dollars`)).passed, false)
|
|
75
75
|
})
|
|
76
76
|
|
|
77
77
|
await withEnv({ CRAG_FIXTURES: undefined, CRAG_DATA_FILE: undefined }, async () => {
|
|
78
|
-
await assert.rejects(() => createCragAdapter().preflight(), /CRAG_DATA_FILE is required/)
|
|
78
|
+
await assert.rejects(() => createCragAdapter().runtime.preflight!(), /CRAG_DATA_FILE is required/)
|
|
79
79
|
})
|
|
80
80
|
})
|
|
81
81
|
|
|
82
82
|
test('NoMIRACL fixture mode scores answerable and unanswerable classifications', async () => {
|
|
83
83
|
await withEnv({ NOMIRACL_FIXTURES: '1', NOMIRACL_DATA_FILE: undefined }, async () => {
|
|
84
84
|
const adapter = createNoMiraclAdapter()
|
|
85
|
-
await adapter.preflight()
|
|
86
|
-
const tasks = await adapter.
|
|
85
|
+
await adapter.runtime.preflight!()
|
|
86
|
+
const tasks = await adapter.loadAll({})
|
|
87
87
|
const relevant = tasks.find((task) => task.id === 'nomiracl-fixture-relevant')
|
|
88
88
|
const nonRelevant = tasks.find((task) => task.id === 'nomiracl-fixture-non-relevant')
|
|
89
89
|
assert.ok(relevant)
|
|
90
90
|
assert.ok(nonRelevant)
|
|
91
|
-
assert.equal((await adapter.
|
|
92
|
-
assert.equal((await adapter.
|
|
93
|
-
assert.equal((await adapter.
|
|
91
|
+
assert.equal((await adapter.evaluate(relevant, 'ANSWERABLE')).score, 1)
|
|
92
|
+
assert.equal((await adapter.evaluate(nonRelevant, 'UNANSWERABLE')).score, 1)
|
|
93
|
+
assert.equal((await adapter.evaluate(nonRelevant, 'ANSWERABLE')).score, 0)
|
|
94
94
|
})
|
|
95
95
|
|
|
96
96
|
await withEnv({ NOMIRACL_FIXTURES: undefined, NOMIRACL_DATA_FILE: undefined }, async () => {
|
|
97
|
-
await assert.rejects(() => createNoMiraclAdapter().preflight(), /NOMIRACL_DATA_FILE is required/)
|
|
97
|
+
await assert.rejects(() => createNoMiraclAdapter().runtime.preflight!(), /NOMIRACL_DATA_FILE is required/)
|
|
98
98
|
})
|
|
99
99
|
})
|
|
100
100
|
|
|
@@ -103,11 +103,11 @@ test('Open RAG Bench fixture mode keeps PDF modality metadata and scores answers
|
|
|
103
103
|
{ OPEN_RAG_BENCH_FIXTURES: '1', OPEN_RAG_BENCH_DATA_FILE: undefined },
|
|
104
104
|
async () => {
|
|
105
105
|
const adapter = createOpenRagBenchAdapter()
|
|
106
|
-
await adapter.preflight()
|
|
107
|
-
const [task] = await adapter.
|
|
108
|
-
assert.equal(task.
|
|
109
|
-
assert.equal((await adapter.
|
|
110
|
-
assert.equal((await adapter.
|
|
106
|
+
await adapter.runtime.preflight!()
|
|
107
|
+
const [task] = await adapter.loadAll({ limit: 1 })
|
|
108
|
+
assert.equal(task.payload.subset, 'table')
|
|
109
|
+
assert.equal((await adapter.evaluate(task, `${FINAL_ANSWER_SENTINEL} Hybrid BM25`)).passed, true)
|
|
110
|
+
assert.equal((await adapter.evaluate(task, `${FINAL_ANSWER_SENTINEL} Dense`)).passed, false)
|
|
111
111
|
},
|
|
112
112
|
)
|
|
113
113
|
|
|
@@ -115,7 +115,7 @@ test('Open RAG Bench fixture mode keeps PDF modality metadata and scores answers
|
|
|
115
115
|
{ OPEN_RAG_BENCH_FIXTURES: undefined, OPEN_RAG_BENCH_DATA_FILE: undefined },
|
|
116
116
|
async () => {
|
|
117
117
|
await assert.rejects(
|
|
118
|
-
() => createOpenRagBenchAdapter().preflight(),
|
|
118
|
+
() => createOpenRagBenchAdapter().runtime.preflight!(),
|
|
119
119
|
/OPEN_RAG_BENCH_DATA_FILE is required/,
|
|
120
120
|
)
|
|
121
121
|
},
|
|
@@ -125,14 +125,14 @@ test('Open RAG Bench fixture mode keeps PDF modality metadata and scores answers
|
|
|
125
125
|
test('T2-RAGBench fixture mode scores numeric text-table answers', async () => {
|
|
126
126
|
await withEnv({ T2_RAGBENCH_FIXTURES: '1', T2_RAGBENCH_DATA_FILE: undefined }, async () => {
|
|
127
127
|
const adapter = createT2RagBenchAdapter()
|
|
128
|
-
await adapter.preflight()
|
|
129
|
-
const [task] = await adapter.
|
|
130
|
-
assert.equal(task.
|
|
131
|
-
assert.equal((await adapter.
|
|
132
|
-
assert.equal((await adapter.
|
|
128
|
+
await adapter.runtime.preflight!()
|
|
129
|
+
const [task] = await adapter.loadAll({ limit: 1 })
|
|
130
|
+
assert.equal(task.payload.subset, 'finqa')
|
|
131
|
+
assert.equal((await adapter.evaluate(task, `${FINAL_ANSWER_SENTINEL} 12.0 percent`)).passed, true)
|
|
132
|
+
assert.equal((await adapter.evaluate(task, `${FINAL_ANSWER_SENTINEL} 8 percent`)).passed, false)
|
|
133
133
|
})
|
|
134
134
|
|
|
135
135
|
await withEnv({ T2_RAGBENCH_FIXTURES: undefined, T2_RAGBENCH_DATA_FILE: undefined }, async () => {
|
|
136
|
-
await assert.rejects(() => createT2RagBenchAdapter().preflight(), /T2_RAGBENCH_DATA_FILE is required/)
|
|
136
|
+
await assert.rejects(() => createT2RagBenchAdapter().runtime.preflight!(), /T2_RAGBENCH_DATA_FILE is required/)
|
|
137
137
|
})
|
|
138
138
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises'
|
|
2
2
|
import type { OutputAdapter } from '@tangle-network/agent-runtime/kernel'
|
|
3
|
-
import type {
|
|
3
|
+
import type { BenchEvaluation, BenchTask, LoadOptions } from './types'
|
|
4
4
|
|
|
5
5
|
export const FINAL_ANSWER_SENTINEL = 'FINAL ANSWER:'
|
|
6
6
|
|
|
@@ -168,23 +168,20 @@ export function scoreAnswerArtifact(
|
|
|
168
168
|
return best
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
export function
|
|
171
|
+
export function answerScoreToEvaluation(
|
|
172
172
|
score: RagAnswerScore,
|
|
173
173
|
detail: Record<string, unknown>,
|
|
174
|
-
):
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
numeric: score.numeric,
|
|
184
|
-
f1: score.f1,
|
|
185
|
-
threshold: score.threshold,
|
|
186
|
-
}),
|
|
174
|
+
): BenchEvaluation {
|
|
175
|
+
const raw = {
|
|
176
|
+
...detail,
|
|
177
|
+
finalAnswer: score.finalAnswer,
|
|
178
|
+
bestGold: score.bestGold,
|
|
179
|
+
exact: score.exact,
|
|
180
|
+
numeric: score.numeric,
|
|
181
|
+
f1: score.f1,
|
|
182
|
+
threshold: score.threshold,
|
|
187
183
|
}
|
|
184
|
+
return { passed: score.resolved, score: score.score, notes: JSON.stringify(raw), raw }
|
|
188
185
|
}
|
|
189
186
|
|
|
190
187
|
export async function readJsonRows(path: string): Promise<unknown[]> {
|
|
@@ -219,7 +216,7 @@ export async function readJsonRows(path: string): Promise<unknown[]> {
|
|
|
219
216
|
|
|
220
217
|
export function selectTasks(tasks: BenchTask[], opts: LoadOptions, label: string): BenchTask[] {
|
|
221
218
|
let selected = tasks
|
|
222
|
-
if (opts.
|
|
219
|
+
if (opts.subset) selected = selected.filter((task) => task.payload.subset === opts.subset)
|
|
223
220
|
if (opts.ids) {
|
|
224
221
|
const ids = new Set(opts.ids)
|
|
225
222
|
selected = selected.filter((task) => ids.has(task.id))
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
import { readFile } from 'node:fs/promises'
|
|
12
12
|
import { join } from 'node:path'
|
|
13
13
|
import { benchRoot } from './_harness'
|
|
14
|
-
import
|
|
14
|
+
import { type BenchEvaluation, type BenchTask, type LoadOptions, type RuntimeBenchmark, runtimeBenchmark } from './types'
|
|
15
15
|
import {
|
|
16
16
|
FINAL_ANSWER_SENTINEL,
|
|
17
17
|
allStrings,
|
|
18
|
-
|
|
18
|
+
answerScoreToEvaluation,
|
|
19
19
|
contextBlock,
|
|
20
20
|
contextsFrom,
|
|
21
21
|
firstString,
|
|
@@ -91,16 +91,18 @@ function rowToTask(raw: unknown, index: number): BenchTask {
|
|
|
91
91
|
}
|
|
92
92
|
return {
|
|
93
93
|
id,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
94
|
+
payload: {
|
|
95
|
+
subset: stringFrom(raw.split) ?? dataset ?? 'ragbench',
|
|
96
|
+
prompt: [
|
|
97
|
+
'Answer this RAGBench question using the supplied retrieved context.',
|
|
98
|
+
'End with a single final line: `FINAL ANSWER: <answer>`.',
|
|
99
|
+
'',
|
|
100
|
+
`Question: ${query}`,
|
|
101
|
+
contexts.length > 0 ? `\nRetrieved context:\n${contextBlock(contexts)}` : undefined,
|
|
102
|
+
]
|
|
103
|
+
.filter(Boolean)
|
|
104
|
+
.join('\n'),
|
|
105
|
+
},
|
|
104
106
|
metadata: meta as unknown as Record<string, unknown>,
|
|
105
107
|
}
|
|
106
108
|
}
|
|
@@ -108,7 +110,7 @@ function rowToTask(raw: unknown, index: number): BenchTask {
|
|
|
108
110
|
function readMeta(task: BenchTask): RagBenchMeta {
|
|
109
111
|
const md = task.metadata
|
|
110
112
|
if (!md || !Array.isArray(md.goldAnswers)) {
|
|
111
|
-
throw new Error(`RAGBench task ${task.id} missing metadata —
|
|
113
|
+
throw new Error(`RAGBench task ${task.id} missing metadata — loadAll did not populate it`)
|
|
112
114
|
}
|
|
113
115
|
return md as unknown as RagBenchMeta
|
|
114
116
|
}
|
|
@@ -125,47 +127,50 @@ async function loadFixtures(opts: LoadOptions): Promise<BenchTask[]> {
|
|
|
125
127
|
return selectTasks(rows.map(rowToTask), opts, 'RAGBench')
|
|
126
128
|
}
|
|
127
129
|
|
|
128
|
-
export function createRagBenchAdapter():
|
|
130
|
+
export function createRagBenchAdapter(): RuntimeBenchmark {
|
|
129
131
|
const fixturesMode = process.env.RAGBENCH_FIXTURES === '1'
|
|
130
132
|
|
|
131
|
-
return {
|
|
132
|
-
|
|
133
|
-
output: ragAnswerOutput,
|
|
134
|
-
|
|
135
|
-
async preflight() {
|
|
136
|
-
if (fixturesMode) {
|
|
137
|
-
await readFile(FIXTURES, 'utf8')
|
|
138
|
-
return
|
|
139
|
-
}
|
|
140
|
-
const path = dataFile()
|
|
141
|
-
if (!path) {
|
|
142
|
-
throw new Error(
|
|
143
|
-
'RAGBENCH_DATA_FILE is required. Fix: export rungalileo/ragbench rows to JSONL and set RAGBENCH_DATA_FILE=/path/to/ragbench.jsonl, or set RAGBENCH_FIXTURES=1 for adapter plumbing.',
|
|
144
|
-
)
|
|
145
|
-
}
|
|
146
|
-
await loadRows(path)
|
|
147
|
-
},
|
|
133
|
+
return runtimeBenchmark({
|
|
134
|
+
id: 'ragbench',
|
|
148
135
|
|
|
149
|
-
async
|
|
136
|
+
async loadAll(opts: LoadOptions = {}) {
|
|
150
137
|
if (fixturesMode) return loadFixtures(opts)
|
|
151
138
|
const path = dataFile()
|
|
152
139
|
if (!path) throw new Error('RAGBENCH_DATA_FILE is required to load RAGBench tasks')
|
|
153
140
|
return selectTasks((await loadRows(path)).map(rowToTask), opts, 'RAGBench')
|
|
154
141
|
},
|
|
155
142
|
|
|
156
|
-
async
|
|
157
|
-
return `${FINAL_ANSWER_SENTINEL} ${readMeta(task).goldAnswers[0] ?? ''}`
|
|
158
|
-
},
|
|
159
|
-
|
|
160
|
-
async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
|
|
143
|
+
async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
|
|
161
144
|
const meta = readMeta(task)
|
|
162
145
|
const score = scoreAnswerArtifact(artifact, meta.goldAnswers)
|
|
163
|
-
return
|
|
146
|
+
return answerScoreToEvaluation(score, {
|
|
164
147
|
benchmark: meta.benchmark,
|
|
165
148
|
dataset: meta.dataset ?? null,
|
|
166
149
|
traceLabels: meta.traceLabels,
|
|
167
150
|
contextCount: meta.contexts.length,
|
|
168
151
|
})
|
|
169
152
|
},
|
|
170
|
-
|
|
153
|
+
|
|
154
|
+
runtime: {
|
|
155
|
+
output: ragAnswerOutput,
|
|
156
|
+
|
|
157
|
+
async preflight() {
|
|
158
|
+
if (fixturesMode) {
|
|
159
|
+
await readFile(FIXTURES, 'utf8')
|
|
160
|
+
return
|
|
161
|
+
}
|
|
162
|
+
const path = dataFile()
|
|
163
|
+
if (!path) {
|
|
164
|
+
throw new Error(
|
|
165
|
+
'RAGBENCH_DATA_FILE is required. Fix: export rungalileo/ragbench rows to JSONL and set RAGBENCH_DATA_FILE=/path/to/ragbench.jsonl, or set RAGBENCH_FIXTURES=1 for adapter plumbing.',
|
|
166
|
+
)
|
|
167
|
+
}
|
|
168
|
+
await loadRows(path)
|
|
169
|
+
},
|
|
170
|
+
|
|
171
|
+
async goldArtifact(task: BenchTask) {
|
|
172
|
+
return `${FINAL_ANSWER_SENTINEL} ${readMeta(task).goldAnswers[0] ?? ''}`
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
})
|
|
171
176
|
}
|