EmbeddingGeneratorBuilder<TInput,TEmbedding>.Use 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.
Overloads
Use(Func<IEmbeddingGenerator<TInput,TEmbedding>,IEmbeddingGenerator<TInput,TEmbedding>>) |
Adds a factory for an intermediate embedding generator to the embedding generator pipeline. |
Use(Func<IEmbeddingGenerator<TInput,TEmbedding>,IServiceProvider,IEmbeddingGenerator<TInput,TEmbedding>>) |
Adds a factory for an intermediate embedding generator to the embedding generator pipeline. |
Use(Func<IEnumerable<TInput>,EmbeddingGenerationOptions,IEmbeddingGenerator<TInput, TEmbedding>,CancellationToken,Task<GeneratedEmbeddings<TEmbedding>>>) |
Adds to the embedding generator pipeline an anonymous delegating embedding generator based on a delegate that provides an implementation for GenerateAsync(IEnumerable<TInput>, EmbeddingGenerationOptions, CancellationToken). |
Use(Func<IEmbeddingGenerator<TInput,TEmbedding>,IEmbeddingGenerator<TInput,TEmbedding>>)
- Source:
- EmbeddingGeneratorBuilder.cs
Adds a factory for an intermediate embedding generator to the embedding generator pipeline.
public:
Microsoft::Extensions::AI::EmbeddingGeneratorBuilder<TInput, TEmbedding> ^ Use(Func<Microsoft::Extensions::AI::IEmbeddingGenerator<TInput, TEmbedding> ^, Microsoft::Extensions::AI::IEmbeddingGenerator<TInput, TEmbedding> ^> ^ generatorFactory);
public Microsoft.Extensions.AI.EmbeddingGeneratorBuilder<TInput,TEmbedding> Use (Func<Microsoft.Extensions.AI.IEmbeddingGenerator<TInput,TEmbedding>,Microsoft.Extensions.AI.IEmbeddingGenerator<TInput,TEmbedding>> generatorFactory);
member this.Use : Func<Microsoft.Extensions.AI.IEmbeddingGenerator<'Input, 'Embedding>, Microsoft.Extensions.AI.IEmbeddingGenerator<'Input, 'Embedding>> -> Microsoft.Extensions.AI.EmbeddingGeneratorBuilder<'Input, 'Embedding (requires 'Embedding :> Microsoft.Extensions.AI.Embedding)>
Public Function Use (generatorFactory As Func(Of IEmbeddingGenerator(Of TInput, TEmbedding), IEmbeddingGenerator(Of TInput, TEmbedding))) As EmbeddingGeneratorBuilder(Of TInput, TEmbedding)
Parameters
- generatorFactory
- Func<IEmbeddingGenerator<TInput,TEmbedding>,IEmbeddingGenerator<TInput,TEmbedding>>
The generator factory function.
Returns
The updated EmbeddingGeneratorBuilder<TInput,TEmbedding> instance.
Applies to
Use(Func<IEmbeddingGenerator<TInput,TEmbedding>,IServiceProvider,IEmbeddingGenerator<TInput,TEmbedding>>)
- Source:
- EmbeddingGeneratorBuilder.cs
Adds a factory for an intermediate embedding generator to the embedding generator pipeline.
public:
Microsoft::Extensions::AI::EmbeddingGeneratorBuilder<TInput, TEmbedding> ^ Use(Func<Microsoft::Extensions::AI::IEmbeddingGenerator<TInput, TEmbedding> ^, IServiceProvider ^, Microsoft::Extensions::AI::IEmbeddingGenerator<TInput, TEmbedding> ^> ^ generatorFactory);
public Microsoft.Extensions.AI.EmbeddingGeneratorBuilder<TInput,TEmbedding> Use (Func<Microsoft.Extensions.AI.IEmbeddingGenerator<TInput,TEmbedding>,IServiceProvider,Microsoft.Extensions.AI.IEmbeddingGenerator<TInput,TEmbedding>> generatorFactory);
member this.Use : Func<Microsoft.Extensions.AI.IEmbeddingGenerator<'Input, 'Embedding>, IServiceProvider, Microsoft.Extensions.AI.IEmbeddingGenerator<'Input, 'Embedding>> -> Microsoft.Extensions.AI.EmbeddingGeneratorBuilder<'Input, 'Embedding (requires 'Embedding :> Microsoft.Extensions.AI.Embedding)>
Public Function Use (generatorFactory As Func(Of IEmbeddingGenerator(Of TInput, TEmbedding), IServiceProvider, IEmbeddingGenerator(Of TInput, TEmbedding))) As EmbeddingGeneratorBuilder(Of TInput, TEmbedding)
Parameters
- generatorFactory
- Func<IEmbeddingGenerator<TInput,TEmbedding>,IServiceProvider,IEmbeddingGenerator<TInput,TEmbedding>>
The generator factory function.
Returns
The updated EmbeddingGeneratorBuilder<TInput,TEmbedding> instance.
Applies to
Use(Func<IEnumerable<TInput>,EmbeddingGenerationOptions,IEmbeddingGenerator<TInput, TEmbedding>,CancellationToken,Task<GeneratedEmbeddings<TEmbedding>>>)
- Source:
- EmbeddingGeneratorBuilder.cs
Adds to the embedding generator pipeline an anonymous delegating embedding generator based on a delegate that provides an implementation for GenerateAsync(IEnumerable<TInput>, EmbeddingGenerationOptions, CancellationToken).
public:
Microsoft::Extensions::AI::EmbeddingGeneratorBuilder<TInput, TEmbedding> ^ Use(Func<System::Collections::Generic::IEnumerable<TInput> ^, Microsoft::Extensions::AI::EmbeddingGenerationOptions ^, Microsoft::Extensions::AI::IEmbeddingGenerator<TInput, TEmbedding> ^, System::Threading::CancellationToken, System::Threading::Tasks::Task<Microsoft::Extensions::AI::GeneratedEmbeddings<TEmbedding> ^> ^> ^ generateFunc);
public Microsoft.Extensions.AI.EmbeddingGeneratorBuilder<TInput,TEmbedding> Use (Func<System.Collections.Generic.IEnumerable<TInput>,Microsoft.Extensions.AI.EmbeddingGenerationOptions?,Microsoft.Extensions.AI.IEmbeddingGenerator<TInput,TEmbedding>,System.Threading.CancellationToken,System.Threading.Tasks.Task<Microsoft.Extensions.AI.GeneratedEmbeddings<TEmbedding>>>? generateFunc);
member this.Use : Func<seq<'Input>, Microsoft.Extensions.AI.EmbeddingGenerationOptions, Microsoft.Extensions.AI.IEmbeddingGenerator<'Input, 'Embedding>, System.Threading.CancellationToken, System.Threading.Tasks.Task<Microsoft.Extensions.AI.GeneratedEmbeddings<'Embedding>>> -> Microsoft.Extensions.AI.EmbeddingGeneratorBuilder<'Input, 'Embedding (requires 'Embedding :> Microsoft.Extensions.AI.Embedding)>
Public Function Use (generateFunc As Func(Of IEnumerable(Of TInput), EmbeddingGenerationOptions, IEmbeddingGenerator(Of TInput, TEmbedding), CancellationToken, Task(Of GeneratedEmbeddings(Of TEmbedding)))) As EmbeddingGeneratorBuilder(Of TInput, TEmbedding)
Parameters
- generateFunc
- Func<IEnumerable<TInput>,EmbeddingGenerationOptions,IEmbeddingGenerator<TInput,TEmbedding>,CancellationToken,Task<GeneratedEmbeddings<TEmbedding>>>
A delegate that provides the implementation for GenerateAsync(IEnumerable<TInput>, EmbeddingGenerationOptions, CancellationToken).
Returns
The updated EmbeddingGeneratorBuilder<TInput,TEmbedding> instance.
Exceptions
generateFunc
is null
.