Method GetDocumentEmbeddingsAsync
- Namespace
- LMKit.Embeddings
- Assembly
- LM-Kit.NET.dll
GetDocumentEmbeddingsAsync(string, CancellationToken)
Asynchronously generates the embedding vector for one document/passage, applying the model's document instruction prefix when it declares one. For models without a document-side prefix this is identical to GetEmbeddingsAsync(string, CancellationToken).
public Task<float[]> GetDocumentEmbeddingsAsync(string text, CancellationToken cancellationToken = default)
Parameters
textstringThe document text to embed. Cannot be null or empty.
cancellationTokenCancellationTokenOptional. A CancellationToken for handling cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown when the input text is null or empty.
GetDocumentEmbeddingsAsync(IEnumerable<string>, CancellationToken)
Asynchronously generates embedding vectors for a batch of documents/passages, applying the model's document instruction prefix when it declares one.
public Task<float[][]> GetDocumentEmbeddingsAsync(IEnumerable<string> texts, CancellationToken cancellationToken = default)
Parameters
textsIEnumerable<string>The document texts to embed. Cannot be null or empty.
cancellationTokenCancellationTokenOptional. A CancellationToken for handling cancellation requests.
Returns
- Task<float[][]>
A task whose result is an array of vectors, one per input text and in the same order.
Exceptions
- ArgumentNullException
Thrown when the input is null or empty.