@ledgelm/reporter
v0.4.0
Published
A thin reporter for sending eval results to LedgeLM
Readme
@ledgelm/reporter
The TypeScript reporter buffers eval results and sends them to LedgeLM. It does not run evals or calculate baselines.
import { flush, report } from '@ledgelm/reporter';
report({
name: 'response_grounding',
type: 'judge',
score: 0.82,
passed: true,
usage: {
target: { input_tokens: 812, output_tokens: 146 },
judge: { input_tokens: 1042, output_tokens: 87 }
},
input: { messages: [{ role: 'user', content: 'Can I return this purchase?' }] },
output: 'Yes. Refunds are available within 30 days with a receipt.',
expected_output: 'Explain the 30-day refund policy and receipt requirement.',
provenance: {
target_id: 'support-claude-sonnet',
target: { provider: 'anthropic', model: 'claude-sonnet' },
dataset: { name: 'support-golden', version: '2026-07' }
}
});
const verdict = await flush();Set LEDGELM_API_URL and LEDGELM_API_TOKEN in GitHub Actions. To target a local or alternate
deployment explicitly, pass flush({ api_url: 'https://your-tunnel.example' }); the explicit
option takes precedence over the environment variable.
Upload failures warn and return an unknown verdict, so LedgeLM availability does not fail the
eval job.
For a GitHub Actions matrix, do not flush in each shard. Export a typed artifact and let the LedgeLM fan-in action flush the complete matrix:
import { reportArtifactSchema, type ReportInput } from '@ledgelm/reporter';
const results: ReportInput[] = await runSuite();
const artifact = reportArtifactSchema.parse({
schema_version: 1,
shard: process.env.LEDGELM_SHARD!,
results
});
await Bun.write('ledgelm-results.json', JSON.stringify(artifact));The action validates this exact schema before it buffers or uploads any result.
