import type { Embedder as EmbedderInterface, EmbedderMetadata } from './types.js'; /** * transformers.js-backed Embedder. Loads a sentence-embedding model from * Hugging Face (via EMBEDDING_MODEL or the constructor argument), probes its * output dim on init, and serialises embed() calls to work around the * single-threaded runtime. */ export declare class TransformersEmbedder implements EmbedderInterface { private extractor; private _dim; private readonly _model; private lastRun; private _metadata; constructor(model?: string); /** * v1.7.5+: receive resolved metadata from the metadata-resolver chain. * Callers must invoke this AFTER init() but BEFORE the first embed() call * for the prefix to be applied. If not called, embed() falls back to * empty prefixes (treats as symmetric — degraded but doesn't crash). */ setMetadata(meta: EmbedderMetadata): void; /** Read back the metadata last set, or null. */ getMetadata(): EmbedderMetadata | null; init(): Promise; /** * Load the transformers.js pipeline, with a one-shot retry if the cached * ONNX file looks corrupt. A truncated download from a killed prior run * leaves a file that fails `Protobuf parsing` / `Load model … failed` when * onnxruntime tries to parse it. Nuking the model's cache subdirectory * and letting transformers.js re-download is the safe recovery — the * cache is content-addressed under the model id, so we only delete our * own model's subtree, not other users' models. */ private loadPipelineWithCorruptCacheRecovery; private clearModelCache; /** Legacy numeric alias — new code should call dimensions(). */ get dim(): number; /** Legacy string alias — new code should call modelIdentifier(). */ get model(): string; dimensions(): number; modelIdentifier(): string; providerName(): string; embed(text: string, taskType?: 'document' | 'query'): Promise; dispose(): Promise; /** * Build a concatenated string from title + tags + first paragraph for the * note-level (coarse) embedding. Retained for the whole-note fallback; the * chunker produces its own per-chunk strings. * * @deprecated As of v1.4.0 the chunker emits per-chunk text directly. This * helper is only used for the note-level mean-pooled fallback vector. */ static buildEmbeddingText(title: string, tags: string[], content: string): string; } /** * Back-compat alias — existing call sites import `Embedder` from this module. * New code should import `TransformersEmbedder` explicitly, or the * `Embedder` interface from `./types.js` for typing only. */ export { TransformersEmbedder as Embedder };