EmbeddingGeneratorExtensions.GenerateEmbeddingVectorAsync<TInput,TEmbeddingElement> Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Generates an embedding vector from the specified value
.
public static System.Threading.Tasks.Task<ReadOnlyMemory<TEmbeddingElement>> GenerateEmbeddingVectorAsync<TInput,TEmbeddingElement>(this Microsoft.Extensions.AI.IEmbeddingGenerator<TInput,Microsoft.Extensions.AI.Embedding<TEmbeddingElement>> generator, TInput value, Microsoft.Extensions.AI.EmbeddingGenerationOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
static member GenerateEmbeddingVectorAsync : Microsoft.Extensions.AI.IEmbeddingGenerator<'Input, Microsoft.Extensions.AI.Embedding<'EmbeddingElement>> * 'Input * Microsoft.Extensions.AI.EmbeddingGenerationOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<ReadOnlyMemory<'EmbeddingElement>>
<Extension()>
Public Function GenerateEmbeddingVectorAsync(Of TInput, TEmbeddingElement) (generator As IEmbeddingGenerator(Of TInput, Embedding(Of TEmbeddingElement)), value As TInput, Optional options As EmbeddingGenerationOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ReadOnlyMemory(Of TEmbeddingElement))
- TInput
The type from which embeddings will be generated.
- TEmbeddingElement
The numeric type of the embedding data.
- generator
- IEmbeddingGenerator<TInput,Embedding<TEmbeddingElement>>
The embedding generator.
- value
- TInput
A value from which an embedding will be generated.
- options
- EmbeddingGenerationOptions
The embedding generation options to configure the request.
- cancellationToken
- CancellationToken
The CancellationToken to monitor for cancellation requests. The default is None.
The generated embedding for the specified value
.
This operation is equivalent to using GenerateEmbeddingAsync<TInput,TEmbedding>(IEmbeddingGenerator<TInput,TEmbedding>, TInput, EmbeddingGenerationOptions, CancellationToken) and returning the resulting Embedding<T>'s Vector property.
Product | Versions |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided) |
.NET Standard | 2.0 (package-provided) |
.NET feedback
.NET is an open source project. Select a link to provide feedback: