/** * Embedding pipeline using @huggingface/transformers. * * Generates normalized embeddings for semantic search. The embedding * dimension is derived at runtime from the model's actual output. * First use downloads the model (~23MB) to the configured cache directory. */ import type { IndexProgressCallback } from "./types.js"; export interface EmbedderOptions { /** Absolute path to the model cache directory (e.g. ~/.dreb/agent/models/). */ modelCacheDir: string; /** HuggingFace model name. Default: 'Xenova/all-MiniLM-L6-v2'. */ modelName?: string; /** Number of texts to embed per batch. Default: 32. */ batchSize?: number; } export declare class Embedder { private readonly modelCacheDir; private readonly modelName; private readonly batchSize; private extractor; private initPromise; private resolvedDimension; constructor(options: EmbedderOptions); /** * Initialize the model pipeline. Must be called before embedding. * * On first use this downloads the ONNX model to `modelCacheDir`. * Subsequent calls reuse the cached model. */ initialize(): Promise; /** * Embed documents for indexing. * * Applies model-specific prefixes if required, then processes texts * in batches of `batchSize` for memory efficiency. */ embedDocuments(texts: string[], onProgress?: IndexProgressCallback): Promise; /** * Embed a query for search. * * Applies model-specific query prefix if required. */ embedQuery(query: string): Promise; /** Get the embedding dimension. Returns the model's actual dimension once known, or 384 as default. */ get dimension(): number; /** Dispose the pipeline to free memory. */ dispose(): void; /** Throw if initialize() hasn't been called yet. */ private ensureInitialized; } //# sourceMappingURL=embedder.d.ts.map