import type { FallbackEntry } from '../types'; import type { SessionRecoveryManager, RecoveryCallbacks } from '../runtime/session-recovery'; export interface ResolvedModelEntry { providerID: string; modelID: string; model: string; temperature?: number; maxTokens?: number; } export interface ClassifiedModelError { kind: 'context_window' | 'timeout' | 'overloaded' | 'provider' | 'unknown'; message: string; } interface RetryWithModelFallbackOptions { maxRetries?: number; fallbackModels?: Array; onContextWindowError?: () => Promise | boolean; /** * When provided, each per-candidate attempt is wrapped with * `recoveryManager.withRecovery()` — adding automatic timeout backoff, * overload backoff, and context-overflow compaction *within* a single * candidate before the chain moves to the next one. */ recoveryManager?: SessionRecoveryManager; /** Session ID passed to `recoveryManager.withRecovery()`. */ recoverySessionId?: string; /** Extra callbacks forwarded to `recoveryManager.withRecovery()`. */ recoveryCallbacks?: RecoveryCallbacks; } export declare function parseModelString(modelStr?: string): { providerID: string; modelID: string; } | undefined; export declare function resolveFallbackModelEntries(entries?: Array): ResolvedModelEntry[]; export declare function classifyModelError(err: unknown): ClassifiedModelError; export declare function retryWithModelFallback(callWithModel: (model: ResolvedModelEntry) => Promise<{ data?: T; error?: unknown; }>, callWithoutModel: () => Promise<{ data?: T; error?: unknown; }>, model: { providerID: string; modelID: string; } | undefined, logger: { error: (msg: string, err?: unknown) => void; log: (msg: string) => void; }, optionsOrMaxRetries?: number | RetryWithModelFallbackOptions): Promise<{ result: { data?: T; error?: unknown; }; usedModel: { providerID: string; modelID: string; } | undefined; }>; export {}; //# sourceMappingURL=model-fallback.d.ts.map