Table of Contents

Enum EmbeddingRole

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

Which side of a retrieval pair a text is being embedded as. Modern embedding models are trained asymmetrically: a query and the passage that answers it are prefixed differently, and the model only places them in one comparable representation space when each side gets its own prefix. Embedding a passage as if it were a query, or either side with no prefix at all, costs recall.

public enum EmbeddingRole

Fields

None = 0

A standalone text with no retrieval pairing: clustering, classification, deduplication, similarity between two texts of the same kind. No prefix is applied. This is the default, so existing behavior is unchanged for every caller that is not doing retrieval.

Query = 1

A search query. Applies the model's query prefix when it has one.

Document = 2

A document or passage being indexed for retrieval. Applies the model's passage prefix when it has one, and behaves like None for a model that prefixes queries only.

Remarks

Models differ in which sides carry a prefix. Some prefix queries only (Qwen3 Embedding, Nomic Embed, BGE v1.5), some prefix both (EmbeddingGemma), and some prefix neither (BGE-M3). The role says what the text IS; the model decides what that implies, so the same call is correct for every model and a role has no effect on a model that does not distinguish sides.

Share