Freigeben über


EmbeddingGeneratorExtensions.GetService Method

Definition

Overloads

GetService<TInput,TEmbedding,TService>(IEmbeddingGenerator<TInput,TEmbedding>, Object)

Asks the IEmbeddingGenerator<TInput,TEmbedding> for an object of type TService.

GetService<TService>(IEmbeddingGenerator<String,Embedding<Single>>, Object)

Asks the IEmbeddingGenerator<TInput,TEmbedding> for an object of type TService.

GetService<TInput,TEmbedding,TService>(IEmbeddingGenerator<TInput,TEmbedding>, Object)

Source:
EmbeddingGeneratorExtensions.cs

Asks the IEmbeddingGenerator<TInput,TEmbedding> for an object of type TService.

public static TService? GetService<TInput,TEmbedding,TService> (this Microsoft.Extensions.AI.IEmbeddingGenerator<TInput,TEmbedding> generator, object? serviceKey = default) where TEmbedding : Microsoft.Extensions.AI.Embedding;
static member GetService : Microsoft.Extensions.AI.IEmbeddingGenerator<'Input, 'Embedding (requires 'Embedding :> Microsoft.Extensions.AI.Embedding)> * obj -> 'Service (requires 'Embedding :> Microsoft.Extensions.AI.Embedding)
<Extension()>
Public Function GetService(Of TInput, TEmbedding, TService) (generator As IEmbeddingGenerator(Of TInput, TEmbedding), Optional serviceKey As Object = Nothing) As TService

Type Parameters

TInput

The type from which embeddings will be generated.

TEmbedding

The numeric type of the embedding data.

TService

The type of the object to be retrieved.

Parameters

generator
IEmbeddingGenerator<TInput,TEmbedding>

The generator.

serviceKey
Object

An optional key that can be used to help identify the target service.

Returns

TService

The found object, otherwise null.

Remarks

The purpose of this method is to allow for the retrieval of strongly typed services that may be provided by the IEmbeddingGenerator<TInput,TEmbedding>, including itself or any services it might be wrapping.

Applies to

GetService<TService>(IEmbeddingGenerator<String,Embedding<Single>>, Object)

Source:
EmbeddingGeneratorExtensions.cs

Asks the IEmbeddingGenerator<TInput,TEmbedding> for an object of type TService.

public static TService? GetService<TService> (this Microsoft.Extensions.AI.IEmbeddingGenerator<string,Microsoft.Extensions.AI.Embedding<float>> generator, object? serviceKey = default);
static member GetService : Microsoft.Extensions.AI.IEmbeddingGenerator<string, Microsoft.Extensions.AI.Embedding<single>> * obj -> 'Service
<Extension()>
Public Function GetService(Of TService) (generator As IEmbeddingGenerator(Of String, Embedding(Of Single)), Optional serviceKey As Object = Nothing) As TService

Type Parameters

TService

The type of the object to be retrieved.

Parameters

generator
IEmbeddingGenerator<String,Embedding<Single>>

The generator.

serviceKey
Object

An optional key that can be used to help identify the target service.

Returns

TService

The found object, otherwise null.

Remarks

The purpose of this method is to allow for the retrieval of strongly typed services that may be provided by the IEmbeddingGenerator<TInput,TEmbedding>, including itself or any services it might be wrapping.

Applies to