/** * Model Routing Intelligence for UAM * * Routes tasks to the optimal model based on: * - Task classification and difficulty * - Model capability fingerprints (benchmarked data) * - Latency/accuracy/cost tradeoffs * - Fallback chains for resilience * - OPT 8: Persistent fingerprint data from SQLite * * Based on BENCHMARK_ANALYSIS.md and MODEL_BENCHMARK_RESULTS.md data. */ export type ModelId = 'glm-4.7' | 'gpt-5.2' | 'claude-opus-4.5' | 'gpt-5.2-codex'; export interface CategoryStats { attempts: number; successes: number; } export interface ModelFingerprint { id: ModelId; strengths: string[]; weaknesses: string[]; avgLatencyMs: number; successRate: number; costPerTask: number; maxComplexity: 'easy' | 'medium' | 'hard'; bestCategories: string[]; categoryStats?: Record; } export interface RoutingDecision { primary: ModelId; fallback: ModelId[]; reason: string; estimatedLatencyMs: number; estimatedSuccessRate: number; estimatedCost: number; } export interface RoutingConfig { preferLatency: boolean; preferAccuracy: boolean; maxCostPerTask: number; maxLatencyMs: number; availableModels: ModelId[]; } /** * Failure handlers for model-specific known issues */ declare const FAILURE_HANDLERS: Record; /** * Route a task to the best model */ export declare function routeTask(instruction: string, difficulty?: 'easy' | 'medium' | 'hard', config?: Partial): RoutingDecision; /** * Get failure handler for a model-specific error */ export declare function getFailureHandler(modelId: ModelId, errorType: string): typeof FAILURE_HANDLERS[string] | null; /** * Get model fingerprint */ export declare function getModelFingerprint(modelId: ModelId): ModelFingerprint | null; /** * Get all model fingerprints */ export declare function getAllModelFingerprints(): Record; /** * Update model fingerprint with new benchmark data */ export declare function updateModelFingerprint(modelId: ModelId, updates: Partial>): void; /** * Record task outcome to update model fingerprints (feedback loop) * Call this after each task completes to improve future routing decisions * OPT 8: Now persists to SQLite for cross-session learning */ export declare function recordTaskOutcome(modelId: ModelId, success: boolean, latencyMs: number, taskCategory?: string): void; /** * Get routing recommendation with explanation */ export declare function explainRouting(instruction: string, difficulty?: 'easy' | 'medium' | 'hard'): string; /** * OPT 8: Close fingerprint database connection */ export declare function closeFingerprintDb(): void; /** * OPT 8: Force reload fingerprints from database */ export declare function reloadFingerprints(): void; export declare const ModelRouter: { routeTask: typeof routeTask; getFailureHandler: typeof getFailureHandler; getModelFingerprint: typeof getModelFingerprint; getAllModelFingerprints: typeof getAllModelFingerprints; updateModelFingerprint: typeof updateModelFingerprint; recordTaskOutcome: typeof recordTaskOutcome; explainRouting: typeof explainRouting; closeFingerprintDb: typeof closeFingerprintDb; reloadFingerprints: typeof reloadFingerprints; }; export default ModelRouter; //# sourceMappingURL=model-router.d.ts.map