/** * @fileoverview Multi-LLM Provider Selection Strategies * @module @skillsmith/core/testing/MultiLLMProvider.selection * @see SMI-1523: Configure multi-LLM provider chain * @see SMI-2741: Split from MultiLLMProvider.ts to meet 500-line standard * * Provider selection algorithms for the MultiLLMProvider: * - Round-robin load balancing * - Least-loaded selection * - Latency-based selection * - Cost-based selection * - Fallback provider resolution on error */ import type { LLMProviderType, ProviderMetrics, ProviderStatus, LLMRequest, ResolvedMultiLLMConfig, FallbackRule } from './MultiLLMProvider.types.js'; /** * Select a provider using round-robin strategy * * @param providers - Available providers * @param roundRobinIndex - Current round-robin index (mutated) * @returns Selected provider and updated index */ export declare function selectRoundRobin(providers: LLMProviderType[], roundRobinIndex: number): { provider: LLMProviderType; nextIndex: number; }; /** * Select the provider with the lowest current load * * @param providers - Available providers * @param getStatus - Function to get provider status * @returns Selected provider */ export declare function selectLeastLoaded(providers: LLMProviderType[], getStatus: (provider: LLMProviderType) => ProviderStatus): LLMProviderType; /** * Select the provider with the lowest average latency * * @param providers - Available providers * @param getMetrics - Function to get provider metrics * @returns Selected provider */ export declare function selectByLatency(providers: LLMProviderType[], getMetrics: (provider: LLMProviderType) => ProviderMetrics | undefined): LLMProviderType; /** * Select the provider with the lowest cost per token * * @param providers - Available providers * @param config - Provider configuration * @returns Selected provider */ export declare function selectByCost(providers: LLMProviderType[], config: ResolvedMultiLLMConfig['providers']): LLMProviderType; /** * Select an appropriate provider for a request * * Considers cost constraints, load balancing strategy, and default provider. * * @param request - LLM request with optional constraints * @param available - Available (healthy) providers * @param config - Full multi-LLM config * @param roundRobinIndex - Current round-robin index * @param getStatus - Function to get provider status * @param getMetrics - Function to get provider metrics * @returns Selected provider and next round-robin index */ export declare function selectProvider(request: LLMRequest, available: LLMProviderType[], config: ResolvedMultiLLMConfig, roundRobinIndex: number, getStatus: (provider: LLMProviderType) => ProviderStatus, getMetrics: (provider: LLMProviderType) => ProviderMetrics | undefined): { provider: LLMProviderType; nextRoundRobinIndex: number; }; /** * Find the appropriate fallback provider after a failure * * @param currentProvider - Provider that failed * @param error - The error that caused the failure * @param rules - Fallback rules * @param available - Currently available providers * @returns Fallback provider or null if none available */ export declare function getFallbackProvider(currentProvider: LLMProviderType, error: unknown, rules: FallbackRule[], available: LLMProviderType[]): LLMProviderType | null; //# sourceMappingURL=MultiLLMProvider.selection.d.ts.map