Table of Contents

Method GetDocumentEmbeddingsAsync

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

GetDocumentEmbeddingsAsync(string, CancellationToken)

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

public virtual Task<float[]> GetDocumentEmbeddingsAsync(string text, CancellationToken cancellationToken = default)

Parameters

text string

The document text to embed. Cannot be null or empty.

cancellationToken CancellationToken

Optional token to cancel the operation.

Returns

Task<float[]>

A task whose result is the document embedding vector.

Remarks

The default implementation reuses the plain path. Override it when the provider applies a distinct document instruction or input type.

GetDocumentEmbeddingsAsync(IEnumerable<string>, CancellationToken)

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

public virtual Task<float[][]> GetDocumentEmbeddingsAsync(IEnumerable<string> texts, CancellationToken cancellationToken = default)

Parameters

texts IEnumerable<string>

The document texts to embed. Cannot be null or empty.

cancellationToken CancellationToken

Optional token to cancel the operation.

Returns

Task<float[][]>

A task whose result is an array of vectors, one per input text and in the same order.

Remarks

The default implementation reuses the plain path. Override it when the provider applies a distinct document instruction or input type.

Share