import { a as ChatCompletionRequest, C as ChatCompletionResponse } from '../../api-DL1ztBmF.js'; import { M as ModelCatalog } from '../../ModelCatalog-BcfW6bZr.js'; import { L as Logger } from '../../logger-DUq4P1BF.js'; import { S as SelectionCriteria, a as SelectionResult } from '../../routing-C4EW-wyV.js'; import '../../pricing-BUJAtUlg.js'; /** * Cascading Strategy * Tries multiple models in sequence until one succeeds */ interface CascadingOptions { models: string[]; maxAttempts?: number; retryableErrors?: string[]; onFallback?: (modelId: string, error: Error) => void; } declare class CascadingStrategy { private catalog; private logger; private options; constructor(catalog: ModelCatalog, logger: Logger, options: CascadingOptions); /** * Execute request with cascading fallback */ execute(request: ChatCompletionRequest, executor: (modelId: string, request: ChatCompletionRequest) => Promise): Promise; /** * Check if error should trigger fallback */ private isRetryableError; /** * Get cascade configuration */ getConfiguration(): CascadingOptions; /** * Update models list */ setModels(models: string[]): void; /** * Add a model to the cascade */ addModel(modelId: string, position?: number): void; /** * Remove a model from the cascade */ removeModel(modelId: string): boolean; } /** * Weighted Strategy * Selects models based on custom weighted scoring */ interface WeightConfig { cost: number; performance: number; capability: number; reliability: number; } interface WeightedStrategyOptions { weights?: Partial; normalize?: boolean; } declare class WeightedStrategy { private catalog; private logger; private weights; constructor(catalog: ModelCatalog, logger: Logger, options?: WeightedStrategyOptions); /** * Select model using weighted scoring */ select(query: string, criteria: SelectionCriteria): SelectionResult; /** * Calculate weighted score for a model */ private calculateScore; /** * Calculate cost score (normalized 0-1, lower cost = higher score) */ private calculateCostScore; /** * Calculate performance score (normalized 0-1) */ private calculatePerformanceScore; /** * Calculate capability score based on requirements */ private calculateCapabilityScore; /** * Calculate reliability score (normalized 0-1) */ private calculateReliabilityScore; /** * Estimate cost for a query */ private estimateCost; /** * Estimate latency for a model */ private estimateLatency; /** * Calculate confidence based on score distribution */ private calculateConfidence; /** * Normalize weights to sum to 1 */ private normalizeWeights; /** * Update weights */ setWeights(weights: Partial, normalize?: boolean): void; /** * Get current weights */ getWeights(): WeightConfig; } /** * Context-Aware Strategy * Selects models based on query context and requirements */ interface ContextAnalysis { hasCode: boolean; hasImage: boolean; hasJson: boolean; requiresFunctions: boolean; complexity: 'simple' | 'medium' | 'complex'; estimatedTokens: number; language?: string; } declare class ContextAwareStrategy { private catalog; private logger; constructor(catalog: ModelCatalog, logger: Logger); /** * Select model based on query context */ select(query: string, criteria?: SelectionCriteria): SelectionResult; /** * Analyze query context */ private analyzeContext; /** * Enhance criteria based on context */ private enhanceCriteria; /** * Calculate context-based score for model */ private calculateContextScore; /** * Detect if query involves code */ private detectCode; /** * Detect if query involves images */ private detectImageRequest; /** * Detect if query needs JSON output */ private detectJsonRequest; /** * Detect if query needs function calling */ private detectFunctionNeed; /** * Assess query complexity */ private assessComplexity; /** * Estimate tokens in query */ private estimateTokens; /** * Detect language from query */ private detectLanguage; /** * Estimate cost based on context */ private estimateCost; /** * Estimate latency based on context */ private estimateLatency; /** * Explain selection reasoning */ private explainSelection; } export { type CascadingOptions, CascadingStrategy, type ContextAnalysis, ContextAwareStrategy, type WeightConfig, WeightedStrategy, type WeightedStrategyOptions };