( evalSummaries: EvalSummary[], )
| 395 | } |
| 396 | |
| 397 | function buildOverallChartUrl( |
| 398 | evalSummaries: EvalSummary[], |
| 399 | ): string | undefined { |
| 400 | const aggregates = new Map<string, { total: number; count: number }>(); |
| 401 | |
| 402 | evalSummaries.forEach((summary) => { |
| 403 | summary.models.forEach((model) => { |
| 404 | const entry = aggregates.get(model.id) ?? { total: 0, count: 0 }; |
| 405 | entry.total += model.final; |
| 406 | entry.count += 1; |
| 407 | aggregates.set(model.id, entry); |
| 408 | }); |
| 409 | }); |
| 410 | |
| 411 | if (aggregates.size === 0) { |
| 412 | return undefined; |
| 413 | } |
| 414 | |
| 415 | const averages: ModelAverage[] = Array.from(aggregates.entries()).map( |
| 416 | ([id, { total, count }]) => ({ |
| 417 | id, |
| 418 | score: Number((total / count).toFixed(3)), |
| 419 | }), |
| 420 | ); |
| 421 | |
| 422 | averages.sort((a, b) => b.score - a.score); |
| 423 | |
| 424 | return buildBarChartUrl( |
| 425 | { |
| 426 | labels: averages.map((entry) => entry.id), |
| 427 | values: averages.map((entry) => entry.score), |
| 428 | title: "Average Performance by Model (All Evaluations)", |
| 429 | }, |
| 430 | { backgroundColor: "white" }, |
| 431 | ); |
| 432 | } |
| 433 | |
| 434 | function loadAnalysisLinks(): Map<string, string> { |
| 435 | const filePath = process.env.ANALYSIS_LINKS_FILE?.trim(); |
no test coverage detected