DelegatingEmbeddingGenerator<TInput,TEmbedding> Class

Definition

Provides an optional base class for an IEmbeddingGenerator<TInput,TEmbedding> that passes through calls to another instance.

C#
public class DelegatingEmbeddingGenerator<TInput,TEmbedding> : IDisposable, Microsoft.Extensions.AI.IEmbeddingGenerator<TInput,TEmbedding> where TEmbedding : Embedding

Type Parameters

TInput

The type of the input passed to the generator.

TEmbedding

The type of the embedding instance produced by the generator.

Inheritance
DelegatingEmbeddingGenerator<TInput,TEmbedding>
Derived
Implements

Remarks

This type is recommended as a base type when building generators that can be chained in any order around an underlying IEmbeddingGenerator<TInput,TEmbedding>. The default implementation simply passes each call to the inner generator instance.

Constructors

Properties

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Dispose(Boolean)

Provides a mechanism for releasing unmanaged resources.

GenerateAsync(IEnumerable<TInput>, EmbeddingGenerationOptions, CancellationToken)

Generates embeddings for each of the supplied values.

GetService(Type, Object)

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

Extension Methods

Applies to

Product Versions
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)