@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
|
@@ -13,7 +13,7 @@ import { resolve } from 'node:path'
|
|
|
13
13
|
import { promisify } from 'node:util'
|
|
14
14
|
import type { OutputAdapter } from '@tangle-network/agent-runtime/kernel'
|
|
15
15
|
import { runVenvPython } from './_harness'
|
|
16
|
-
import
|
|
16
|
+
import { type BenchEvaluation, type BenchTask, type LoadOptions, type RuntimeBenchmark, runtimeBenchmark } from './types'
|
|
17
17
|
|
|
18
18
|
const execFileAsync = promisify(execFile)
|
|
19
19
|
|
|
@@ -162,16 +162,18 @@ function rowToTask(row: TauRow, config: TauBenchConfig, split?: string, pin?: Ta
|
|
|
162
162
|
}
|
|
163
163
|
return {
|
|
164
164
|
id: row.id,
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
165
|
+
payload: {
|
|
166
|
+
subset: split,
|
|
167
|
+
prompt: [
|
|
168
|
+
config.taskIntro,
|
|
169
|
+
`Run this task in the official ${row.domain} domain.`,
|
|
170
|
+
'The benchmark is a simulated multi-turn user/tool conversation.',
|
|
171
|
+
'',
|
|
172
|
+
typeof row.user_scenario === 'string' ? row.user_scenario : JSON.stringify(row.user_scenario ?? {}, null, 2),
|
|
173
|
+
'',
|
|
174
|
+
'Return the path to the official tau results.json or trajectory file containing this task run.',
|
|
175
|
+
].join('\n'),
|
|
176
|
+
},
|
|
175
177
|
metadata: meta as unknown as Record<string, unknown>,
|
|
176
178
|
}
|
|
177
179
|
}
|
|
@@ -179,7 +181,7 @@ function rowToTask(row: TauRow, config: TauBenchConfig, split?: string, pin?: Ta
|
|
|
179
181
|
function readMeta(task: BenchTask, benchName: string): TauMeta {
|
|
180
182
|
const md = task.metadata
|
|
181
183
|
if (!md || typeof md.taskId !== 'string' || typeof md.domain !== 'string') {
|
|
182
|
-
throw new Error(`${benchName} task ${task.id} missing metadata —
|
|
184
|
+
throw new Error(`${benchName} task ${task.id} missing metadata — loadAll did not populate it`)
|
|
183
185
|
}
|
|
184
186
|
return md as unknown as TauMeta
|
|
185
187
|
}
|
|
@@ -199,7 +201,7 @@ function selectRows(rows: TauRow[], opts: LoadOptions, config: TauBenchConfig, s
|
|
|
199
201
|
async function loadFixtures(config: TauBenchConfig, opts: LoadOptions): Promise<BenchTask[]> {
|
|
200
202
|
const rows = JSON.parse(await readFile(config.fixturePath, 'utf8')) as TauRow[]
|
|
201
203
|
console.warn(`[${config.name}] ${config.fixturesEnv}=1 — loading ${rows.length} adapter fixtures`)
|
|
202
|
-
return selectRows(rows, opts, config, opts.
|
|
204
|
+
return selectRows(rows, opts, config, opts.subset)
|
|
203
205
|
}
|
|
204
206
|
|
|
205
207
|
async function loadOfficialTasks(config: TauBenchConfig, root: string, opts: LoadOptions): Promise<BenchTask[]> {
|
|
@@ -223,13 +225,13 @@ for task in tasks:
|
|
|
223
225
|
print(json.dumps({"upstreamVersion": upstream_version, "rows": rows}))
|
|
224
226
|
`
|
|
225
227
|
const upstreamCommit = await resolveUpstreamCommit(root, config.name)
|
|
226
|
-
const stdout = await runVenvPython(script, [root, domain, opts.
|
|
228
|
+
const stdout = await runVenvPython(script, [root, domain, opts.subset ?? ''])
|
|
227
229
|
const report = JSON.parse(stdout) as { upstreamVersion?: unknown; rows?: unknown }
|
|
228
230
|
if (typeof report.upstreamVersion !== 'string' || report.upstreamVersion.length === 0 || !Array.isArray(report.rows)) {
|
|
229
231
|
throw new Error(`${config.name}: upstream task loader returned no pinned version/rows`)
|
|
230
232
|
}
|
|
231
233
|
const pin: TauUpstreamPin = { upstreamCommit, upstreamVersion: report.upstreamVersion }
|
|
232
|
-
return selectRows(report.rows as TauRow[], opts, config, opts.
|
|
234
|
+
return selectRows(report.rows as TauRow[], opts, config, opts.subset, pin)
|
|
233
235
|
}
|
|
234
236
|
|
|
235
237
|
async function scoreOfficialTrajectory(root: string, meta: TauMeta, artifactPath: string): Promise<Record<string, unknown>> {
|
|
@@ -257,35 +259,20 @@ print(json.dumps({"count": len(scores), "score": sum(scores) / len(scores), "sco
|
|
|
257
259
|
return JSON.parse(stdout.trim().split('\n').at(-1) ?? '{}') as Record<string, unknown>
|
|
258
260
|
}
|
|
259
261
|
|
|
260
|
-
export function createTauBenchAdapter(config: TauBenchConfig):
|
|
262
|
+
export function createTauBenchAdapter(config: TauBenchConfig): RuntimeBenchmark {
|
|
261
263
|
const fixturesMode = process.env[config.fixturesEnv] === '1'
|
|
262
264
|
|
|
263
|
-
return {
|
|
264
|
-
|
|
265
|
-
output: tauResultsOutput,
|
|
266
|
-
|
|
267
|
-
async preflight() {
|
|
268
|
-
if (fixturesMode) return
|
|
269
|
-
const dir = benchDir(config)
|
|
270
|
-
if (!dir) {
|
|
271
|
-
throw new Error(`${config.dirEnv} is required. Fix: ${config.installHint}`)
|
|
272
|
-
}
|
|
273
|
-
await assertPath(`${dir}/src/tau2/registry.py`, 'tau registry', config.name)
|
|
274
|
-
await loadOfficialTasks(config, dir, { limit: 1 })
|
|
275
|
-
},
|
|
265
|
+
return runtimeBenchmark({
|
|
266
|
+
id: config.name,
|
|
276
267
|
|
|
277
|
-
async
|
|
268
|
+
async loadAll(opts: LoadOptions = {}) {
|
|
278
269
|
if (fixturesMode) return loadFixtures(config, opts)
|
|
279
270
|
const dir = benchDir(config)
|
|
280
271
|
if (!dir) throw new Error(`${config.dirEnv} is required to load official ${config.name} tasks`)
|
|
281
272
|
return loadOfficialTasks(config, dir, opts)
|
|
282
273
|
},
|
|
283
274
|
|
|
284
|
-
async
|
|
285
|
-
return undefined
|
|
286
|
-
},
|
|
287
|
-
|
|
288
|
-
async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
|
|
275
|
+
async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
|
|
289
276
|
const dir = benchDir(config)
|
|
290
277
|
if (!dir) throw new Error(`${config.dirEnv} is required to judge ${config.name} trajectory artifacts`)
|
|
291
278
|
const meta = readMeta(task, config.name)
|
|
@@ -300,17 +287,37 @@ export function createTauBenchAdapter(config: TauBenchConfig): BenchmarkAdapter
|
|
|
300
287
|
const live: TauUpstreamPin = { upstreamCommit, upstreamVersion }
|
|
301
288
|
assertTauUpstreamPinUnchanged(config.name, meta.taskId, meta, live)
|
|
302
289
|
const score = typeof report.score === 'number' ? report.score : 0
|
|
290
|
+
const raw = {
|
|
291
|
+
taskId: meta.taskId,
|
|
292
|
+
domain: meta.domain,
|
|
293
|
+
count: report.count,
|
|
294
|
+
upstreamCommit,
|
|
295
|
+
upstreamVersion,
|
|
296
|
+
}
|
|
303
297
|
return {
|
|
304
|
-
|
|
298
|
+
passed: score === 1,
|
|
305
299
|
score,
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
domain: meta.domain,
|
|
309
|
-
count: report.count,
|
|
310
|
-
upstreamCommit,
|
|
311
|
-
upstreamVersion,
|
|
312
|
-
}),
|
|
300
|
+
notes: JSON.stringify(raw),
|
|
301
|
+
raw,
|
|
313
302
|
}
|
|
314
303
|
},
|
|
315
|
-
|
|
304
|
+
|
|
305
|
+
runtime: {
|
|
306
|
+
output: tauResultsOutput,
|
|
307
|
+
|
|
308
|
+
async preflight() {
|
|
309
|
+
if (fixturesMode) return
|
|
310
|
+
const dir = benchDir(config)
|
|
311
|
+
if (!dir) {
|
|
312
|
+
throw new Error(`${config.dirEnv} is required. Fix: ${config.installHint}`)
|
|
313
|
+
}
|
|
314
|
+
await assertPath(`${dir}/src/tau2/registry.py`, 'tau registry', config.name)
|
|
315
|
+
await loadOfficialTasks(config, dir, { limit: 1 })
|
|
316
|
+
},
|
|
317
|
+
|
|
318
|
+
async goldArtifact() {
|
|
319
|
+
return undefined
|
|
320
|
+
},
|
|
321
|
+
},
|
|
322
|
+
})
|
|
316
323
|
}
|
|
@@ -30,7 +30,7 @@ test('a dirty upstream checkout is refused before any task load', async () => {
|
|
|
30
30
|
|
|
31
31
|
delete process.env.TAU3_FIXTURES
|
|
32
32
|
process.env.TAU3_BENCH_DIR = dir
|
|
33
|
-
await assert.rejects(() => createTau3BankingAdapter().
|
|
33
|
+
await assert.rejects(() => createTau3BankingAdapter().loadAll({ limit: 1 }), /uncommitted changes/)
|
|
34
34
|
} finally {
|
|
35
35
|
if (previous === undefined) delete process.env.TAU3_BENCH_DIR
|
|
36
36
|
else process.env.TAU3_BENCH_DIR = previous
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
import { join } from 'node:path'
|
|
10
10
|
import { benchRoot } from './_harness'
|
|
11
11
|
import { createTauBenchAdapter, tauResultsOutput } from './tau-bench-shared'
|
|
12
|
-
import type {
|
|
12
|
+
import type { RuntimeBenchmark } from './types'
|
|
13
13
|
|
|
14
14
|
const FIXTURES = join(benchRoot, 'fixtures', 'tau2-bench.json')
|
|
15
15
|
|
|
16
16
|
export const tau2ResultsOutput = tauResultsOutput
|
|
17
17
|
|
|
18
|
-
export function createTau2BenchAdapter():
|
|
18
|
+
export function createTau2BenchAdapter(): RuntimeBenchmark {
|
|
19
19
|
return createTauBenchAdapter({
|
|
20
20
|
name: 'tau2-bench',
|
|
21
21
|
fixturePath: FIXTURES,
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
import { join } from 'node:path'
|
|
11
11
|
import { benchRoot } from './_harness'
|
|
12
12
|
import { createTauBenchAdapter } from './tau-bench-shared'
|
|
13
|
-
import type {
|
|
13
|
+
import type { RuntimeBenchmark } from './types'
|
|
14
14
|
|
|
15
15
|
const FIXTURES = join(benchRoot, 'fixtures', 'tau3-banking.json')
|
|
16
16
|
|
|
17
|
-
export function createTau3BankingAdapter():
|
|
17
|
+
export function createTau3BankingAdapter(): RuntimeBenchmark {
|
|
18
18
|
return createTauBenchAdapter({
|
|
19
19
|
name: 'tau3-banking',
|
|
20
20
|
fixturePath: FIXTURES,
|
|
@@ -9,8 +9,8 @@ import { createTerminalBenchAdapter } from './terminal-bench'
|
|
|
9
9
|
|
|
10
10
|
test('goldArtifact returns portable shell solutions and rejects missing ones', async () => {
|
|
11
11
|
const a = createTerminalBenchAdapter()
|
|
12
|
-
assert.equal(await a.goldArtifact({ id: 'with-solution', prompt: '', metadata: { solution: 'echo ok\n' } }), 'echo ok\n')
|
|
13
|
-
assert.equal(await a.goldArtifact({ id: 'without-solution', prompt: '', metadata: {} }), undefined)
|
|
12
|
+
assert.equal(await a.runtime.goldArtifact!({ id: 'with-solution', payload: { prompt: '' }, metadata: { solution: 'echo ok\n' } }), 'echo ok\n')
|
|
13
|
+
assert.equal(await a.runtime.goldArtifact!({ id: 'without-solution', payload: { prompt: '' }, metadata: {} }), undefined)
|
|
14
14
|
})
|
|
15
15
|
|
|
16
16
|
test('preflight FAILS LOUD with isolated Terminal-Bench venv instructions when harness is absent', async () => {
|
|
@@ -18,7 +18,7 @@ test('preflight FAILS LOUD with isolated Terminal-Bench venv instructions when h
|
|
|
18
18
|
process.env.TERMINAL_BENCH_VENV = '.venv-terminal-bench-does-not-exist'
|
|
19
19
|
try {
|
|
20
20
|
const a = createTerminalBenchAdapter()
|
|
21
|
-
await assert.rejects(a.preflight(), (e: Error) => {
|
|
21
|
+
await assert.rejects(a.runtime.preflight!(), (e: Error) => {
|
|
22
22
|
assert.match(e.message, /pip install terminal-bench/)
|
|
23
23
|
assert.match(e.message, /ISOLATED venv/)
|
|
24
24
|
assert.match(e.message, /TERMINAL_BENCH_VENV/)
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Requires: an isolated bench `.venv-terminal-bench` with `terminal-bench`
|
|
10
10
|
* installed + a running Docker daemon (per-task images are built on first run).
|
|
11
|
-
* Override with TERMINAL_BENCH_VENV.
|
|
11
|
+
* Override with TERMINAL_BENCH_VENV. loadAll caches the dataset from the
|
|
12
12
|
* Terminal-Bench registry on first run.
|
|
13
13
|
*
|
|
14
14
|
* Process/Docker/report plumbing is shared via ./_harness; this file owns the
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
venvBinAt,
|
|
29
29
|
venvPythonAt,
|
|
30
30
|
} from './_harness'
|
|
31
|
-
import
|
|
31
|
+
import { type BenchEvaluation, type BenchTask, type LoadOptions, type RuntimeBenchmark, runtimeBenchmark } from './types'
|
|
32
32
|
|
|
33
33
|
// Terminal-Bench imports LiteLLM/Pydantic-2 APIs, while AppWorld pins Pydantic 1.
|
|
34
34
|
// Keep it out of the shared bench .venv. Resolved at call-time so tests/runs can
|
|
@@ -106,38 +106,25 @@ print(json.dumps(out))
|
|
|
106
106
|
return JSON.parse(stdout) as TbTaskRow[]
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
export function createTerminalBenchAdapter():
|
|
110
|
-
return {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
async preflight() {
|
|
114
|
-
await preflightVenvImports({
|
|
115
|
-
modules: ['terminal_bench'],
|
|
116
|
-
requireDocker: true,
|
|
117
|
-
python: terminalBenchPython(),
|
|
118
|
-
fix:
|
|
119
|
-
`Fix: (1) python3 -m venv bench/${terminalBenchVenvDir()} && ` +
|
|
120
|
-
`bench/${terminalBenchVenvDir()}/bin/pip install terminal-bench ` +
|
|
121
|
-
`(an ISOLATED venv — Terminal-Bench/LiteLLM require Pydantic 2 while AppWorld pins Pydantic 1; ` +
|
|
122
|
-
`override the dir with TERMINAL_BENCH_VENV) ; ` +
|
|
123
|
-
`(2) ensure the Docker daemon is running (the judge builds per-task images on first run). ` +
|
|
124
|
-
`The ${DATASET_REF} dataset is cached from the Terminal-Bench registry on first loadTasks.`,
|
|
125
|
-
})
|
|
126
|
-
},
|
|
109
|
+
export function createTerminalBenchAdapter(): RuntimeBenchmark {
|
|
110
|
+
return runtimeBenchmark({
|
|
111
|
+
id: 'terminal-bench',
|
|
127
112
|
|
|
128
|
-
async
|
|
113
|
+
async loadAll(opts: LoadOptions = {}) {
|
|
129
114
|
const rows = await loadRows(opts)
|
|
130
115
|
if (rows.length === 0) {
|
|
131
116
|
throw new Error(
|
|
132
|
-
`terminal-bench
|
|
117
|
+
`terminal-bench loadAll returned no tasks for ${JSON.stringify(opts)} ` +
|
|
133
118
|
`(dataset ${DATASET_REF}). Check the requested ids exist in the dataset.`,
|
|
134
119
|
)
|
|
135
120
|
}
|
|
136
121
|
return rows.map(
|
|
137
122
|
(r): BenchTask => ({
|
|
138
123
|
id: r.id,
|
|
139
|
-
|
|
140
|
-
|
|
124
|
+
payload: {
|
|
125
|
+
subset: DATASET_VERSION,
|
|
126
|
+
prompt: r.instruction,
|
|
127
|
+
},
|
|
141
128
|
metadata: {
|
|
142
129
|
dataset: DATASET,
|
|
143
130
|
datasetVersion: DATASET_VERSION,
|
|
@@ -150,15 +137,7 @@ export function createTerminalBenchAdapter(): BenchmarkAdapter {
|
|
|
150
137
|
)
|
|
151
138
|
},
|
|
152
139
|
|
|
153
|
-
async
|
|
154
|
-
// Gold = the task's solution.sh (the oracle script). solution.yaml tasks have
|
|
155
|
-
// no shell-script artifact form here, so they return undefined (cannot be
|
|
156
|
-
// verify-judged via the script-replay seam — use a .sh-solution task).
|
|
157
|
-
const sol = task.metadata?.solution
|
|
158
|
-
return typeof sol === 'string' ? sol : undefined
|
|
159
|
-
},
|
|
160
|
-
|
|
161
|
-
async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
|
|
140
|
+
async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
|
|
162
141
|
const runId = safeRunId('bench', `${task.id}-${Date.now()}`)
|
|
163
142
|
return runStagedJudge({
|
|
164
143
|
tmpPrefix: 'tbench-',
|
|
@@ -187,12 +166,38 @@ export function createTerminalBenchAdapter(): BenchmarkAdapter {
|
|
|
187
166
|
const resolved = (report.resolved_ids ?? []).includes(task.id)
|
|
188
167
|
const trial = report.results?.find((r) => r.task_id === task.id)
|
|
189
168
|
return {
|
|
190
|
-
resolved,
|
|
169
|
+
passed: resolved,
|
|
191
170
|
score: resolved ? 1 : 0,
|
|
192
|
-
|
|
171
|
+
notes: JSON.stringify(trial?.parser_results ?? report.resolved_ids ?? {}),
|
|
172
|
+
raw: {},
|
|
193
173
|
}
|
|
194
174
|
},
|
|
195
175
|
})
|
|
196
176
|
},
|
|
197
|
-
|
|
177
|
+
|
|
178
|
+
runtime: {
|
|
179
|
+
async preflight() {
|
|
180
|
+
await preflightVenvImports({
|
|
181
|
+
modules: ['terminal_bench'],
|
|
182
|
+
requireDocker: true,
|
|
183
|
+
python: terminalBenchPython(),
|
|
184
|
+
fix:
|
|
185
|
+
`Fix: (1) python3 -m venv bench/${terminalBenchVenvDir()} && ` +
|
|
186
|
+
`bench/${terminalBenchVenvDir()}/bin/pip install terminal-bench ` +
|
|
187
|
+
`(an ISOLATED venv — Terminal-Bench/LiteLLM require Pydantic 2 while AppWorld pins Pydantic 1; ` +
|
|
188
|
+
`override the dir with TERMINAL_BENCH_VENV) ; ` +
|
|
189
|
+
`(2) ensure the Docker daemon is running (the judge builds per-task images on first run). ` +
|
|
190
|
+
`The ${DATASET_REF} dataset is cached from the Terminal-Bench registry on first loadAll.`,
|
|
191
|
+
})
|
|
192
|
+
},
|
|
193
|
+
|
|
194
|
+
async goldArtifact(task: BenchTask) {
|
|
195
|
+
// Gold = the task's solution.sh (the oracle script). solution.yaml tasks have
|
|
196
|
+
// no shell-script artifact form here, so they return undefined (cannot be
|
|
197
|
+
// verify-judged via the script-replay seam — use a .sh-solution task).
|
|
198
|
+
const sol = task.metadata?.solution
|
|
199
|
+
return typeof sol === 'string' ? sol : undefined
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
})
|
|
198
203
|
}
|
package/src/benchmarks/toollm.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { readFile } from 'node:fs/promises'
|
|
|
11
11
|
import { join } from 'node:path'
|
|
12
12
|
import type { OutputAdapter } from '@tangle-network/agent-runtime/kernel'
|
|
13
13
|
import { benchRoot } from './_harness'
|
|
14
|
-
import
|
|
14
|
+
import { type BenchEvaluation, type BenchTask, type LoadOptions, type RuntimeBenchmark, runtimeBenchmark } from './types'
|
|
15
15
|
|
|
16
16
|
const FIXTURES = join(benchRoot, 'fixtures', 'toollm.json')
|
|
17
17
|
const DEFAULT_QUERY_REL = join('data_example', 'instruction', 'G1_query.json')
|
|
@@ -65,16 +65,18 @@ function rowToTask(row: ToolBenchRow): BenchTask {
|
|
|
65
65
|
}
|
|
66
66
|
return {
|
|
67
67
|
id: String(row.query_id),
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
68
|
+
payload: {
|
|
69
|
+
prompt: [
|
|
70
|
+
'Solve this ToolLLM/ToolBench API-use task.',
|
|
71
|
+
'Use only the listed APIs/tools and return the completed tool-use trace plus final answer.',
|
|
72
|
+
'',
|
|
73
|
+
`Query: ${row.query}`,
|
|
74
|
+
'',
|
|
75
|
+
`Available APIs: ${JSON.stringify(row.api_list ?? [], null, 2)}`,
|
|
76
|
+
'',
|
|
77
|
+
'Return the APIs you used as JSON: {"api_calls":[{"tool_name":"...","api_name":"..."}]}.',
|
|
78
|
+
].join('\n'),
|
|
79
|
+
},
|
|
78
80
|
metadata: meta as unknown as Record<string, unknown>,
|
|
79
81
|
}
|
|
80
82
|
}
|
|
@@ -107,7 +109,7 @@ function normalizeApiPairs(value: unknown): Array<[string, string]> {
|
|
|
107
109
|
function readMeta(task: BenchTask): ToolBenchMeta {
|
|
108
110
|
const md = task.metadata
|
|
109
111
|
if (!md || !Array.isArray(md.relevantApis)) {
|
|
110
|
-
throw new Error(`ToolLLM task ${task.id} missing metadata —
|
|
112
|
+
throw new Error(`ToolLLM task ${task.id} missing metadata — loadAll did not populate deterministic API-selection labels`)
|
|
111
113
|
}
|
|
112
114
|
return md as unknown as ToolBenchMeta
|
|
113
115
|
}
|
|
@@ -186,7 +188,7 @@ function extractCalledApis(text: string, expected: readonly [string, string][]):
|
|
|
186
188
|
}
|
|
187
189
|
}
|
|
188
190
|
|
|
189
|
-
function scoreApiSelection(task: BenchTask, artifact: string):
|
|
191
|
+
function scoreApiSelection(task: BenchTask, artifact: string): BenchEvaluation {
|
|
190
192
|
const meta = readMeta(task)
|
|
191
193
|
if (meta.relevantApis.length === 0) {
|
|
192
194
|
throw new Error(`ToolLLM task ${task.id} has no deterministic API-selection labels; refusing to score`)
|
|
@@ -200,55 +202,60 @@ function scoreApiSelection(task: BenchTask, artifact: string): BenchScore {
|
|
|
200
202
|
const recall = truePositives / expected.size
|
|
201
203
|
const score = expected.size === 0 ? 0 : recall
|
|
202
204
|
const resolved = extracted.source === 'structured-json' && recall === 1 && precision === 1
|
|
205
|
+
const raw = {
|
|
206
|
+
scoring: 'api-selection-only',
|
|
207
|
+
extractionSource: extracted.source,
|
|
208
|
+
queryId: meta.queryId,
|
|
209
|
+
expected: meta.relevantApis,
|
|
210
|
+
called: calledPairs,
|
|
211
|
+
precision,
|
|
212
|
+
recall,
|
|
213
|
+
fullToolEvalScore: null,
|
|
214
|
+
}
|
|
203
215
|
return {
|
|
204
|
-
resolved,
|
|
216
|
+
passed: resolved,
|
|
205
217
|
score,
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
extractionSource: extracted.source,
|
|
209
|
-
queryId: meta.queryId,
|
|
210
|
-
expected: meta.relevantApis,
|
|
211
|
-
called: calledPairs,
|
|
212
|
-
precision,
|
|
213
|
-
recall,
|
|
214
|
-
fullToolEvalScore: null,
|
|
215
|
-
}),
|
|
218
|
+
notes: JSON.stringify(raw),
|
|
219
|
+
raw,
|
|
216
220
|
}
|
|
217
221
|
}
|
|
218
222
|
|
|
219
|
-
export function createToolLlmAdapter():
|
|
223
|
+
export function createToolLlmAdapter(): RuntimeBenchmark {
|
|
220
224
|
const fixturesMode = process.env.TOOLLM_FIXTURES === '1'
|
|
221
225
|
|
|
222
|
-
return {
|
|
223
|
-
|
|
224
|
-
output: toollmOutput,
|
|
225
|
-
|
|
226
|
-
async preflight() {
|
|
227
|
-
if (fixturesMode) return
|
|
228
|
-
const dir = toolbenchDir()
|
|
229
|
-
if (!dir) {
|
|
230
|
-
throw new Error('TOOLBENCH_DIR is required. Fix: clone https://github.com/OpenBMB/ToolBench and set TOOLBENCH_DIR=/path/to/ToolBench.')
|
|
231
|
-
}
|
|
232
|
-
await loadOfficialTasks(dir, { limit: 1 })
|
|
233
|
-
},
|
|
226
|
+
return runtimeBenchmark({
|
|
227
|
+
id: 'toollm',
|
|
234
228
|
|
|
235
|
-
async
|
|
229
|
+
async loadAll(opts: LoadOptions = {}) {
|
|
236
230
|
if (fixturesMode) return loadFixtures(opts)
|
|
237
231
|
const dir = toolbenchDir()
|
|
238
232
|
if (!dir) throw new Error('TOOLBENCH_DIR is required to load ToolLLM tasks')
|
|
239
233
|
return loadOfficialTasks(dir, opts)
|
|
240
234
|
},
|
|
241
235
|
|
|
242
|
-
async
|
|
243
|
-
|
|
244
|
-
if (meta.relevantApis.length === 0) return undefined
|
|
245
|
-
return JSON.stringify({
|
|
246
|
-
api_calls: meta.relevantApis.map(([tool_name, api_name]) => ({ tool_name, api_name })),
|
|
247
|
-
}, null, 2)
|
|
236
|
+
async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
|
|
237
|
+
return scoreApiSelection(task, artifact)
|
|
248
238
|
},
|
|
249
239
|
|
|
250
|
-
|
|
251
|
-
|
|
240
|
+
runtime: {
|
|
241
|
+
output: toollmOutput,
|
|
242
|
+
|
|
243
|
+
async preflight() {
|
|
244
|
+
if (fixturesMode) return
|
|
245
|
+
const dir = toolbenchDir()
|
|
246
|
+
if (!dir) {
|
|
247
|
+
throw new Error('TOOLBENCH_DIR is required. Fix: clone https://github.com/OpenBMB/ToolBench and set TOOLBENCH_DIR=/path/to/ToolBench.')
|
|
248
|
+
}
|
|
249
|
+
await loadOfficialTasks(dir, { limit: 1 })
|
|
250
|
+
},
|
|
251
|
+
|
|
252
|
+
async goldArtifact(task: BenchTask) {
|
|
253
|
+
const meta = readMeta(task)
|
|
254
|
+
if (meta.relevantApis.length === 0) return undefined
|
|
255
|
+
return JSON.stringify({
|
|
256
|
+
api_calls: meta.relevantApis.map(([tool_name, api_name]) => ({ tool_name, api_name })),
|
|
257
|
+
}, null, 2)
|
|
258
|
+
},
|
|
252
259
|
},
|
|
253
|
-
}
|
|
260
|
+
})
|
|
254
261
|
}
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
* Task 2: per-move coverage check (ground truth + agent answer + flagged claims)
|
|
18
18
|
* Task 3: synthesis check (ground truth + agent answer)
|
|
19
19
|
* Score 0–4: themes_covered == num_themes && synthesis → 4, all themes → 3,
|
|
20
|
-
* ≥2 themes → 2, ≥1 theme → 1, else → 0. Normalized to 0..1 for
|
|
21
|
-
*
|
|
20
|
+
* ≥2 themes → 2, ≥1 theme → 1, else → 0. Normalized to 0..1 for BenchEvaluation;
|
|
21
|
+
* passed = score 4 (sparse reward).
|
|
22
22
|
*
|
|
23
23
|
* Requires TANGLE_API_KEY and TRATA_BENCH_ROOT=/tmp/trata-hedge-bench.
|
|
24
24
|
* Clone: git clone --depth 1 https://github.com/Trata-Inc/trata-hedge-bench /tmp/trata-hedge-bench
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
import { readdirSync, readFileSync, statSync } from 'node:fs'
|
|
28
28
|
import { join } from 'node:path'
|
|
29
29
|
import { runBenchRouterTurn } from '../router-turn'
|
|
30
|
-
import
|
|
30
|
+
import { type BenchEvaluation, type BenchTask, type LoadOptions, type RuntimeBenchmark, runtimeBenchmark } from './types'
|
|
31
31
|
|
|
32
32
|
const DEFAULT_BENCH_ROOT = '/tmp/trata-hedge-bench'
|
|
33
33
|
const MAX_FILE_BYTES = 8_000
|
|
@@ -289,9 +289,10 @@ async function task3SynthesisCheck(
|
|
|
289
289
|
return (result as Task3Result) ?? { synthesis_found: null }
|
|
290
290
|
}
|
|
291
291
|
|
|
292
|
-
async function runTriataJudge(meta: TrataTaskMeta, answer: string, router: JudgeRouter): Promise<
|
|
292
|
+
async function runTriataJudge(meta: TrataTaskMeta, answer: string, router: JudgeRouter): Promise<BenchEvaluation> {
|
|
293
293
|
if (!answer.trim()) {
|
|
294
|
-
|
|
294
|
+
const raw = { error: 'empty answer' }
|
|
295
|
+
return { passed: false, score: 0, notes: JSON.stringify(raw), raw }
|
|
295
296
|
}
|
|
296
297
|
|
|
297
298
|
// Stage 1: hallucination check (serial — feeds into stage 2).
|
|
@@ -334,18 +335,20 @@ async function runTriataJudge(meta: TrataTaskMeta, answer: string, router: Judge
|
|
|
334
335
|
const hallRaw = t1.hallucinations_detected
|
|
335
336
|
const hallucinations = hallRaw === true || hallRaw === 'true'
|
|
336
337
|
|
|
338
|
+
const raw = {
|
|
339
|
+
rawScore,
|
|
340
|
+
themesHit,
|
|
341
|
+
themesMissed,
|
|
342
|
+
hallucinations,
|
|
343
|
+
unverifiableClaims: flaggedClaims.length,
|
|
344
|
+
synthesis: synth ?? null,
|
|
345
|
+
judgeModel: router.model,
|
|
346
|
+
}
|
|
337
347
|
return {
|
|
338
|
-
|
|
348
|
+
passed: rawScore === 4,
|
|
339
349
|
score: numThemes > 0 ? rawScore / 4 : 0,
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
themesHit,
|
|
343
|
-
themesMissed,
|
|
344
|
-
hallucinations,
|
|
345
|
-
unverifiableClaims: flaggedClaims.length,
|
|
346
|
-
synthesis: synth ?? null,
|
|
347
|
-
judgeModel: router.model,
|
|
348
|
-
}),
|
|
350
|
+
notes: JSON.stringify(raw),
|
|
351
|
+
raw,
|
|
349
352
|
}
|
|
350
353
|
}
|
|
351
354
|
|
|
@@ -398,7 +401,7 @@ function loadTask(taskId: string): { task: BenchTask; meta: TrataTaskMeta } {
|
|
|
398
401
|
// Store meta in the BenchTask so the judge can access it without re-reading.
|
|
399
402
|
const task: BenchTask = {
|
|
400
403
|
id: taskId,
|
|
401
|
-
prompt,
|
|
404
|
+
payload: { prompt },
|
|
402
405
|
metadata: meta as unknown as Record<string, unknown>,
|
|
403
406
|
}
|
|
404
407
|
|
|
@@ -447,34 +450,11 @@ function extractAnalysis(artifact: string): string {
|
|
|
447
450
|
|
|
448
451
|
// ── adapter factory ───────────────────────────────────────────────────────────
|
|
449
452
|
|
|
450
|
-
export function createTrataHedgeAdapter():
|
|
451
|
-
return {
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
async preflight() {
|
|
455
|
-
const root = benchRoot()
|
|
456
|
-
const envDir = join(root, 'environments')
|
|
457
|
-
try {
|
|
458
|
-
const stat = statSync(envDir)
|
|
459
|
-
if (!stat.isDirectory()) throw new Error('not a directory')
|
|
460
|
-
} catch {
|
|
461
|
-
throw new Error(
|
|
462
|
-
`Trata hedge-bench not found at ${envDir}.\n` +
|
|
463
|
-
`Clone: git clone --depth 1 https://github.com/Trata-Inc/trata-hedge-bench ${root}`,
|
|
464
|
-
)
|
|
465
|
-
}
|
|
466
|
-
// Validate judge router connectivity.
|
|
467
|
-
judgeRouter()
|
|
468
|
-
const ids = listTaskIds(root)
|
|
469
|
-
if (ids.length === 0) throw new Error(`No task directories found under ${envDir}`)
|
|
470
|
-
console.warn(
|
|
471
|
-
`[trata-hedge] ${ids.length} tasks loaded from ${root}. ` +
|
|
472
|
-
`Worker model reads embedded data inline (Harbor/Docker not required). ` +
|
|
473
|
-
`Judge uses ${process.env.JUDGE_MODEL ?? JUDGE_MODEL} via Tangle router.`,
|
|
474
|
-
)
|
|
475
|
-
},
|
|
453
|
+
export function createTrataHedgeAdapter(): RuntimeBenchmark {
|
|
454
|
+
return runtimeBenchmark({
|
|
455
|
+
id: 'trata-hedge',
|
|
476
456
|
|
|
477
|
-
async
|
|
457
|
+
async loadAll(opts: LoadOptions = {}): Promise<BenchTask[]> {
|
|
478
458
|
const root = benchRoot()
|
|
479
459
|
let ids = listTaskIds(root)
|
|
480
460
|
if (opts.ids) {
|
|
@@ -486,17 +466,42 @@ export function createTrataHedgeAdapter(): BenchmarkAdapter {
|
|
|
486
466
|
return ids.map((id) => loadTask(id).task)
|
|
487
467
|
},
|
|
488
468
|
|
|
489
|
-
async
|
|
490
|
-
// No single gold answer: the score comes from rubric theme coverage, not
|
|
491
|
-
// string-match against a reference response. Return undefined — the bench
|
|
492
|
-
// harness will skip judge self-verification for this adapter.
|
|
493
|
-
return undefined
|
|
494
|
-
},
|
|
495
|
-
|
|
496
|
-
async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
|
|
469
|
+
async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
|
|
497
470
|
const meta = readMeta(task)
|
|
498
471
|
const answer = extractAnalysis(artifact)
|
|
499
472
|
return runTriataJudge(meta, answer, judgeRouter())
|
|
500
473
|
},
|
|
501
|
-
|
|
474
|
+
|
|
475
|
+
runtime: {
|
|
476
|
+
async preflight() {
|
|
477
|
+
const root = benchRoot()
|
|
478
|
+
const envDir = join(root, 'environments')
|
|
479
|
+
try {
|
|
480
|
+
const stat = statSync(envDir)
|
|
481
|
+
if (!stat.isDirectory()) throw new Error('not a directory')
|
|
482
|
+
} catch {
|
|
483
|
+
throw new Error(
|
|
484
|
+
`Trata hedge-bench not found at ${envDir}.\n` +
|
|
485
|
+
`Clone: git clone --depth 1 https://github.com/Trata-Inc/trata-hedge-bench ${root}`,
|
|
486
|
+
)
|
|
487
|
+
}
|
|
488
|
+
// Validate judge router connectivity.
|
|
489
|
+
judgeRouter()
|
|
490
|
+
const ids = listTaskIds(root)
|
|
491
|
+
if (ids.length === 0) throw new Error(`No task directories found under ${envDir}`)
|
|
492
|
+
console.warn(
|
|
493
|
+
`[trata-hedge] ${ids.length} tasks loaded from ${root}. ` +
|
|
494
|
+
`Worker model reads embedded data inline (Harbor/Docker not required). ` +
|
|
495
|
+
`Judge uses ${process.env.JUDGE_MODEL ?? JUDGE_MODEL} via Tangle router.`,
|
|
496
|
+
)
|
|
497
|
+
},
|
|
498
|
+
|
|
499
|
+
async goldArtifact(_task: BenchTask): Promise<string | undefined> {
|
|
500
|
+
// No single gold answer: the score comes from rubric theme coverage, not
|
|
501
|
+
// string-match against a reference response. Return undefined — the bench
|
|
502
|
+
// harness will skip judge self-verification for this adapter.
|
|
503
|
+
return undefined
|
|
504
|
+
},
|
|
505
|
+
},
|
|
506
|
+
})
|
|
502
507
|
}
|