j-chim commited on
Commit
bfb71af
·
1 Parent(s): 6e90b4d

Adapt upstream category-based code to v2 tag taxonomy

Browse files

Upstream's new OG routes, eval layout, and benchmark-detail additions
referenced the retired v1 category model. Map to v2 equivalents:
- evaluations_by_category -> evaluations_by_tag (OG model card)
- summary.category -> derived_tags[0] (OG/eval-detail social subtitle)
- category: CategoryType -> EvalTag (benchmark-detail local row types)
- summary_eval_ids -> constituent_evaluation_ids (clean-hierarchy Vals.ai merge)

Also cast a pre-existing parseMaybeJson(evalcards_annotations) to
RowAnnotations in view-data (latent, masked by ignoreBuildErrors).

app/api/og/evals/[...id]/route.tsx CHANGED
@@ -42,7 +42,7 @@ export async function GET(
42
  summary.evaluation_name ??
43
  summary.composite_display_name ??
44
  evalName
45
- category = summary.category ?? null
46
  modelsCount = summary.models_count ?? null
47
  topModelName = summary.best_model?.name ?? null
48
  topScore = summary.best_model?.score ?? null
 
42
  summary.evaluation_name ??
43
  summary.composite_display_name ??
44
  evalName
45
+ category = summary.derived_tags?.[0] ?? null
46
  modelsCount = summary.models_count ?? null
47
  topModelName = summary.best_model?.name ?? null
48
  topScore = summary.best_model?.score ?? null
app/api/og/models/[...id]/route.tsx CHANGED
@@ -30,7 +30,7 @@ export async function GET(
30
  if (summary) {
31
  modelName = summary.model_info?.name ?? modelName
32
  developer = summary.model_info?.developer ?? null
33
- const categories = summary.evaluations_by_category ?? {}
34
  const seen = new Set<string>()
35
  let total = 0
36
  for (const items of Object.values(categories)) {
 
30
  if (summary) {
31
  modelName = summary.model_info?.name ?? modelName
32
  developer = summary.model_info?.developer ?? null
33
+ const categories = summary.evaluations_by_tag ?? {}
34
  const seen = new Set<string>()
35
  let total = 0
36
  for (const items of Object.values(categories)) {
app/evals/[...id]/layout.tsx CHANGED
@@ -27,7 +27,7 @@ export async function generateMetadata(props: {
27
  summary.evaluation_name ??
28
  summary.composite_display_name ??
29
  evalName
30
- category = summary.category ?? null
31
  modelsCount = summary.models_count ?? null
32
  }
33
  } catch {
 
27
  summary.evaluation_name ??
28
  summary.composite_display_name ??
29
  evalName
30
+ category = summary.derived_tags?.[0] ?? null
31
  modelsCount = summary.models_count ?? null
32
  }
33
  } catch {
components/benchmark-detail.tsx CHANGED
@@ -8307,7 +8307,7 @@ function SummaryMetricsList({
8307
  rankTotal: number | null
8308
  rankRatio: number | null
8309
  evalSummaryId: string | null
8310
- category: CategoryType
8311
  }
8312
  type Bucket = { key: string; name: string; rows: Row[] }
8313
  const buckets = new Map<string, Bucket>()
@@ -8439,7 +8439,7 @@ type SummaryRow = {
8439
  rankTotal: number | null
8440
  rankRatio: number | null
8441
  evalSummaryId: string | null
8442
- category: CategoryType
8443
  }
8444
 
8445
  function SummaryBucketBlock({
 
8307
  rankTotal: number | null
8308
  rankRatio: number | null
8309
  evalSummaryId: string | null
8310
+ category: EvalTag
8311
  }
8312
  type Bucket = { key: string; name: string; rows: Row[] }
8313
  const buckets = new Map<string, Bucket>()
 
8439
  rankTotal: number | null
8440
  rankRatio: number | null
8441
  evalSummaryId: string | null
8442
+ category: EvalTag
8443
  }
8444
 
8445
  function SummaryBucketBlock({
lib/clean-hierarchy.ts CHANGED
@@ -1077,7 +1077,7 @@ function collapseValsAiSetupVariants(h: CleanableHierarchy) {
1077
  if (!canonical) continue
1078
 
1079
  const existingSliceKeys = new Set((canonical.slices ?? []).map((s) => s.key))
1080
- const mergedEvalIds = new Set(canonical.summary_eval_ids ?? [])
1081
 
1082
  for (const l of leaked) {
1083
  const m = l.key.match(PATTERN)
@@ -1096,10 +1096,10 @@ function collapseValsAiSetupVariants(h: CleanableHierarchy) {
1096
  })
1097
  existingSliceKeys.add(sliceKey)
1098
  }
1099
- for (const id of l.summary_eval_ids ?? []) mergedEvalIds.add(id)
1100
  removeKeys.add(l.key)
1101
  }
1102
- canonical.summary_eval_ids = Array.from(mergedEvalIds)
1103
  }
1104
 
1105
  if (removeKeys.size > 0) {
 
1077
  if (!canonical) continue
1078
 
1079
  const existingSliceKeys = new Set((canonical.slices ?? []).map((s) => s.key))
1080
+ const mergedEvalIds = new Set(canonical.constituent_evaluation_ids ?? [])
1081
 
1082
  for (const l of leaked) {
1083
  const m = l.key.match(PATTERN)
 
1096
  })
1097
  existingSliceKeys.add(sliceKey)
1098
  }
1099
+ for (const id of l.constituent_evaluation_ids ?? []) mergedEvalIds.add(id)
1100
  removeKeys.add(l.key)
1101
  }
1102
+ canonical.constituent_evaluation_ids = Array.from(mergedEvalIds)
1103
  }
1104
 
1105
  if (removeKeys.size > 0) {
lib/view-data.ts CHANGED
@@ -18,7 +18,7 @@ import {
18
  type SourceData,
19
  type SourceMetadata,
20
  } from "@/lib/benchmark-schema"
21
- import type { DeveloperListEntry } from "@/lib/backend-artifacts"
22
  import type {
23
  BenchmarkEvalListItem,
24
  BenchmarkEvalSummary,
@@ -390,7 +390,7 @@ function resultFromCell(row: Row): EvaluationResult {
390
  // it passes through unchanged when the value is already an object
391
  // (legacy snapshots / future binding fixes).
392
  const generationConfig = parseMaybeJson(row.generation_config) as GenerationConfig | undefined
393
- const annotations = parseMaybeJson(row.evalcards_annotations)
394
 
395
  return {
396
  evaluation_name: asString(row.metric_display_name ?? row.eval_evaluation_name ?? row.metric_id, "Score"),
 
18
  type SourceData,
19
  type SourceMetadata,
20
  } from "@/lib/benchmark-schema"
21
+ import type { DeveloperListEntry, RowAnnotations } from "@/lib/backend-artifacts"
22
  import type {
23
  BenchmarkEvalListItem,
24
  BenchmarkEvalSummary,
 
390
  // it passes through unchanged when the value is already an object
391
  // (legacy snapshots / future binding fixes).
392
  const generationConfig = parseMaybeJson(row.generation_config) as GenerationConfig | undefined
393
+ const annotations = parseMaybeJson(row.evalcards_annotations) as RowAnnotations | undefined
394
 
395
  return {
396
  evaluation_name: asString(row.metric_display_name ?? row.eval_evaluation_name ?? row.metric_id, "Score"),