Compartilhar via


EmbeddingGeneratorBuilderServiceCollectionExtensions.AddKeyedEmbeddingGenerator Method

Definition

Overloads

AddKeyedEmbeddingGenerator<TInput,TEmbedding>(IServiceCollection, Object, IEmbeddingGenerator<TInput,TEmbedding>)

Registers a keyed singleton embedding generator in the IServiceCollection.

AddKeyedEmbeddingGenerator<TInput,TEmbedding>(IServiceCollection, Object, Func<IServiceProvider,IEmbeddingGenerator<TInput,TEmbedding>>)

Registers a keyed singleton embedding generator in the IServiceCollection.

AddKeyedEmbeddingGenerator<TInput,TEmbedding>(IServiceCollection, Object, IEmbeddingGenerator<TInput,TEmbedding>)

Source:
EmbeddingGeneratorBuilderServiceCollectionExtensions.cs

Registers a keyed singleton embedding generator in the IServiceCollection.

public:
generic <typename TInput, typename TEmbedding>
 where TEmbedding : Microsoft::Extensions::AI::Embedding[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::AI::EmbeddingGeneratorBuilder<TInput, TEmbedding> ^ AddKeyedEmbeddingGenerator(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ serviceCollection, System::Object ^ serviceKey, Microsoft::Extensions::AI::IEmbeddingGenerator<TInput, TEmbedding> ^ innerGenerator);
public static Microsoft.Extensions.AI.EmbeddingGeneratorBuilder<TInput,TEmbedding> AddKeyedEmbeddingGenerator<TInput,TEmbedding> (this Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection, object serviceKey, Microsoft.Extensions.AI.IEmbeddingGenerator<TInput,TEmbedding> innerGenerator) where TEmbedding : Microsoft.Extensions.AI.Embedding;
static member AddKeyedEmbeddingGenerator : Microsoft.Extensions.DependencyInjection.IServiceCollection * obj * Microsoft.Extensions.AI.IEmbeddingGenerator<'Input, 'Embedding (requires 'Embedding :> Microsoft.Extensions.AI.Embedding)> -> Microsoft.Extensions.AI.EmbeddingGeneratorBuilder<'Input, 'Embedding (requires 'Embedding :> Microsoft.Extensions.AI.Embedding)> (requires 'Embedding :> Microsoft.Extensions.AI.Embedding)
<Extension()>
Public Function AddKeyedEmbeddingGenerator(Of TInput, TEmbedding) (serviceCollection As IServiceCollection, serviceKey As Object, innerGenerator As IEmbeddingGenerator(Of TInput, TEmbedding)) As EmbeddingGeneratorBuilder(Of TInput, TEmbedding)

Type Parameters

TInput

The type from which embeddings will be generated.

TEmbedding

The type of embeddings to generate.

Parameters

serviceCollection
IServiceCollection

The IServiceCollection to which the generator should be added.

serviceKey
Object

The key with which to associated the generator.

innerGenerator
IEmbeddingGenerator<TInput,TEmbedding>

The inner IEmbeddingGenerator<TInput,TEmbedding> that represents the underlying backend.

Returns

An EmbeddingGeneratorBuilder<TInput,TEmbedding> that can be used to build a pipeline around the inner generator.

Remarks

The generator is registered as a singleton service.

Applies to

AddKeyedEmbeddingGenerator<TInput,TEmbedding>(IServiceCollection, Object, Func<IServiceProvider,IEmbeddingGenerator<TInput,TEmbedding>>)

Source:
EmbeddingGeneratorBuilderServiceCollectionExtensions.cs

Registers a keyed singleton embedding generator in the IServiceCollection.

public:
generic <typename TInput, typename TEmbedding>
 where TEmbedding : Microsoft::Extensions::AI::Embedding[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::AI::EmbeddingGeneratorBuilder<TInput, TEmbedding> ^ AddKeyedEmbeddingGenerator(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ serviceCollection, System::Object ^ serviceKey, Func<IServiceProvider ^, Microsoft::Extensions::AI::IEmbeddingGenerator<TInput, TEmbedding> ^> ^ innerGeneratorFactory);
public static Microsoft.Extensions.AI.EmbeddingGeneratorBuilder<TInput,TEmbedding> AddKeyedEmbeddingGenerator<TInput,TEmbedding> (this Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection, object serviceKey, Func<IServiceProvider,Microsoft.Extensions.AI.IEmbeddingGenerator<TInput,TEmbedding>> innerGeneratorFactory) where TEmbedding : Microsoft.Extensions.AI.Embedding;
static member AddKeyedEmbeddingGenerator : Microsoft.Extensions.DependencyInjection.IServiceCollection * obj * Func<IServiceProvider, Microsoft.Extensions.AI.IEmbeddingGenerator<'Input, 'Embedding>> -> Microsoft.Extensions.AI.EmbeddingGeneratorBuilder<'Input, 'Embedding (requires 'Embedding :> Microsoft.Extensions.AI.Embedding)> (requires 'Embedding :> Microsoft.Extensions.AI.Embedding)
<Extension()>
Public Function AddKeyedEmbeddingGenerator(Of TInput, TEmbedding) (serviceCollection As IServiceCollection, serviceKey As Object, innerGeneratorFactory As Func(Of IServiceProvider, IEmbeddingGenerator(Of TInput, TEmbedding))) As EmbeddingGeneratorBuilder(Of TInput, TEmbedding)

Type Parameters

TInput

The type from which embeddings will be generated.

TEmbedding

The type of embeddings to generate.

Parameters

serviceCollection
IServiceCollection

The IServiceCollection to which the generator should be added.

serviceKey
Object

The key with which to associated the generator.

innerGeneratorFactory
Func<IServiceProvider,IEmbeddingGenerator<TInput,TEmbedding>>

A callback that produces the inner IEmbeddingGenerator<TInput,TEmbedding> that represents the underlying backend.

Returns

An EmbeddingGeneratorBuilder<TInput,TEmbedding> that can be used to build a pipeline around the inner generator.

Remarks

The generator is registered as a singleton service.

Applies to