UNPKG

@relayplane/sdk

Version:

RelayPlane SDK with zero-config AI access, intelligent model selection, built-in examples, and contextual error handling. The easiest way to add AI to your app with automatic optimization and fallback.

57 lines 2.19 kB
/** * Intelligent Model Selection System * * This module provides explainable AI model selection based on task analysis, * performance requirements, and historical data. It powers the RelayPlane.smartRelay() method. */ import { SupportedModel, ModelProvider, TaskType, TaskCharacteristics, ModelSelectionCriteria, ModelRecommendation, SmartSelectionRequest, SmartSelectionResponse, SmartSelectionConfig, SelectionHistory } from '../types'; import { RelayConfig } from '../types'; /** * Model capability and performance database */ interface ModelCapabilities { provider: ModelProvider; costPer1kTokens: number; avgLatencyMs: number; maxTokens: number; qualityScore: number; strengths: TaskType[]; weaknesses: TaskType[]; features: string[]; speed: 'fast' | 'medium' | 'slow'; reasoning: 'high' | 'medium' | 'low'; creativity: 'high' | 'medium' | 'low'; coding: 'excellent' | 'good' | 'fair' | 'poor'; multilingual: boolean; structured: boolean; } /** * Analyze request payload to determine task characteristics */ export declare function analyzeTaskCharacteristics(payload: Record<string, any>): TaskCharacteristics; /** * Generate model recommendations based on criteria */ export declare function generateModelRecommendations(criteria: ModelSelectionCriteria, maxRecommendations?: number): ModelRecommendation[]; /** * Main intelligent model selection function */ export declare function smartRelay<T = any>(request: SmartSelectionRequest, config?: SmartSelectionConfig, relayConfig?: Partial<RelayConfig>): Promise<SmartSelectionResponse<T>>; /** * Get available models for selection */ export declare function getAvailableModels(): SupportedModel[]; /** * Get model capabilities for a specific model */ export declare function getModelCapabilities(model: SupportedModel): ModelCapabilities | undefined; /** * Clear selection history (useful for testing) */ export declare function clearSelectionHistory(): void; /** * Get selection history for analysis */ export declare function getSelectionHistory(taskType?: TaskType, limit?: number): SelectionHistory[]; export {}; //# sourceMappingURL=smart-selection.d.ts.map