EmbeddingGeneratorBuilder<TInput,TEmbedding> Class

Definition

A builder for creating pipelines of IEmbeddingGenerator<TInput,TEmbedding>.

generic <typename TInput, typename TEmbedding>
 where TEmbedding : Embeddingpublic ref class EmbeddingGeneratorBuilder sealed
public sealed class EmbeddingGeneratorBuilder<TInput,TEmbedding> where TEmbedding : Embedding
type EmbeddingGeneratorBuilder<'Input, 'Embedding (requires 'Embedding :> Embedding)> = class
Public NotInheritable Class EmbeddingGeneratorBuilder(Of TInput, TEmbedding)

Type Parameters

TInput

The type from which embeddings will be generated.

TEmbedding

The type of embeddings to generate.

Inheritance
EmbeddingGeneratorBuilder<TInput,TEmbedding>

Constructors

EmbeddingGeneratorBuilder<TInput,TEmbedding>(Func<IServiceProvider,IEmbeddingGenerator<TInput,TEmbedding>>)

Initializes a new instance of the EmbeddingGeneratorBuilder<TInput,TEmbedding> class.

EmbeddingGeneratorBuilder<TInput,TEmbedding>(IEmbeddingGenerator<TInput,TEmbedding>)

Initializes a new instance of the EmbeddingGeneratorBuilder<TInput,TEmbedding> class.

Methods

Build(IServiceProvider)

Builds an IEmbeddingGenerator<TInput,TEmbedding> that represents the entire pipeline. Calls to this instance will pass through each of the pipeline stages in turn.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)
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).

Extension Methods

ConfigureOptions<TInput,TEmbedding>(EmbeddingGeneratorBuilder<TInput,TEmbedding>, Action<EmbeddingGenerationOptions>)

Adds a callback that configures a EmbeddingGenerationOptions to be passed to the next client in the pipeline.

UseDistributedCache<TInput,TEmbedding>(EmbeddingGeneratorBuilder<TInput, TEmbedding>, IDistributedCache, Action<DistributedCachingEmbeddingGenerator<TInput, TEmbedding>>)

Adds a DistributedCachingEmbeddingGenerator<TInput,TEmbedding> as the next stage in the pipeline.

UseLogging<TInput,TEmbedding>(EmbeddingGeneratorBuilder<TInput,TEmbedding>, ILoggerFactory, Action<LoggingEmbeddingGenerator<TInput,TEmbedding>>)

Adds logging to the embedding generator pipeline.

UseOpenTelemetry<TInput,TEmbedding>(EmbeddingGeneratorBuilder<TInput, TEmbedding>, ILoggerFactory, String, Action<OpenTelemetryEmbeddingGenerator<TInput, TEmbedding>>)

Adds OpenTelemetry support to the embedding generator pipeline, following the OpenTelemetry Semantic Conventions for Generative AI systems.

Applies to