/** * LocalEmbeddingService * * A zero-config, on-device embedder. It runs a small, pinned, CPU-only model * via the optional `@huggingface/transformers` package (Transformers.js + * onnxruntime) — no endpoint, no API key, no network beyond a one-time model * download that is cached on disk. * * It implements the same {@link Embedder} contract as the remote * `EmbeddingService`, so `VectorIndex` is agnostic to which one it was handed. * * The heavy dependency is loaded lazily, the first time `embed()` runs, and is * declared as an *optional* dependency: if it is not installed (or failed to * build on the platform), `embed()` throws a clear, actionable error instead of * breaking the build/install. The first-class keyword (BM25) index never depends * on it. */ import type { Embedder } from './embedding-service.js'; import type { EmbeddingConfig } from '../../types/index.js'; /** * Pinned default model: all-MiniLM-L6-v2 (~22M params, 384-dim), the standard * small, CPU-runnable sentence embedder. Pre-quantized ONNX weights (~23 MB) are * fetched once and cached. Pinned so results are reproducible across machines. */ export declare const DEFAULT_LOCAL_MODEL = "Xenova/all-MiniLM-L6-v2"; /** Where downloaded model weights are cached — shared across repositories. */ export declare const LOCAL_MODEL_CACHE_DIR: string; export declare class LocalEmbeddingService implements Embedder { private readonly model; private readonly batchSize; /** Lazily-initialised, memoised extractor (model loads once per process). */ private extractorPromise; /** Mirrors EmbeddingService: keep texts under the model's token window. */ private static readonly MAX_CHARS_PER_TEXT; constructor(model?: string, batchSize?: number); static fromConfig(cfg: EmbeddingConfig): LocalEmbeddingService; /** `local:` prefix lets the served retrieval mode be derived from the sidecar. */ get modelName(): string; private getExtractor; embed(texts: string[]): Promise; } //# sourceMappingURL=local-embedding-service.d.ts.map