Прочитать на английском

Поделиться через


DelegatingEmbeddingGenerator<TInput,TEmbedding> Class

Definition

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

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 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

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

Creates a new EmbeddingGeneratorBuilder<TInput,TEmbedding> using innerGenerator as its inner generator.

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.

GetRequiredService(IEmbeddingGenerator, Type, Object)

Asks the IEmbeddingGenerator<TInput,TEmbedding> for an object of the specified type serviceType and throws an exception if one isn't available.

GetRequiredService<TService>(IEmbeddingGenerator, Object)

Asks the IEmbeddingGenerator<TInput,TEmbedding> for an object of type TService and throws an exception if one isn't available.

GetService<TService>(IEmbeddingGenerator, Object)

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

Applies to

Продукт Версии
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided)