EmbeddingGenerationExtensions.AsEmbeddingGenerator<TValue,TEmbedding> Method
Definition
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.
Creates an IEmbeddingGenerator<TInput,TEmbedding> for the specified IEmbeddingGenerationService<TValue,TEmbedding>.
public static Microsoft.Extensions.AI.IEmbeddingGenerator<TValue,Microsoft.Extensions.AI.Embedding<TEmbedding>> AsEmbeddingGenerator<TValue,TEmbedding>(this Microsoft.SemanticKernel.Embeddings.IEmbeddingGenerationService<TValue,TEmbedding> service) where TEmbedding : struct;
static member AsEmbeddingGenerator : Microsoft.SemanticKernel.Embeddings.IEmbeddingGenerationService<'Value, 'Embedding (requires 'Embedding : struct)> -> Microsoft.Extensions.AI.IEmbeddingGenerator<'Value, Microsoft.Extensions.AI.Embedding<'Embedding>> (requires 'Embedding : struct)
<Extension()>
Public Function AsEmbeddingGenerator(Of TValue, TEmbedding) (service As IEmbeddingGenerationService(Of TValue, TEmbedding)) As IEmbeddingGenerator(Of TValue, Embedding(Of TEmbedding))
Type Parameters
- TValue
- TEmbedding
Parameters
The embedding generation service to be represented as an embedding generator.
Returns
The IEmbeddingGenerator<TInput,TEmbedding>. If the service is an IEmbeddingGenerator<TInput,TEmbedding>,
the service will be returned. Otherwise, a new IEmbeddingGenerator<TInput,TEmbedding> will be created that wraps the service.