Table of Contents

Interface IDocumentEmbedder

Namespace
LMKit.Abstractions
Assembly
LM-Kit.NET.dll

Optional capability for providers that embed indexed documents differently from plain text (asymmetric embedding, document side).

public interface IDocumentEmbedder

Remarks

Some models are trained with an instruction prefix on the DOCUMENT side as well as the query side; their queries and passages land in one comparable space only when each side is embedded in its own role. A provider that can express the document side implements IDocumentEmbedder in addition to IEmbedder; remote services with a document input type belong here too.

Providers with no query/document distinction do not need to implement this. Indexers feature-detect it and fall back to GetEmbeddingsAsync(IEnumerable<string>, CancellationToken) when the embedder is not an IDocumentEmbedder. Deriving from EmbedderBase gives a default implementation that simply reuses the plain path.

Methods

GetDocumentEmbeddingsAsync(IEnumerable<string>, CancellationToken)

Asynchronously generates embedding vectors for a batch of documents/passages, applying any document-specific instruction the model supports.

GetDocumentEmbeddingsAsync(string, CancellationToken)

Asynchronously generates the embedding vector for one document/passage, applying any document-specific instruction the model supports.

Share