EmbeddingGenerationExtensions.GenerateEmbeddingAsync<TValue,TEmbedding> Method

Definition

Generates an embedding from the given value.

public static System.Threading.Tasks.Task<ReadOnlyMemory<TEmbedding>> GenerateEmbeddingAsync<TValue,TEmbedding> (this Microsoft.SemanticKernel.Embeddings.IEmbeddingGenerationService<TValue,TEmbedding> generator, TValue value, Microsoft.SemanticKernel.Kernel? kernel = default, System.Threading.CancellationToken cancellationToken = default) where TEmbedding : struct;
static member GenerateEmbeddingAsync : Microsoft.SemanticKernel.Embeddings.IEmbeddingGenerationService<'Value, 'Embedding (requires 'Embedding : struct)> * 'Value * Microsoft.SemanticKernel.Kernel * System.Threading.CancellationToken -> System.Threading.Tasks.Task<ReadOnlyMemory<'Embedding>> (requires 'Embedding : struct)
<Extension()>
Public Function GenerateEmbeddingAsync(Of TValue, TEmbedding) (generator As IEmbeddingGenerationService(Of TValue, TEmbedding), value As TValue, Optional kernel As Kernel = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ReadOnlyMemory(Of TEmbedding))

Type Parameters

TValue

The type from which embeddings will be generated.

TEmbedding

The numeric type of the embedding data.

Parameters

generator
IEmbeddingGenerationService<TValue,TEmbedding>

The embedding generator.

value
TValue

A value from which an embedding will be generated.

kernel
Kernel

The Kernel containing services, plugins, and other state for use throughout the operation.

cancellationToken
CancellationToken

Cancellation token

Returns

Task<ReadOnlyMemory<TEmbedding>>

A list of embedding structs representing the input value.

Applies to