Observability

Eval Results

An eval run as a grid of cases — pass, fail or regressed vs the baseline — with per-case input, expected and actual.

3 variantsMIT

Preview

Installation

Copies the component into components/ui and installs its dependencies and theme tokens.

pnpm dlx shadcn@latest add https://uilab.tmih06.com/r/eval-results.json

Usage

Pass your own data and wire the callbacks to your agent runtime.

import { EvalResults } from "@/components/ui/eval-results";

export function EvalRun({ run }: { run: EvalRun }) {
  return (
    <EvalResults
      data={{
        suite: run.suite,
        label: `${run.candidate} vs ${run.baseline}`,
        // status: "pending" | "running" | "pass" | "fail" | "regressed" | "improved"
        cases: run.cases,
        baselinePassRate: run.baselinePassRate,
        metrics: [
          { id: "acc", label: "Accuracy", baseline: 0.85, candidate: 0.88, better: "higher" },
          { id: "p50", label: "Latency p50", baseline: 1840, candidate: 1320, better: "lower" },
        ],
      }}
      onSelectCase={(c) => console.log(c.id)}
    />
  );
}

// Pass null while the first result payload is in flight. When refetching,
// keep stale data for shape hints and set loading.
export function EvalRunState({ query }: { query: EvalRunQuery }) {
  return (
    <EvalResults
      data={query.data ? toEvalResultsData(query.data) : null}
      loading={query.isRefetching}
      skeleton={{ count: 60, metrics: 4 }}
    />
  );
}

Props

PropTypeDefaultDescription
data*{ suite: string; label?: string; cases: EvalCase[]; baselinePassRate?: number; metrics?: EvalMetric[] } | null—The suite, its cases in run order and, for the delta and the compare view, the baseline pass rate and metrics. Pass null while the first payload loads.
loadingbooleanfalseForce the layout-preserving skeleton while refetching, even when stale data is available.
skeleton{ count?: number; metrics?: number }—Shape hints for the loading state; count is case cells in the grid or regressed-case rows in compare, metrics is the number of compare metric groups.
view"grid" | "compare""grid"A square per case, or baseline vs candidate bars per metric plus the regressed cases.
filter"all" | "failed" | "regressed" | "improved"—Controlled filter. Non-matching cases dim instead of disappearing, so the grid stays put.
onFilterChange(filter) => void—Called when a filter pill is picked.
selectedIdstring | null—Controlled selection. The selected case shows its input, expected and actual output below.
onSelectCase(testCase: EvalCase) => void—Called on click or Enter. Arrow keys, Home and End move between cases.
localestring"en-US"BCP 47 locale for metric values that have no `format` of their own.
labelsPartial<EvalResultsLabels>—Your own UI strings (loading announcement, statuses, filters, headings, screen-reader text), for translating. Right-to-left works under `dir="rtl"`.
classNamestring—Extra classes for the root element.
type EvalCase = {
  id: string;
  name: string;
  status: "pending" | "running" | "pass" | "fail" | "regressed" | "improved";
  score?: number; // 0–1
  input?: string;
  expected?: string;
  actual?: string;
  reason?: string;
};

type EvalMetric = {
  id: string;
  label: string;
  baseline: number;
  candidate: number;
  better: "higher" | "lower";
  format?: (value: number) => string;
};