/**
 * AI Service Interface for multiple AI providers
 * Provides a unified interface for OpenAI, Claude, and other AI services
 */
import { EventEmitter } from "events";
/**
 * Custom AI Error class that preserves structured error information
 */
export declare class AIError extends Error {
    statusCode: number;
    errorType: string;
    provider: string;
    constructor(message: string, statusCode?: number, errorType?: string, provider?: string);
}
export interface AIConfig {
    provider: "openai" | "anthropic" | "mock";
    apiKey?: string;
    model?: string;
    temperature?: number;
    maxTokens?: number;
    baseURL?: string;
    enableCaching?: boolean;
    enableLogging?: boolean;
    models?: {
        chat?: string;
        template?: string;
        fileAnalysis?: string;
        validation?: string;
    };
}
export interface AIMessage {
    role: "system" | "user" | "assistant";
    content: string;
}
export interface AIResponse {
    content: string;
    model: string;
    usage?: {
        promptTokens: number;
        completionTokens: number;
        totalTokens: number;
    };
    cost?: number;
    cached?: boolean;
}
export interface TemplateResponse extends AIResponse {
    template?: any;
}
export interface FileAnalysisResponse extends AIResponse {
    analysis?: string;
    dataPoints?: any[];
}
export interface AIAnalysisOptions {
    analysisType?: string;
    requiresStructuredOutput?: boolean;
    requiresReasoning?: boolean;
    temperature?: number;
    maxTokens?: number;
    systemPrompt?: string;
    responseFormat?: {
        type: string;
    };
}
/**
 * Abstract base class for AI providers
 */
export declare abstract class AIProvider {
    protected config: AIConfig;
    constructor(config: AIConfig);
    abstract analyze(prompt: string, options?: AIAnalysisOptions): Promise<AIResponse>;
    abstract chat(messages: AIMessage[], options?: AIAnalysisOptions): Promise<AIResponse>;
    abstract validateConfig(): boolean;
}
/**
 * OpenAI Provider Implementation
 */
export declare class OpenAIProvider extends AIProvider {
    private client;
    private models;
    constructor(config: AIConfig);
    private initializeClient;
    validateConfig(): boolean;
    analyze(prompt: string, options?: AIAnalysisOptions): Promise<AIResponse>;
    chat(messages: AIMessage[], options?: AIAnalysisOptions): Promise<AIResponse>;
    private calculateCost;
    private handleOpenAIError;
}
/**
 * Mock Provider for testing
 */
export declare class MockAIProvider extends AIProvider {
    validateConfig(): boolean;
    analyze(prompt: string, _options?: AIAnalysisOptions): Promise<AIResponse>;
    chat(messages: AIMessage[], _options?: AIAnalysisOptions): Promise<AIResponse>;
}
/**
 * Main AI Service with caching and model routing
 */
export declare class AIService extends EventEmitter {
    private providers;
    private cache;
    private fileHandler;
    private defaultProvider;
    constructor();
    /**
     * Register an AI provider
     */
    registerProvider(name: string, config: AIConfig): void;
    /**
     * Set default provider
     */
    setDefaultProvider(name: string): void;
    /**
     * Analyze content using AI
     */
    analyze(prompt: string, options?: AIAnalysisOptions & {
        provider?: string;
        useCache?: boolean;
    }): Promise<AIResponse>;
    /**
     * Chat with AI
     */
    chat(messages: AIMessage[], options?: AIAnalysisOptions & {
        provider?: string;
        useCache?: boolean;
    }): Promise<AIResponse>;
    /**
     * Generate template from conversation
     */
    generateTemplate(messages: AIMessage[], options?: AIAnalysisOptions & {
        provider?: string;
    }): Promise<TemplateResponse>;
    /**
     * Analyze uploaded file
     */
    analyzeFile(fileContent: string, fileType: string, deviceInfo?: Record<string, any>, options?: AIAnalysisOptions & {
        provider?: string;
    }): Promise<FileAnalysisResponse>;
    /**
     * Select best model for task
     */
    selectModel(criteria: {
        contentLength?: number;
        complexity?: "low" | "medium" | "high";
        requiresReasoning?: boolean;
        requiresStructuredOutput?: boolean;
        costSensitive?: boolean;
    }): {
        provider: string;
        model: string;
        reason: string;
    };
    /**
     * Generate cache key
     */
    private getCacheKey;
    /**
     * Log AI usage for tracking
     */
    private logUsage;
    /**
     * Clear cache
     */
    clearCache(): void;
    /**
     * Get usage statistics
     */
    getUsageStats(_startDate?: Date, _endDate?: Date): Promise<{
        totalTokens: number;
        totalCost: number;
        byProvider: Record<string, {
            tokens: number;
            cost: number;
        }>;
    }>;
}
export declare function getAIService(): AIService;
export declare const aiService: AIService;
export default AIService;
//# sourceMappingURL=aiService.d.ts.map