Interface IQueryEmbedder
- Namespace
- LMKit.Abstractions
- Assembly
- LM-Kit.NET.dll
Optional capability for providers that embed search queries differently from passages (asymmetric embedding).
public interface IQueryEmbedder
Remarks
Some models improve retrieval recall by applying a query-specific instruction prefix (for example Qwen3 Embedding, Nomic Embed, and BGE v1.5). A provider that supports this implements IQueryEmbedder in addition to IEmbedder; the passage path stays on GetEmbeddingsAsync(string, CancellationToken).
Providers with no query/passage distinction do not need to implement this. Consumers that want query embedding should feature-detect it and fall back to the passage path when the embedder is not an IQueryEmbedder. Deriving from EmbedderBase gives a default implementation that simply reuses the passage path.
Methods
- GetQueryEmbeddingsAsync(string, CancellationToken)
Asynchronously generates the embedding vector for a search query, applying any query-specific instruction the model supports.