@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
|
@@ -180,14 +180,14 @@ describe('mcad-cq delivery gates', () => {
|
|
|
180
180
|
describe('mcad-cq task loading', () => {
|
|
181
181
|
it('carries spec/source/calibrated metadata and a CadQuery gold for every task', async () => {
|
|
182
182
|
const a = createMcadCqAdapter()
|
|
183
|
-
const tasks = await a.
|
|
183
|
+
const tasks = await a.loadAll()
|
|
184
184
|
expect(tasks).toHaveLength(MCAD_TASKS.length)
|
|
185
185
|
for (const t of tasks) {
|
|
186
186
|
const md = t.metadata as { spec: unknown; source: string; calibrated: boolean }
|
|
187
187
|
expect(md.spec, t.id).toBeTruthy()
|
|
188
188
|
expect(typeof md.source).toBe('string')
|
|
189
189
|
expect(md.calibrated, t.id).toBe(!MCAD_CQ_UNCALIBRATED.has(t.id))
|
|
190
|
-
const gold = await a.goldArtifact(t)
|
|
190
|
+
const gold = await a.runtime.goldArtifact!(t)
|
|
191
191
|
expect(typeof gold, t.id).toBe('string')
|
|
192
192
|
expect(gold, t.id).toContain('import cadquery as cq')
|
|
193
193
|
expect(gold, t.id).toContain('cq.exporters.export(result, "part.step")')
|
|
@@ -197,17 +197,17 @@ describe('mcad-cq task loading', () => {
|
|
|
197
197
|
|
|
198
198
|
it('honours ids and limit', async () => {
|
|
199
199
|
const a = createMcadCqAdapter()
|
|
200
|
-
expect((await a.
|
|
201
|
-
expect(await a.
|
|
200
|
+
expect((await a.loadAll({ ids: ['l-bracket'] })).map((t) => t.id)).toEqual(['l-bracket'])
|
|
201
|
+
expect(await a.loadAll({ limit: 3 })).toHaveLength(3)
|
|
202
202
|
})
|
|
203
203
|
|
|
204
204
|
it('scores an empty artifact 0 without starting an interpreter', async () => {
|
|
205
205
|
const a = createMcadCqAdapter()
|
|
206
|
-
const [t] = await a.
|
|
207
|
-
const s = await a.
|
|
208
|
-
expect(s.
|
|
206
|
+
const [t] = await a.loadAll({ ids: ['calibration-block'] })
|
|
207
|
+
const s = await a.evaluate(t!, ' ')
|
|
208
|
+
expect(s.passed).toBe(false)
|
|
209
209
|
expect(s.score).toBe(0)
|
|
210
|
-
expect(s.
|
|
210
|
+
expect(s.notes).toBe('empty artifact')
|
|
211
211
|
})
|
|
212
212
|
})
|
|
213
213
|
|
|
@@ -252,7 +252,7 @@ const NO_STEP_EXPORT = MCAD_CQ_GOLDS['calibration-block']!.replace('cq.exporters
|
|
|
252
252
|
|
|
253
253
|
describe.skipIf(!CADQUERY)('mcad-cq judge, live cadquery', () => {
|
|
254
254
|
it('preflight passes when the interpreter is present', async () => {
|
|
255
|
-
await expect(createMcadCqAdapter().preflight()).resolves.toBeUndefined()
|
|
255
|
+
await expect(createMcadCqAdapter().runtime.preflight!()).resolves.toBeUndefined()
|
|
256
256
|
}, JUDGE_TIMEOUT)
|
|
257
257
|
|
|
258
258
|
for (const task of MCAD_TASKS.filter((t) => !MCAD_CQ_UNCALIBRATED.has(t.id))) {
|
|
@@ -260,15 +260,15 @@ describe.skipIf(!CADQUERY)('mcad-cq judge, live cadquery', () => {
|
|
|
260
260
|
`gold for ${task.id} resolves at score 1.0`,
|
|
261
261
|
async () => {
|
|
262
262
|
const a = createMcadCqAdapter()
|
|
263
|
-
const [t] = await a.
|
|
264
|
-
const gold = await a.goldArtifact(t!)
|
|
263
|
+
const [t] = await a.loadAll({ ids: [task.id] })
|
|
264
|
+
const gold = await a.runtime.goldArtifact!(t!)
|
|
265
265
|
expect(typeof gold).toBe('string')
|
|
266
|
-
const s = await a.
|
|
267
|
-
const detail = JSON.parse(s.
|
|
268
|
-
expect(detail.failed ?? [], `failed checks: ${s.
|
|
266
|
+
const s = await a.evaluate(t!, gold as string)
|
|
267
|
+
const detail = JSON.parse(s.notes ?? '{}')
|
|
268
|
+
expect(detail.failed ?? [], `failed checks: ${s.notes}`).toEqual([])
|
|
269
269
|
expect(detail.checks?.stepEmitted).toBe(true)
|
|
270
270
|
expect(s.score).toBe(1)
|
|
271
|
-
expect(s.
|
|
271
|
+
expect(s.passed).toBe(true)
|
|
272
272
|
},
|
|
273
273
|
JUDGE_TIMEOUT,
|
|
274
274
|
)
|
|
@@ -278,10 +278,10 @@ describe.skipIf(!CADQUERY)('mcad-cq judge, live cadquery', () => {
|
|
|
278
278
|
'grades a fenced answer identically — the fence is a formatting slip, not geometry',
|
|
279
279
|
async () => {
|
|
280
280
|
const a = createMcadCqAdapter()
|
|
281
|
-
const [t] = await a.
|
|
282
|
-
const s = await a.
|
|
281
|
+
const [t] = await a.loadAll({ ids: ['calibration-block'] })
|
|
282
|
+
const s = await a.evaluate(t!, `\`\`\`python\n${MCAD_CQ_GOLDS['calibration-block']!.trim()}\n\`\`\``)
|
|
283
283
|
expect(s.score).toBe(1)
|
|
284
|
-
expect(s.
|
|
284
|
+
expect(s.passed).toBe(true)
|
|
285
285
|
},
|
|
286
286
|
JUDGE_TIMEOUT,
|
|
287
287
|
)
|
|
@@ -290,12 +290,12 @@ describe.skipIf(!CADQUERY)('mcad-cq judge, live cadquery', () => {
|
|
|
290
290
|
'MUST REJECT: one bore of four deleted fails its named probes and nothing else',
|
|
291
291
|
async () => {
|
|
292
292
|
const a = createMcadCqAdapter()
|
|
293
|
-
const [t] = await a.
|
|
294
|
-
const s = await a.
|
|
295
|
-
expect(s.
|
|
293
|
+
const [t] = await a.loadAll({ ids: ['calibration-block'] })
|
|
294
|
+
const s = await a.evaluate(t!, BLOCK_MISSING_ONE_BORE)
|
|
295
|
+
expect(s.passed).toBe(false)
|
|
296
296
|
expect(s.score).toBeGreaterThan(0)
|
|
297
297
|
expect(s.score).toBeLessThan(1)
|
|
298
|
-
const failed = (JSON.parse(s.
|
|
298
|
+
const failed = (JSON.parse(s.notes as string).failed as Array<{ name: string }>).map((f) => f.name)
|
|
299
299
|
// the deleted bore is the (35, 20) one: its centre probe and the 3 mm-off
|
|
300
300
|
// probe both now sit in solid material
|
|
301
301
|
expect(failed).toContain('probeOutside[0] (35, 20, 10)')
|
|
@@ -314,13 +314,13 @@ describe.skipIf(!CADQUERY)('mcad-cq judge, live cadquery', () => {
|
|
|
314
314
|
'MUST REJECT: a script that writes no part.stl scores 0 and the detail says so',
|
|
315
315
|
async () => {
|
|
316
316
|
const a = createMcadCqAdapter()
|
|
317
|
-
const [t] = await a.
|
|
318
|
-
const s = await a.
|
|
319
|
-
expect(s.
|
|
317
|
+
const [t] = await a.loadAll({ ids: ['calibration-block'] })
|
|
318
|
+
const s = await a.evaluate(t!, STEP_ONLY)
|
|
319
|
+
expect(s.passed).toBe(false)
|
|
320
320
|
expect(s.score).toBe(0)
|
|
321
|
-
expect(s.
|
|
321
|
+
expect(s.notes).toMatch(/wrote no part\.stl/)
|
|
322
322
|
// it DID write the STEP file, and the detail says that too
|
|
323
|
-
expect(s.
|
|
323
|
+
expect(s.notes).toMatch(/stepEmitted true/)
|
|
324
324
|
},
|
|
325
325
|
JUDGE_TIMEOUT,
|
|
326
326
|
)
|
|
@@ -329,11 +329,11 @@ describe.skipIf(!CADQUERY)('mcad-cq judge, live cadquery', () => {
|
|
|
329
329
|
'MUST REJECT: a binary STL is a format miss, not a parse problem',
|
|
330
330
|
async () => {
|
|
331
331
|
const a = createMcadCqAdapter()
|
|
332
|
-
const [t] = await a.
|
|
333
|
-
const s = await a.
|
|
334
|
-
expect(s.
|
|
332
|
+
const [t] = await a.loadAll({ ids: ['calibration-block'] })
|
|
333
|
+
const s = await a.evaluate(t!, BINARY_STL)
|
|
334
|
+
expect(s.passed).toBe(false)
|
|
335
335
|
expect(s.score).toBe(0)
|
|
336
|
-
expect(s.
|
|
336
|
+
expect(s.notes).toMatch(/not ASCII/)
|
|
337
337
|
},
|
|
338
338
|
JUDGE_TIMEOUT,
|
|
339
339
|
)
|
|
@@ -342,10 +342,10 @@ describe.skipIf(!CADQUERY)('mcad-cq judge, live cadquery', () => {
|
|
|
342
342
|
'MUST REJECT: dropping the STEP export costs exactly the stepEmitted check',
|
|
343
343
|
async () => {
|
|
344
344
|
const a = createMcadCqAdapter()
|
|
345
|
-
const [t] = await a.
|
|
346
|
-
const s = await a.
|
|
347
|
-
expect(s.
|
|
348
|
-
const detail = JSON.parse(s.
|
|
345
|
+
const [t] = await a.loadAll({ ids: ['calibration-block'] })
|
|
346
|
+
const s = await a.evaluate(t!, NO_STEP_EXPORT)
|
|
347
|
+
expect(s.passed).toBe(false)
|
|
348
|
+
const detail = JSON.parse(s.notes as string) as {
|
|
349
349
|
failed: Array<{ name: string }>
|
|
350
350
|
checks: Record<string, boolean>
|
|
351
351
|
stepEmitted: boolean
|
|
@@ -374,12 +374,12 @@ describe.skipIf(!CADQUERY)('mcad-cq judge, live cadquery', () => {
|
|
|
374
374
|
'MUST REJECT: a script that raises is scored 0 with its traceback in the detail',
|
|
375
375
|
async () => {
|
|
376
376
|
const a = createMcadCqAdapter()
|
|
377
|
-
const [t] = await a.
|
|
378
|
-
const s = await a.
|
|
379
|
-
expect(s.
|
|
377
|
+
const [t] = await a.loadAll({ ids: ['calibration-block'] })
|
|
378
|
+
const s = await a.evaluate(t!, 'import cadquery as cq\nraise SystemExit("no model here")\n')
|
|
379
|
+
expect(s.passed).toBe(false)
|
|
380
380
|
expect(s.score).toBe(0)
|
|
381
|
-
expect(s.
|
|
382
|
-
expect(s.
|
|
381
|
+
expect(s.notes).toMatch(/script failed:/)
|
|
382
|
+
expect(s.notes).toMatch(/no model here/)
|
|
383
383
|
},
|
|
384
384
|
JUDGE_TIMEOUT,
|
|
385
385
|
)
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* These are CALIBRATION artifacts, not exemplar answers: their whole job is to
|
|
5
5
|
* prove the judge's accept direction fires, so they are written plain (no clever
|
|
6
6
|
* parametrics, `$fn=96` on round features) and every one of them has been run
|
|
7
|
-
* through `createMcadBenchAdapter().
|
|
7
|
+
* through `createMcadBenchAdapter().evaluate()` on this host. A task is marked
|
|
8
8
|
* `calibrated: true` in `mcad-tasks.ts` only when its gold below scores 1.0.
|
|
9
9
|
*
|
|
10
10
|
* Where a gold deviates from the prompt's literal dimensions, the deviation is
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Judge is the published Mind2Web step metric, FULLY DETERMINISTIC — no LLM:
|
|
8
8
|
* element correct ⇔ predicted backend_node_id ∈ pos_candidates ids
|
|
9
9
|
* operation correct ⇔ op-type matches AND (TYPE/SELECT) the value matches
|
|
10
|
-
*
|
|
10
|
+
* passed (Step-SR) ⇔ element correct AND operation correct
|
|
11
11
|
* score = 0.6·element + 0.4·operation (a gradient for the optimizer; the right
|
|
12
12
|
* element is most of the credit, mirroring Element-Acc ≫ Op as the lever)
|
|
13
13
|
* This is the low-noise reward a certifiable directive-lift needs: the number is a
|
|
@@ -31,7 +31,7 @@ import { tmpdir } from 'node:os'
|
|
|
31
31
|
import { join } from 'node:path'
|
|
32
32
|
import { fileURLToPath } from 'node:url'
|
|
33
33
|
import { promisify } from 'node:util'
|
|
34
|
-
import
|
|
34
|
+
import { type BenchEvaluation, type BenchTask, type LoadOptions, type RuntimeBenchmark, runtimeBenchmark } from './types'
|
|
35
35
|
|
|
36
36
|
const execFileAsync = promisify(execFile)
|
|
37
37
|
const BENCH_ROOT = fileURLToPath(new URL('../..', import.meta.url))
|
|
@@ -189,8 +189,10 @@ function rowToTask(row: Mind2WebRow): BenchTask {
|
|
|
189
189
|
}
|
|
190
190
|
return {
|
|
191
191
|
id: `mind2web-${row.id}`,
|
|
192
|
-
|
|
193
|
-
|
|
192
|
+
payload: {
|
|
193
|
+
subset: DEFAULT_SPLIT,
|
|
194
|
+
prompt: buildPrompt(row),
|
|
195
|
+
},
|
|
194
196
|
metadata: meta as unknown as Record<string, unknown>,
|
|
195
197
|
}
|
|
196
198
|
}
|
|
@@ -198,7 +200,7 @@ function rowToTask(row: Mind2WebRow): BenchTask {
|
|
|
198
200
|
function readMeta(task: BenchTask): Mind2WebMeta {
|
|
199
201
|
const md = task.metadata
|
|
200
202
|
if (!md || !Array.isArray((md as { goldIds?: unknown }).goldIds)) {
|
|
201
|
-
throw new Error(`mind2web task ${task.id} missing metadata.goldIds —
|
|
203
|
+
throw new Error(`mind2web task ${task.id} missing metadata.goldIds — loadAll did not populate it`)
|
|
202
204
|
}
|
|
203
205
|
return md as unknown as Mind2WebMeta
|
|
204
206
|
}
|
|
@@ -215,7 +217,7 @@ interface ParsedAction {
|
|
|
215
217
|
}
|
|
216
218
|
|
|
217
219
|
/** Parse the worker artifact's ELEMENT / ACTION / VALUE sentinel lines.
|
|
218
|
-
* Fail-closed: a missing ELEMENT or ACTION returns null (judge →
|
|
220
|
+
* Fail-closed: a missing ELEMENT or ACTION returns null (judge → passed=false). */
|
|
219
221
|
export function parseAction(artifact: string): ParsedAction | null {
|
|
220
222
|
const elem = /ELEMENT:\s*\[?(\d+)\]?/i.exec(artifact)
|
|
221
223
|
const op = /ACTION:\s*(CLICK|TYPE|SELECT)/i.exec(artifact)
|
|
@@ -224,36 +226,15 @@ export function parseAction(artifact: string): ParsedAction | null {
|
|
|
224
226
|
return { elementId: elem[1], op: op[1].toUpperCase(), value: (val?.[1] ?? '').trim() }
|
|
225
227
|
}
|
|
226
228
|
|
|
227
|
-
export function createMind2WebAdapter():
|
|
229
|
+
export function createMind2WebAdapter(): RuntimeBenchmark {
|
|
228
230
|
const split = DEFAULT_SPLIT
|
|
229
231
|
|
|
230
|
-
return {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
async preflight() {
|
|
234
|
-
try {
|
|
235
|
-
await py(
|
|
236
|
-
`import os, sys
|
|
237
|
-
from datasets import load_dataset
|
|
238
|
-
import PIL
|
|
239
|
-
ds = load_dataset(${JSON.stringify(DATASET)}, split=${JSON.stringify(split)}, streaming=True)
|
|
240
|
-
next(iter(ds))
|
|
241
|
-
print('ok'); sys.stdout.flush(); os._exit(0)`,
|
|
242
|
-
)
|
|
243
|
-
} catch (err) {
|
|
244
|
-
const msg = err instanceof Error ? err.message : String(err)
|
|
245
|
-
throw new Error(
|
|
246
|
-
`mind2web preflight failed: ${msg}\n` +
|
|
247
|
-
`Fix: (1) a python with datasets + pillow (python3 -m venv bench/.venv && bench/.venv/bin/pip install datasets pillow) ; ` +
|
|
248
|
-
`(2) network access to Hugging Face for ${DATASET} (split ${split}) ; ` +
|
|
249
|
-
`point M2W_PYTHON at the python if not bench/.venv.`,
|
|
250
|
-
)
|
|
251
|
-
}
|
|
252
|
-
},
|
|
232
|
+
return runtimeBenchmark({
|
|
233
|
+
id: 'mind2web',
|
|
253
234
|
|
|
254
|
-
async
|
|
235
|
+
async loadAll(opts: LoadOptions = {}) {
|
|
255
236
|
const cfg = {
|
|
256
|
-
split: opts.
|
|
237
|
+
split: opts.subset ?? split,
|
|
257
238
|
limit: opts.ids ? undefined : (opts.limit ?? 10),
|
|
258
239
|
cap: CANDIDATE_CAP,
|
|
259
240
|
shotsDir: SHOTS_DIR,
|
|
@@ -265,24 +246,16 @@ print('ok'); sys.stdout.flush(); os._exit(0)`,
|
|
|
265
246
|
return rows.map(rowToTask)
|
|
266
247
|
},
|
|
267
248
|
|
|
268
|
-
async
|
|
269
|
-
// Gold = the worker-contract serialization of the ground-truth action, so
|
|
270
|
-
// verify-judge proves gold→resolved through the SAME parse path the real
|
|
271
|
-
// artifact takes. The first accepted positive id is the canonical target.
|
|
272
|
-
const meta = readMeta(task)
|
|
273
|
-
const id = meta.goldIds[0]
|
|
274
|
-
if (!id) return undefined
|
|
275
|
-
return `ELEMENT: ${id}\nACTION: ${meta.op}\nVALUE: ${meta.value}`
|
|
276
|
-
},
|
|
277
|
-
|
|
278
|
-
async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
|
|
249
|
+
async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
|
|
279
250
|
const meta = readMeta(task)
|
|
280
251
|
const parsed = parseAction(artifact)
|
|
281
252
|
if (!parsed) {
|
|
253
|
+
const raw = { reason: 'no parseable ELEMENT/ACTION', goldOp: meta.op, goldIds: meta.goldIds }
|
|
282
254
|
return {
|
|
283
|
-
|
|
255
|
+
passed: false,
|
|
284
256
|
score: 0,
|
|
285
|
-
|
|
257
|
+
notes: JSON.stringify(raw),
|
|
258
|
+
raw,
|
|
286
259
|
}
|
|
287
260
|
}
|
|
288
261
|
const elementCorrect = meta.goldIds.includes(parsed.elementId)
|
|
@@ -291,21 +264,56 @@ print('ok'); sys.stdout.flush(); os._exit(0)`,
|
|
|
291
264
|
const operationCorrect = opMatch && valueMatch
|
|
292
265
|
const resolved = elementCorrect && operationCorrect
|
|
293
266
|
const score = 0.6 * (elementCorrect ? 1 : 0) + 0.4 * (operationCorrect ? 1 : 0)
|
|
267
|
+
const raw = {
|
|
268
|
+
elementCorrect,
|
|
269
|
+
opMatch,
|
|
270
|
+
valueMatch,
|
|
271
|
+
predicted: parsed,
|
|
272
|
+
goldOp: meta.op,
|
|
273
|
+
goldValue: meta.value,
|
|
274
|
+
goldIds: meta.goldIds,
|
|
275
|
+
website: meta.website,
|
|
276
|
+
domain: meta.domain,
|
|
277
|
+
}
|
|
294
278
|
return {
|
|
295
|
-
resolved,
|
|
279
|
+
passed: resolved,
|
|
296
280
|
score,
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
opMatch,
|
|
300
|
-
valueMatch,
|
|
301
|
-
predicted: parsed,
|
|
302
|
-
goldOp: meta.op,
|
|
303
|
-
goldValue: meta.value,
|
|
304
|
-
goldIds: meta.goldIds,
|
|
305
|
-
website: meta.website,
|
|
306
|
-
domain: meta.domain,
|
|
307
|
-
}),
|
|
281
|
+
notes: JSON.stringify(raw),
|
|
282
|
+
raw,
|
|
308
283
|
}
|
|
309
284
|
},
|
|
310
|
-
|
|
285
|
+
|
|
286
|
+
runtime: {
|
|
287
|
+
async preflight() {
|
|
288
|
+
try {
|
|
289
|
+
await py(
|
|
290
|
+
`import os, sys
|
|
291
|
+
from datasets import load_dataset
|
|
292
|
+
import PIL
|
|
293
|
+
ds = load_dataset(${JSON.stringify(DATASET)}, split=${JSON.stringify(split)}, streaming=True)
|
|
294
|
+
next(iter(ds))
|
|
295
|
+
print('ok'); sys.stdout.flush(); os._exit(0)`,
|
|
296
|
+
)
|
|
297
|
+
} catch (err) {
|
|
298
|
+
const msg = err instanceof Error ? err.message : String(err)
|
|
299
|
+
throw new Error(
|
|
300
|
+
`mind2web preflight failed: ${msg}\n` +
|
|
301
|
+
`Fix: (1) a python with datasets + pillow (python3 -m venv bench/.venv && bench/.venv/bin/pip install datasets pillow) ; ` +
|
|
302
|
+
`(2) network access to Hugging Face for ${DATASET} (split ${split}) ; ` +
|
|
303
|
+
`point M2W_PYTHON at the python if not bench/.venv.`,
|
|
304
|
+
)
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
|
|
308
|
+
async goldArtifact(task: BenchTask) {
|
|
309
|
+
// Gold = the worker-contract serialization of the ground-truth action, so
|
|
310
|
+
// verify-judge proves gold→passed through the SAME parse path the real
|
|
311
|
+
// artifact takes. The first accepted positive id is the canonical target.
|
|
312
|
+
const meta = readMeta(task)
|
|
313
|
+
const id = meta.goldIds[0]
|
|
314
|
+
if (!id) return undefined
|
|
315
|
+
return `ELEMENT: ${id}\nACTION: ${meta.op}\nVALUE: ${meta.value}`
|
|
316
|
+
},
|
|
317
|
+
},
|
|
318
|
+
})
|
|
311
319
|
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import { readFile } from 'node:fs/promises'
|
|
11
11
|
import { join } from 'node:path'
|
|
12
12
|
import { benchRoot } from './_harness'
|
|
13
|
-
import
|
|
13
|
+
import { type BenchEvaluation, type BenchTask, type LoadOptions, type RuntimeBenchmark, runtimeBenchmark } from './types'
|
|
14
14
|
import {
|
|
15
15
|
contextBlock,
|
|
16
16
|
contextsFrom,
|
|
@@ -84,16 +84,18 @@ function rowToTask(raw: unknown, index: number): BenchTask {
|
|
|
84
84
|
}
|
|
85
85
|
return {
|
|
86
86
|
id,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
87
|
+
payload: {
|
|
88
|
+
subset: stringFrom(raw.split) ?? language,
|
|
89
|
+
prompt: [
|
|
90
|
+
'Classify this NoMIRACL RAG relevance case.',
|
|
91
|
+
'Return exactly one word: ANSWERABLE if at least one supplied passage contains enough evidence to answer the query, otherwise UNANSWERABLE.',
|
|
92
|
+
'',
|
|
93
|
+
`Query: ${query}`,
|
|
94
|
+
contexts.length > 0 ? `\nPassages:\n${contextBlock(contexts)}` : undefined,
|
|
95
|
+
]
|
|
96
|
+
.filter(Boolean)
|
|
97
|
+
.join('\n'),
|
|
98
|
+
},
|
|
97
99
|
metadata: meta as unknown as Record<string, unknown>,
|
|
98
100
|
}
|
|
99
101
|
}
|
|
@@ -101,7 +103,7 @@ function rowToTask(raw: unknown, index: number): BenchTask {
|
|
|
101
103
|
function readMeta(task: BenchTask): NoMiraclMeta {
|
|
102
104
|
const md = task.metadata
|
|
103
105
|
if (!md || typeof md.answerable !== 'boolean') {
|
|
104
|
-
throw new Error(`NoMIRACL task ${task.id} missing metadata —
|
|
106
|
+
throw new Error(`NoMIRACL task ${task.id} missing metadata — loadAll did not populate it`)
|
|
105
107
|
}
|
|
106
108
|
return md as unknown as NoMiraclMeta
|
|
107
109
|
}
|
|
@@ -127,54 +129,59 @@ async function loadFixtures(opts: LoadOptions): Promise<BenchTask[]> {
|
|
|
127
129
|
return selectTasks(rows.map(rowToTask), opts, 'NoMIRACL')
|
|
128
130
|
}
|
|
129
131
|
|
|
130
|
-
export function createNoMiraclAdapter():
|
|
132
|
+
export function createNoMiraclAdapter(): RuntimeBenchmark {
|
|
131
133
|
const fixturesMode = process.env.NOMIRACL_FIXTURES === '1'
|
|
132
134
|
|
|
133
|
-
return {
|
|
134
|
-
|
|
135
|
-
output: ragAnswerOutput,
|
|
136
|
-
|
|
137
|
-
async preflight() {
|
|
138
|
-
if (fixturesMode) {
|
|
139
|
-
await readFile(FIXTURES, 'utf8')
|
|
140
|
-
return
|
|
141
|
-
}
|
|
142
|
-
const path = dataFile()
|
|
143
|
-
if (!path) {
|
|
144
|
-
throw new Error(
|
|
145
|
-
'NOMIRACL_DATA_FILE is required. Fix: export project-miracl/nomiracl rows to JSONL and set NOMIRACL_DATA_FILE=/path/to/nomiracl.jsonl, or set NOMIRACL_FIXTURES=1 for adapter plumbing.',
|
|
146
|
-
)
|
|
147
|
-
}
|
|
148
|
-
await loadRows(path)
|
|
149
|
-
},
|
|
135
|
+
return runtimeBenchmark({
|
|
136
|
+
id: 'nomiracl',
|
|
150
137
|
|
|
151
|
-
async
|
|
138
|
+
async loadAll(opts: LoadOptions = {}) {
|
|
152
139
|
if (fixturesMode) return loadFixtures(opts)
|
|
153
140
|
const path = dataFile()
|
|
154
141
|
if (!path) throw new Error('NOMIRACL_DATA_FILE is required to load NoMIRACL tasks')
|
|
155
142
|
return selectTasks((await loadRows(path)).map(rowToTask), opts, 'NoMIRACL')
|
|
156
143
|
},
|
|
157
144
|
|
|
158
|
-
async
|
|
159
|
-
return readMeta(task).answerable ? 'ANSWERABLE' : 'UNANSWERABLE'
|
|
160
|
-
},
|
|
161
|
-
|
|
162
|
-
async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
|
|
145
|
+
async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
|
|
163
146
|
const meta = readMeta(task)
|
|
164
147
|
const got = parseClassification(artifact)
|
|
165
148
|
const resolved = got === meta.answerable
|
|
149
|
+
const raw = {
|
|
150
|
+
benchmark: meta.benchmark,
|
|
151
|
+
language: meta.language,
|
|
152
|
+
subset: meta.subset,
|
|
153
|
+
expected: meta.answerable ? 'ANSWERABLE' : 'UNANSWERABLE',
|
|
154
|
+
got: got === null ? null : got ? 'ANSWERABLE' : 'UNANSWERABLE',
|
|
155
|
+
contextCount: meta.contexts.length,
|
|
156
|
+
}
|
|
166
157
|
return {
|
|
167
|
-
resolved,
|
|
158
|
+
passed: resolved,
|
|
168
159
|
score: resolved ? 1 : 0,
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
language: meta.language,
|
|
172
|
-
subset: meta.subset,
|
|
173
|
-
expected: meta.answerable ? 'ANSWERABLE' : 'UNANSWERABLE',
|
|
174
|
-
got: got === null ? null : got ? 'ANSWERABLE' : 'UNANSWERABLE',
|
|
175
|
-
contextCount: meta.contexts.length,
|
|
176
|
-
}),
|
|
160
|
+
notes: JSON.stringify(raw),
|
|
161
|
+
raw,
|
|
177
162
|
}
|
|
178
163
|
},
|
|
179
|
-
|
|
164
|
+
|
|
165
|
+
runtime: {
|
|
166
|
+
output: ragAnswerOutput,
|
|
167
|
+
|
|
168
|
+
async preflight() {
|
|
169
|
+
if (fixturesMode) {
|
|
170
|
+
await readFile(FIXTURES, 'utf8')
|
|
171
|
+
return
|
|
172
|
+
}
|
|
173
|
+
const path = dataFile()
|
|
174
|
+
if (!path) {
|
|
175
|
+
throw new Error(
|
|
176
|
+
'NOMIRACL_DATA_FILE is required. Fix: export project-miracl/nomiracl rows to JSONL and set NOMIRACL_DATA_FILE=/path/to/nomiracl.jsonl, or set NOMIRACL_FIXTURES=1 for adapter plumbing.',
|
|
177
|
+
)
|
|
178
|
+
}
|
|
179
|
+
await loadRows(path)
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
async goldArtifact(task: BenchTask) {
|
|
183
|
+
return readMeta(task).answerable ? 'ANSWERABLE' : 'UNANSWERABLE'
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
})
|
|
180
187
|
}
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
import { readFile } from 'node:fs/promises'
|
|
10
10
|
import { join } from 'node:path'
|
|
11
11
|
import { benchRoot } from './_harness'
|
|
12
|
-
import
|
|
12
|
+
import { type BenchEvaluation, type BenchTask, type LoadOptions, type RuntimeBenchmark, runtimeBenchmark } from './types'
|
|
13
13
|
import {
|
|
14
14
|
FINAL_ANSWER_SENTINEL,
|
|
15
15
|
allStrings,
|
|
16
|
-
|
|
16
|
+
answerScoreToEvaluation,
|
|
17
17
|
contextBlock,
|
|
18
18
|
contextsFrom,
|
|
19
19
|
firstString,
|
|
@@ -70,19 +70,21 @@ function rowToTask(raw: unknown, index: number): BenchTask {
|
|
|
70
70
|
}
|
|
71
71
|
return {
|
|
72
72
|
id,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
73
|
+
payload: {
|
|
74
|
+
subset: stringFrom(raw.split) ?? modality,
|
|
75
|
+
prompt: [
|
|
76
|
+
'Answer this Open RAG Bench PDF question using the supplied document context.',
|
|
77
|
+
'Use tables, text, and image-derived notes when present.',
|
|
78
|
+
'End with a single final line: `FINAL ANSWER: <answer>`.',
|
|
79
|
+
'',
|
|
80
|
+
`Question: ${query}`,
|
|
81
|
+
`Document: ${documentId}`,
|
|
82
|
+
`Modality: ${modality}`,
|
|
83
|
+
contexts.length > 0 ? `\nDocument context:\n${contextBlock(contexts)}` : undefined,
|
|
84
|
+
]
|
|
85
|
+
.filter(Boolean)
|
|
86
|
+
.join('\n'),
|
|
87
|
+
},
|
|
86
88
|
metadata: meta as unknown as Record<string, unknown>,
|
|
87
89
|
}
|
|
88
90
|
}
|
|
@@ -90,7 +92,7 @@ function rowToTask(raw: unknown, index: number): BenchTask {
|
|
|
90
92
|
function readMeta(task: BenchTask): OpenRagBenchMeta {
|
|
91
93
|
const md = task.metadata
|
|
92
94
|
if (!md || !Array.isArray(md.goldAnswers)) {
|
|
93
|
-
throw new Error(`Open RAG Bench task ${task.id} missing metadata —
|
|
95
|
+
throw new Error(`Open RAG Bench task ${task.id} missing metadata — loadAll did not populate it`)
|
|
94
96
|
}
|
|
95
97
|
return md as unknown as OpenRagBenchMeta
|
|
96
98
|
}
|
|
@@ -107,47 +109,50 @@ async function loadFixtures(opts: LoadOptions): Promise<BenchTask[]> {
|
|
|
107
109
|
return selectTasks(rows.map(rowToTask), opts, 'Open RAG Bench')
|
|
108
110
|
}
|
|
109
111
|
|
|
110
|
-
export function createOpenRagBenchAdapter():
|
|
112
|
+
export function createOpenRagBenchAdapter(): RuntimeBenchmark {
|
|
111
113
|
const fixturesMode = process.env.OPEN_RAG_BENCH_FIXTURES === '1'
|
|
112
114
|
|
|
113
|
-
return {
|
|
114
|
-
|
|
115
|
-
output: ragAnswerOutput,
|
|
116
|
-
|
|
117
|
-
async preflight() {
|
|
118
|
-
if (fixturesMode) {
|
|
119
|
-
await readFile(FIXTURES, 'utf8')
|
|
120
|
-
return
|
|
121
|
-
}
|
|
122
|
-
const path = dataFile()
|
|
123
|
-
if (!path) {
|
|
124
|
-
throw new Error(
|
|
125
|
-
'OPEN_RAG_BENCH_DATA_FILE is required. Fix: export vectara/open-rag-bench rows to JSONL and set OPEN_RAG_BENCH_DATA_FILE=/path/to/open-rag-bench.jsonl, or set OPEN_RAG_BENCH_FIXTURES=1 for adapter plumbing.',
|
|
126
|
-
)
|
|
127
|
-
}
|
|
128
|
-
await loadRows(path)
|
|
129
|
-
},
|
|
115
|
+
return runtimeBenchmark({
|
|
116
|
+
id: 'open-rag-bench',
|
|
130
117
|
|
|
131
|
-
async
|
|
118
|
+
async loadAll(opts: LoadOptions = {}) {
|
|
132
119
|
if (fixturesMode) return loadFixtures(opts)
|
|
133
120
|
const path = dataFile()
|
|
134
121
|
if (!path) throw new Error('OPEN_RAG_BENCH_DATA_FILE is required to load Open RAG Bench tasks')
|
|
135
122
|
return selectTasks((await loadRows(path)).map(rowToTask), opts, 'Open RAG Bench')
|
|
136
123
|
},
|
|
137
124
|
|
|
138
|
-
async
|
|
139
|
-
return `${FINAL_ANSWER_SENTINEL} ${readMeta(task).goldAnswers[0] ?? ''}`
|
|
140
|
-
},
|
|
141
|
-
|
|
142
|
-
async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
|
|
125
|
+
async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
|
|
143
126
|
const meta = readMeta(task)
|
|
144
127
|
const score = scoreAnswerArtifact(artifact, meta.goldAnswers)
|
|
145
|
-
return
|
|
128
|
+
return answerScoreToEvaluation(score, {
|
|
146
129
|
benchmark: meta.benchmark,
|
|
147
130
|
documentId: meta.documentId,
|
|
148
131
|
modality: meta.modality,
|
|
149
132
|
contextCount: meta.contexts.length,
|
|
150
133
|
})
|
|
151
134
|
},
|
|
152
|
-
|
|
135
|
+
|
|
136
|
+
runtime: {
|
|
137
|
+
output: ragAnswerOutput,
|
|
138
|
+
|
|
139
|
+
async preflight() {
|
|
140
|
+
if (fixturesMode) {
|
|
141
|
+
await readFile(FIXTURES, 'utf8')
|
|
142
|
+
return
|
|
143
|
+
}
|
|
144
|
+
const path = dataFile()
|
|
145
|
+
if (!path) {
|
|
146
|
+
throw new Error(
|
|
147
|
+
'OPEN_RAG_BENCH_DATA_FILE is required. Fix: export vectara/open-rag-bench rows to JSONL and set OPEN_RAG_BENCH_DATA_FILE=/path/to/open-rag-bench.jsonl, or set OPEN_RAG_BENCH_FIXTURES=1 for adapter plumbing.',
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
await loadRows(path)
|
|
151
|
+
},
|
|
152
|
+
|
|
153
|
+
async goldArtifact(task: BenchTask) {
|
|
154
|
+
return `${FINAL_ANSWER_SENTINEL} ${readMeta(task).goldAnswers[0] ?? ''}`
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
})
|
|
153
158
|
}
|