UNPKG

cyber-mysql-openai

Version:

Intelligent natural language to SQL translator with self-correction capabilities using OpenAI and MySQL

68 lines (67 loc) 1.57 kB
export interface DBConfig { host: string; port: number; user: string; password: string; database: string; ssl?: boolean; socketPath?: string; } export interface OpenAIConfig { apiKey: string; model: string; } export interface CacheConfig { enabled?: boolean; maxSize?: number; cleanupIntervalMs?: number; } export interface CyberMySQLOpenAIConfig { database: DBConfig; openai: OpenAIConfig; maxReflections?: number; logLevel?: 'error' | 'warn' | 'info' | 'debug' | 'none'; logDirectory?: string; logEnabled?: boolean; language?: 'es' | 'en'; cache?: CacheConfig; } export interface TranslationResult { sql: string; results: any[]; reflections: Reflection[]; attempts: number; success: boolean; naturalResponse?: string; detailedResponse?: string; executionTime?: number; fromCache?: boolean; } export interface SQLResult { sql: string; results: any[]; success: boolean; naturalResponse?: string; detailedResponse?: string; executionTime?: number; fromCache?: boolean; } export interface Reflection { error: string; reasoning: string; fixAttempt: string; } export type LogLevel = 'error' | 'warn' | 'info' | 'debug' | 'none'; export interface NaturalResponseOptions { detailed?: boolean; bypassCache?: boolean; } export interface CacheStats { totalEntries: number; hits: number; misses: number; hitRate: number; memoryUsage: number; oldestEntry: number; newestEntry: number; }