import type { Metadata } from 'next';
import Link from 'next/link';
import { DataTable, EmptyRow, Td, Th } from '@/components/ui/data-table';
import { EntityLink } from '@/components/ui/entity';
import { Container, Note, PageHeader } from '@/components/ui/section';
import { EmptyState, Unavailable } from '@/components/ui/unavailable';
import { api, safe } from '@/lib/api';
import { cn } from '@/lib/cn';
import { fmtAgo, fmtInt, fmtScore, num } from '@/lib/format';
import { routes } from '@/lib/site';
export const metadata: Metadata = { title: 'AI benchmarks & leaderboards', description: 'Benchmarks with their published results, evaluation configs and current leaders — never compared blindly across configs.', alternates: { canonical: '/benchmarks' } };
export const revalidate = 300;
export default async function BenchmarksPage({ searchParams }: { searchParams: Promise<{ category?: string }> }) {
const { category } = await searchParams;
const res = await safe(api.benchmarks());
const all = (res?.items ?? []).slice().sort((a, b) => (num(b.result_count) ?? 0) - (num(a.result_count) ?? 0));
const cats = new Map();
for (const b of all) {
const c = typeof b.attributes?.category === 'string' ? b.attributes.category : null;
if (c) cats.set(c, (cats.get(c) ?? 0) + 1);
}
const catList = [...cats.entries()].sort((x, y) => y[1] - x[1] || x[0].localeCompare(y[0]));
const items = category ? all.filter((b) => b.attributes?.category === category) : all;
const chip = (active: boolean) => cn('inline-flex h-8 items-center gap-1.5 border px-2.5 text-xs whitespace-nowrap', active ? 'border-ink bg-ink text-canvas' : 'border-rule text-ink-2 hover:border-rule-strong hover:text-ink');
return (
{fmtInt(items.length)}{category ? ` of ${fmtInt(all.length)}` : ''} benchmarks
: undefined}>
{catList.length > 0 && (
All {fmtInt(all.length)}
{catList.map(([c, n]) => (
{c} {fmtInt(n)}
))}
)}
{!res ? (
) : items.length === 0 ? (
{category && Show all benchmarks}
) : (
<>
Benchmark
Category
Metric
Results
Models
Current leader
Updated
{items.length === 0 && No benchmarks recorded yet. }
{items.map((b) => {
const a = b.attributes ?? {};
return (
{b.name}
{(b.description || typeof a.task === 'string') && {b.description ?? (a.task as string)} }
{typeof a.category === 'string' ? {a.category} : — }
{typeof a.metric === 'string' ? a.metric : — }
{typeof a.unit === 'string' && a.unit && ({a.unit}) }
{fmtInt(b.result_count)}
{fmtInt(b.model_count)}
{b.top ? (
{fmtScore(b.top.score)}{a.unit === '%' ? '%' : ''}
{b.top.model.organization && {b.top.model.organization.name} }
) : (
—
)}
{fmtAgo(b.updated_at)}
);
})}
Leader = best current result under the benchmark's default direction (higher or lower is better). Configs differ; open a benchmark for its leaderboard, config filter and per-model history.
>
)}
);
}