Skip to main content

Module report_html

Module report_html 

Source
Expand description

Self-contained HTML comparison report over the persisted eval runs.

generate_report loads every *.json RunRecord in a results directory, embeds them verbatim as a JSON blob inside a SINGLE report.html (no CDN, no external scripts/fonts — it opens offline by double-click), and renders, with vanilla JS + inline CSS, a layout that scales to comparing 10–50 models at a glance:

  • a sticky controls bar (name filter, latest/best/all-runs view toggle, sort selector),
  • a leaderboard (one row per model in the active view; ranked by accuracy with color-scaled accuracy bars + latency/token heat, sortable columns, row-click run-history detail),
  • a model × case heatmap (rows = models, columns = the union of case names, green/red cells, sticky first column + header, per-case pass-rate footer + per-model accuracy column),
  • a collapsible raw runs list (every saved run for reference).

Correctness over polish: the JS recomputes EVERY aggregate client-side from the embedded records (accuracy = passed/total; latency p50/p95/mean from each outcome’s latency.secs + nanos/1e9; mean tokens over outcomes with a non-null tokens), so the generator only embeds the data + page shell. None of EvalReport’s Rust-side aggregates are serialized — only outcomes — so JS must derive them.

Functions§

generate_report
Load every *.json run record under results_dir, embed them in a self-contained report.html written to results_dir/report.html, and return that path. Files that fail to parse as a RunRecord are skipped with a warning (a stray/old-format file shouldn’t sink the whole report).