Table of Contents

Interface IEmbedder

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

Provider-agnostic contract for turning text into embedding vectors.

public interface IEmbedder

Remarks

This is the minimal surface every embedding provider must expose, whether it runs a local model (see Embedder) or calls a remote service (for example AWS Bedrock, Azure OpenAI, or an in-house HTTP endpoint). Components that consume embeddings (RAG, semantic partitioning, classification, reranking) depend on this interface rather than on a concrete model type, so any provider can be plugged in.

To implement a custom provider with the least effort, derive from EmbedderBase and override the single batch method; the single-text overload and the synchronous wrappers are supplied for you. Implement this interface directly only when you need full control over every member.

Richer capabilities are exposed through optional companion interfaces that a provider may also implement: IQueryEmbedder (asymmetric query embedding), IImageEmbedder (image and multimodal embedding), and ITokenizingEmbedder (pre-tokenized input and token-count aware batching, typically a local-only optimization). Consumers feature-detect these with a type check.

Properties

EmbeddingSize

Gets the dimension of the vectors this embedder produces.

ModelId

Gets a stable identifier for the underlying model or deployment.

Methods

GetEmbeddingsAsync(IEnumerable<string>, CancellationToken)

Asynchronously generates embedding vectors for a batch of texts.

GetEmbeddingsAsync(string, CancellationToken)

Asynchronously generates the embedding vector for a single text.

Share