DistributedCachingEmbeddingGeneratorBuilderExtensions.UseDistributedCache<TInput,TEmbedding> Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Adds a DistributedCachingEmbeddingGenerator<TInput,TEmbedding> as the next stage in the pipeline.
public static Microsoft.Extensions.AI.EmbeddingGeneratorBuilder<TInput,TEmbedding> UseDistributedCache<TInput,TEmbedding> (this Microsoft.Extensions.AI.EmbeddingGeneratorBuilder<TInput,TEmbedding> builder, Microsoft.Extensions.Caching.Distributed.IDistributedCache? storage = default, Action<Microsoft.Extensions.AI.DistributedCachingEmbeddingGenerator<TInput,TEmbedding>>? configure = default) where TEmbedding : Microsoft.Extensions.AI.Embedding;
static member UseDistributedCache : Microsoft.Extensions.AI.EmbeddingGeneratorBuilder<'Input, 'Embedding (requires 'Embedding :> Microsoft.Extensions.AI.Embedding)> * Microsoft.Extensions.Caching.Distributed.IDistributedCache * Action<Microsoft.Extensions.AI.DistributedCachingEmbeddingGenerator<'Input, 'Embedding>> -> Microsoft.Extensions.AI.EmbeddingGeneratorBuilder<'Input, 'Embedding (requires 'Embedding :> Microsoft.Extensions.AI.Embedding)> (requires 'Embedding :> Microsoft.Extensions.AI.Embedding)
<Extension()>
Public Function UseDistributedCache(Of TInput, TEmbedding) (builder As EmbeddingGeneratorBuilder(Of TInput, TEmbedding), Optional storage As IDistributedCache = Nothing, Optional configure As Action(Of DistributedCachingEmbeddingGenerator(Of TInput, TEmbedding)) = Nothing) As EmbeddingGeneratorBuilder(Of TInput, TEmbedding)
Type Parameters
- TInput
The type from which embeddings will be generated.
- TEmbedding
The type of embeddings to generate.
Parameters
- storage
- IDistributedCache
An optional IDistributedCache instance that will be used as the backing store for the cache. If not supplied, an instance will be resolved from the service provider.
- configure
- Action<DistributedCachingEmbeddingGenerator<TInput,TEmbedding>>
An optional callback that can be used to configure the DistributedCachingEmbeddingGenerator<TInput,TEmbedding> instance.
Returns
The EmbeddingGeneratorBuilder<TInput,TEmbedding> provided as builder
.