/** * Model Performance Leaderboard * * Tracks model performance metrics over time for routing decisions. * * @module multimodel/leaderboard */ import type { AgentType, Severity } from "../certification/types.js"; /** * Model performance metrics for a single run */ export interface ModelRunMetrics { /** Unique run ID */ runId: string; /** Model identifier */ modelId: string; /** Timestamp */ timestamp: string; /** Agent type */ agent: AgentType; /** Certification ID */ certificationId: string; /** Total findings reported */ findingsReported: number; /** Findings confirmed by cross-verification */ findingsConfirmed: number; /** Findings rejected by cross-verification */ findingsRejected: number; /** Findings by severity */ bySeverity: Partial>; /** Response time in ms */ responseTimeMs: number; /** Token usage */ tokens: { input: number; output: number; total: number; }; /** Cost */ cost: number; } /** * Aggregated model statistics */ export interface ModelStats { modelId: string; /** Total runs */ totalRuns: number; /** Average precision (confirmed/reported) */ precision: number; /** Average recall estimate (based on consensus) */ recallEstimate: number; /** F1 score */ f1Score: number; /** Average response time */ avgResponseTimeMs: number; /** Average cost per run */ avgCostPerRun: number; /** Findings by severity totals */ totalBySeverity: Record; /** Last run timestamp */ lastRunAt: string; /** Trend (improving/declining/stable) */ trend: "improving" | "declining" | "stable"; } /** * Leaderboard data structure */ export interface LeaderboardData { /** Last updated timestamp */ updatedAt: string; /** Total runs tracked */ totalRuns: number; /** Individual run metrics (recent) */ runs: ModelRunMetrics[]; /** Aggregated model stats */ modelStats: Record; } /** * Record a model run */ export declare function recordModelRun(projectPath: string, run: Omit): Promise; /** * Get the leaderboard */ export declare function getLeaderboard(projectPath: string): Promise; /** * Get ranked models by a specific metric */ export declare function getRankedModels(projectPath: string, options?: { metric?: "f1Score" | "precision" | "recallEstimate" | "avgCostPerRun" | "avgResponseTimeMs"; limit?: number; minRuns?: number; }): Promise>; /** * Get model recommendation for an agent based on performance */ export declare function getRecommendedModel(projectPath: string, agent: AgentType, options?: { prioritize?: "accuracy" | "speed" | "cost"; minRuns?: number; }): Promise<{ recommended: string | null; reason: string; alternatives: string[]; }>; /** * Format leaderboard as markdown */ export declare function formatLeaderboardAsMarkdown(data: LeaderboardData): string; /** * Clear leaderboard data */ export declare function clearLeaderboard(projectPath: string): Promise; //# sourceMappingURL=leaderboard.d.ts.map