/** * EmbeddingService * * Computes text embeddings via any OpenAI-compatible `/embeddings` endpoint * (OpenAI, Ollama, LocalAI, vLLM, LM Studio, …). * * Configuration (in priority order): * 1. Constructor argument `EmbeddingConfig` * 2. Environment variables: EMBED_BASE_URL, EMBED_MODEL, EMBED_API_KEY * * The service batches texts in groups of `batchSize` (default 64) and * resolves all batches sequentially to avoid overloading the server. */ import type { OpenLoreConfig } from '../../types/index.js'; export interface EmbeddingConfig { /** Base URL of the OpenAI-compatible API, e.g. "http://localhost:11434/v1" */ baseUrl: string; /** Embedding model name, e.g. "nomic-embed-text" or "text-embedding-3-small" */ model: string; /** API key — optional for local servers */ apiKey?: string; /** Maximum number of texts per API call (default: 64) */ batchSize?: number; /** Disable SSL certificate verification (e.g. self-signed certs on local servers) */ skipSslVerify?: boolean; } export declare class EmbeddingService { private baseUrl; private model; private apiKey; private batchSize; /** * Maximum characters per text before truncation. * ~24 000 chars ≈ 6 000 words ≈ 8 000 tokens — stays under the 8 192-token * limit of most embedding models (nomic-embed-text, text-embedding-3-small…). */ private static readonly MAX_CHARS_PER_TEXT; constructor(config: EmbeddingConfig); /** The configured embedding model name (recorded in the index metadata sidecar). */ get modelName(): string; /** * Build an EmbeddingService from environment variables. * Throws if EMBED_BASE_URL or EMBED_MODEL are not set. */ static fromEnv(): EmbeddingService; /** * Build an EmbeddingService from a OpenLoreConfig. * Returns null if no embedding config is present. */ static fromConfig(cfg: OpenLoreConfig): EmbeddingService | null; /** * Compute embeddings for a list of texts. * Returns one embedding vector per input text (same order). */ embed(texts: string[]): Promise; private callEmbeddingsApi; } //# sourceMappingURL=embedding-service.d.ts.map