/** * Agentic QE v3 - Nomic Embedder * Local, zero-cost embeddings via Ollama with nomic-embed-text model * * Features: * - 768-dimensional embeddings optimized for code * - Batch processing with progress tracking * - Semantic context formatting for code chunks * - Content-hash based caching * - Graceful fallback when Ollama is unavailable * - Error handling and retries */ import { EmbeddingCache } from './embedding-cache'; import { CodeChunk, EmbeddingBatchResult, ProgressCallback, CacheStats, IEmbeddingProvider } from './types'; /** * Configuration for NomicEmbedder */ export interface NomicEmbedderConfig { /** Ollama base URL (default: http://localhost:11434) */ ollamaBaseUrl?: string; /** Batch size for processing (default: 100) */ batchSize?: number; /** Maximum cache size (default: 10000) */ maxCacheSize?: number; /** Enable fallback to pseudo-embeddings when Ollama unavailable */ enableFallback?: boolean; /** Pre-configured cache instance (for dependency injection) */ cache?: EmbeddingCache; } /** * Nomic Embedder for generating code embeddings via Ollama */ export declare class NomicEmbedder implements IEmbeddingProvider { private client; private cache; private batchSize; private enableFallback; private ollamaAvailable; /** * Create a NomicEmbedder instance * * @example Basic usage: * ```typescript * const embedder = new NomicEmbedder(); * const embedding = await embedder.embed("function add(a, b) { return a + b; }"); * ``` * * @example With configuration: * ```typescript * const embedder = new NomicEmbedder({ * ollamaBaseUrl: 'http://localhost:11434', * enableFallback: true, * }); * ``` */ constructor(config?: NomicEmbedderConfig); /** * Generate embedding for a single text string */ embed(text: string): Promise; /** * Format code chunk for semantic embedding * Format: "[language] [type] [name]: [content]" */ formatForEmbedding(chunk: CodeChunk): string; /** * Generate embeddings for multiple text strings (IEmbeddingProvider interface) */ embedBatch(texts: string[]): Promise; /** * Generate embeddings for multiple code chunks with batching and progress tracking */ embedCodeChunks(chunks: CodeChunk[], progressCallback?: ProgressCallback): Promise; /** * Process a single batch of chunks */ private processBatch; /** * Check if Ollama is available (cached check) */ private isOllamaAvailable; /** * Reset the Ollama availability cache */ resetOllamaCheck(): void; /** * Generate a pseudo-embedding based on code features * Used as fallback when Ollama is not available */ private generatePseudoEmbedding; /** * Clear the embedding cache */ clearCache(): void; /** * Get cache statistics */ getCacheStats(): CacheStats; /** * Verify Ollama connection and model availability */ healthCheck(): Promise; /** * Get Ollama server information */ getServerInfo(): Promise; /** * Get embedding dimensions */ getDimensions(): number; /** * Get configuration info */ getConfig(): { model: "nomic-embed-text"; dimensions: 768; contextWindow: 8192; batchSize: number; maxRetries: 3; enableFallback: boolean; }; } /** * Create a NomicEmbedder instance * Factory function for convenience */ export declare function createNomicEmbedder(config?: NomicEmbedderConfig): NomicEmbedder; //# sourceMappingURL=nomic-embedder.d.ts.map