UNPKG

mathrok

Version:

AI-powered symbolic mathematics library combining traditional Computer Algebra System (CAS) capabilities with natural language processing for math problem solving

75 lines 1.81 kB
/** * AI Model Manager * Handles AI model loading, caching, and processing with fallback systems */ export interface AIModelConfig { modelName: string; task: string; maxLength?: number; temperature?: number; topK?: number; topP?: number; } export interface AIResult { result: string; confidence: number; processingTime: number; method: 'ai' | 'rule_based' | 'hybrid'; alternatives?: string[]; metadata?: Record<string, any>; } export interface ModelLoadStatus { isLoaded: boolean; isLoading: boolean; error?: string; loadTime?: number; } /** * AI Model Manager with lazy loading and fallback capabilities */ export declare class AIModelManager { private model; private modelConfig; private loadStatus; private cache; private readonly cacheSize; private readonly cacheTTL; constructor(config: AIModelConfig); /** * Initialize AI model with lazy loading */ initialize(): Promise<boolean>; /** * Process query with AI model or fallback */ processQuery(query: string, context?: any): Promise<AIResult>; /** * Get model status */ getStatus(): ModelLoadStatus; /** * Clear cache */ clearCache(): void; /** * Get cache statistics */ getCacheStats(): { size: number; hitRate: number; memoryUsage: number; }; private waitForLoading; private processWithAI; private processWithFallback; private prepareInput; private extractResult; private calculateConfidence; private extractAlternatives; private ruleBasedProcessing; private generateCacheKey; private getFromCache; private addToCache; private estimateMemoryUsage; } //# sourceMappingURL=manager.d.ts.map