Dela via


DelegatingEmbeddingGenerator<TInput,TEmbedding> Class

Definition

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

generic <typename TInput, typename TEmbedding>
 where TEmbedding : Embeddingpublic ref class DelegatingEmbeddingGenerator : IDisposable, Microsoft::Extensions::AI::IEmbeddingGenerator<TInput, TEmbedding>
public class DelegatingEmbeddingGenerator<TInput,TEmbedding> : IDisposable, Microsoft.Extensions.AI.IEmbeddingGenerator<TInput,TEmbedding> where TEmbedding : Embedding
type DelegatingEmbeddingGenerator<'Input, 'Embedding (requires 'Embedding :> Embedding)> = class
    interface IEmbeddingGenerator<'Input, 'Embedding (requires 'Embedding :> Embedding)>
    interface IDisposable
Public Class DelegatingEmbeddingGenerator(Of TInput, TEmbedding)
Implements IDisposable, IEmbeddingGenerator(Of TInput, TEmbedding)

Type Parameters

TInput

Specifies the type of the input passed to the generator.

TEmbedding

Specifies the type of the embedding instance produced by the generator.

Inheritance
DelegatingEmbeddingGenerator<TInput,TEmbedding>
Derived
Implements

Remarks

This 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

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

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

Properties

InnerGenerator

Gets the inner IEmbeddingGenerator<TInput,TEmbedding>.

Metadata

Gets metadata that describes the IEmbeddingGenerator<TInput,TEmbedding>.

Methods

Dispose()

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

Dispose(Boolean)

Provides a mechanism for releasing unmanaged resources.

Equals(Object)

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

(Inherited from Object)
GenerateAsync(IEnumerable<TInput>, EmbeddingGenerationOptions, CancellationToken)

Generates embeddings for each of the supplied values.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetService<TService>(Object)

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

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)

Extension Methods

GenerateAndZipAsync<TInput,TEmbedding>(IEmbeddingGenerator<TInput,TEmbedding>, IEnumerable<TInput>, EmbeddingGenerationOptions, CancellationToken)

Generates embeddings for each of the supplied values and produces a list that pairs each input value with its resulting embedding.

GenerateEmbeddingAsync<TInput,TEmbedding>(IEmbeddingGenerator<TInput,TEmbedding>, TInput, EmbeddingGenerationOptions, CancellationToken)

Generates an embedding from the specified value.

Applies to