Open source · Prompt & Agent Workflows

Structured Output Repair Bench

Benchmark structured-output repair strategies against malformed model responses.

v0.1.0 · Node.js 22+ · MIT

Browse the public repository · View releases

parsed and valid are the numbers a repair library usually reports. faithful and altered are the two this bench exists for.

This walkthrough uses the tool's public README and checked-in example files. Run the command from a repository checkout with Node.js 22+.

Run the checked-in example

# a corpus every strategy either repairs faithfully or fails on: exit 0
node bin/structured-output-repair-bench.mjs --corpus examples/corpus.json

# a corpus where a naive repair alters a record's meaning: exit 1
node bin/structured-output-repair-bench.mjs --corpus examples/corpus-altered.json

# custom strategies, in the order you want them compared
node bin/structured-output-repair-bench.mjs \
  --corpus examples/corpus.json \
  --pipelines examples/pipelines.json \
  --strategies strict,span-then-close,commas-only-naive

# the machine-readable report
node bin/structured-output-repair-bench.mjs --corpus examples/corpus.json --json

npm run check   # lint, tests, both runnable examples, and npm pack --dry-run

Read the result

Findings are ordered by (location.file, record position, location.pointer, ruleId, declaration order). Every string comparison is by UTF-16 code unit; localeCompare and Intl.Collator consult ICU data that differs between Node builds, so two correct machines would disagree about the order of one scoreboard.

Scope

Every limit is enforced, reachable from its own flag, and covered by a test that drives it through the command line.