CachingEmbeddingGenerator<TInput,TEmbedding> Class

Definition

Represents a delegating embedding generator that caches the results of embedding generation calls.

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

Type Parameters

TInput

The type from which embeddings will be generated.

TEmbedding

The type of embeddings to generate.

Inheritance
CachingEmbeddingGenerator<TInput,TEmbedding>
Derived

Constructors

Properties

Methods

Dispose()

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

(Inherited from DelegatingEmbeddingGenerator<TInput,TEmbedding>)
Dispose(Boolean)

Provides a mechanism for releasing unmanaged resources.

(Inherited from DelegatingEmbeddingGenerator<TInput,TEmbedding>)
GenerateAsync(IEnumerable<TInput>, EmbeddingGenerationOptions, CancellationToken)
GetCacheKey(ReadOnlySpan<Object>)

Computes a cache key for the specified values.

GetService(Type, Object)

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

(Inherited from DelegatingEmbeddingGenerator<TInput,TEmbedding>)
ReadCacheAsync(String, CancellationToken)

Returns a previously cached Embedding<T>, if available.

WriteCacheAsync(String, TEmbedding, CancellationToken)

Stores a TEmbedding in the underlying cache.

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)