/** * Embedding backend interface that all embedding providers must implement. * Supports both single text and batch embedding operations. */ export interface EmbeddingBackend { /** Display name of the embedding backend (e.g., 'gemini', 'ollama') */ name: string; /** * Initialize the backend, validating credentials and connectivity. * @throws Error if initialization fails (e.g., invalid API key, server unreachable) */ initialize(): Promise; /** * Generate an embedding vector for a single text. * @param text - The text to embed * @returns A promise resolving to the embedding vector (array of numbers) */ embed(text: string): Promise; /** * Generate embedding vectors for multiple texts in a single batch. * More efficient than calling embed() multiple times. * @param texts - Array of texts to embed * @returns A promise resolving to an array of embedding vectors */ embedBatch(texts: string[]): Promise; /** * Get the dimensionality of the embedding vectors produced by this backend. * @returns The number of dimensions in the embedding vectors */ getDimensions(): number; /** * Get the model identifier used by this backend. * @returns The model name/identifier (e.g., 'nomic-embed-text', 'gemini-embedding-001') */ getModel(): string; } /** * Configuration options for embedding backends. */ export interface EmbeddingConfig { /** Which embedding backend to use */ backend: 'ollama' | 'gemini' | 'local'; /** Model name/identifier (backend-specific) */ model?: string; /** API key for cloud-based backends (Gemini) */ apiKey?: string; /** Base URL for the embedding API (useful for Ollama or custom endpoints) */ baseUrl?: string; /** Rate limiting: maximum requests per second */ rateLimitRps?: number; /** Rate limiting: maximum burst capacity (default: 10) */ rateLimitBurst?: number; /** * Maximum number of texts to process in a single batch request. * Large batches are automatically split into smaller chunks to prevent * timeouts, memory issues, and API rate limit errors. * Default: 100 for Ollama */ batchSize?: number; /** * Maximum number of concurrent batch requests (Ollama only). * Controls how many batch requests are sent in parallel. * Default: 4 for Ollama */ concurrency?: number; } /** * Split an array into chunks of specified size. * @param array - The array to chunk * @param size - Maximum size of each chunk * @returns Array of chunks */ export declare function chunkArray(array: T[], size: number): T[][]; /** * Default embedding configuration using Google Gemini. * Gemini offers a free tier with 1500 RPM. * Get API key at: https://aistudio.google.com/app/apikey */ export declare const DEFAULT_CONFIG: EmbeddingConfig; /** * Information about a backend fallback that occurred during initialization. * This is returned when the configured backend fails and we fall back to another. */ export interface BackendFallbackInfo { /** Whether a fallback occurred */ occurred: true; /** The backend that was originally configured */ originalBackend: string; /** The backend we fell back to */ fallbackBackend: string; /** The error message from the original backend failure */ reason: string; } /** * Result of creating an embedding backend, including optional fallback info. */ export interface CreateBackendResult { /** The initialized embedding backend */ backend: EmbeddingBackend; /** Information about fallback if one occurred */ fallback?: BackendFallbackInfo; } //# sourceMappingURL=types.d.ts.map