Share via


EmbeddingGeneratorBuilderServiceCollectionExtensions.AddEmbeddingGenerator Method

Definition

Overloads

AddEmbeddingGenerator<TInput,TEmbedding>(IServiceCollection, IEmbeddingGenerator<TInput,TEmbedding>)

Registers a singleton embedding generator in the IServiceCollection.

AddEmbeddingGenerator<TInput,TEmbedding>(IServiceCollection, Func<IServiceProvider,IEmbeddingGenerator<TInput,TEmbedding>>)

Registers a singleton embedding generator in the IServiceCollection.

AddEmbeddingGenerator<TInput,TEmbedding>(IServiceCollection, IEmbeddingGenerator<TInput,TEmbedding>)

Source:
EmbeddingGeneratorBuilderServiceCollectionExtensions.cs

Registers a 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> ^ AddEmbeddingGenerator(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ serviceCollection, Microsoft::Extensions::AI::IEmbeddingGenerator<TInput, TEmbedding> ^ innerGenerator);
public static Microsoft.Extensions.AI.EmbeddingGeneratorBuilder<TInput,TEmbedding> AddEmbeddingGenerator<TInput,TEmbedding> (this Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection, Microsoft.Extensions.AI.IEmbeddingGenerator<TInput,TEmbedding> innerGenerator) where TEmbedding : Microsoft.Extensions.AI.Embedding;
static member AddEmbeddingGenerator : Microsoft.Extensions.DependencyInjection.IServiceCollection * 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 AddEmbeddingGenerator(Of TInput, TEmbedding) (serviceCollection As IServiceCollection, 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.

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

AddEmbeddingGenerator<TInput,TEmbedding>(IServiceCollection, Func<IServiceProvider,IEmbeddingGenerator<TInput,TEmbedding>>)

Source:
EmbeddingGeneratorBuilderServiceCollectionExtensions.cs

Registers a 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> ^ AddEmbeddingGenerator(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ serviceCollection, Func<IServiceProvider ^, Microsoft::Extensions::AI::IEmbeddingGenerator<TInput, TEmbedding> ^> ^ innerGeneratorFactory);
public static Microsoft.Extensions.AI.EmbeddingGeneratorBuilder<TInput,TEmbedding> AddEmbeddingGenerator<TInput,TEmbedding> (this Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection, Func<IServiceProvider,Microsoft.Extensions.AI.IEmbeddingGenerator<TInput,TEmbedding>> innerGeneratorFactory) where TEmbedding : Microsoft.Extensions.AI.Embedding;
static member AddEmbeddingGenerator : Microsoft.Extensions.DependencyInjection.IServiceCollection * 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 AddEmbeddingGenerator(Of TInput, TEmbedding) (serviceCollection As IServiceCollection, 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.

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