Table of Contents

Method GetQueryEmbeddings

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

GetQueryEmbeddings(string, CancellationToken)

Generates the embedding vector for a query string, applying the model's query instruction prefix when available. Use this for search/retrieval queries to improve recall with models that support asymmetric query/passage embedding (e.g., Qwen3 Embedding, Nomic Embed, BGE v1.5). For passage/document embedding, use GetEmbeddings(string, CancellationToken) instead.

public float[] GetQueryEmbeddings(string text, CancellationToken cancellationToken = default)

Parameters

text string

The query text to be converted into an embedding vector. Cannot be null or empty.

cancellationToken CancellationToken

Optional. A CancellationToken for handling cancellation requests.

Returns

float[]

An array of floats representing the embedding vector of the query text.

Remarks

The dimension of the array is specified by the EmbeddingSize property.

Exceptions

ArgumentNullException

Thrown when the input text is null or empty.

Share