DistributedCachingEmbeddingGenerator<TInput,TEmbedding> 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
代表一個委派嵌入產生器,快取嵌入產生呼叫的結果,並以 JSON 格式儲存在 IDistributedCache.
generic <typename TInput, typename TEmbedding>
where TEmbedding : Embeddingpublic ref class DistributedCachingEmbeddingGenerator : Microsoft::Extensions::AI::CachingEmbeddingGenerator<TInput, TEmbedding>
public class DistributedCachingEmbeddingGenerator<TInput,TEmbedding> : Microsoft.Extensions.AI.CachingEmbeddingGenerator<TInput,TEmbedding> where TEmbedding : Embedding
type DistributedCachingEmbeddingGenerator<'Input, 'Embedding (requires 'Embedding :> Embedding)> = class
inherit CachingEmbeddingGenerator<'Input, 'Embedding (requires 'Embedding :> Embedding)>
Public Class DistributedCachingEmbeddingGenerator(Of TInput, TEmbedding)
Inherits CachingEmbeddingGenerator(Of TInput, TEmbedding)
類型參數
- TInput
嵌入將從中產生的類型。
- TEmbedding
要產生的嵌入類型。
- 繼承
-
DistributedCachingEmbeddingGenerator<TInput,TEmbedding>
備註
所提供的實 IEmbeddingGenerator<TInput,TEmbedding> 作對並行使用是執行緒安全的,只要所用 IDistributedCache 的執行緒同樣適用於並行使用。
建構函式
| 名稱 | Description |
|---|---|
| DistributedCachingEmbeddingGenerator<TInput,TEmbedding>(IEmbeddingGenerator<TInput,TEmbedding>, IDistributedCache) |
初始化 DistributedCachingEmbeddingGenerator<TInput,TEmbedding> 類別的新執行個體。 |
屬性
| 名稱 | Description |
|---|---|
| CacheKeyAdditionalValues |
取得或設定額外值,用以通知用於儲存狀態的快取金鑰。 |
| InnerGenerator |
得到內層 IEmbeddingGenerator<TInput,TEmbedding>。 (繼承來源 DelegatingEmbeddingGenerator<TInput,TEmbedding>) |
| JsonSerializerOptions |
取得或設定 JSON 序列化選項,用於序列化快取資料。 |
方法
| 名稱 | Description |
|---|---|
| Dispose() |
執行與釋放、釋放或重設非受控資源相關聯的應用程式定義工作。 (繼承來源 DelegatingEmbeddingGenerator<TInput,TEmbedding>) |
| Dispose(Boolean) |
提供釋放 Unmanaged 資源的機制。 (繼承來源 DelegatingEmbeddingGenerator<TInput,TEmbedding>) |
| GenerateAsync(IEnumerable<TInput>, EmbeddingGenerationOptions, CancellationToken) |
代表一個委派嵌入產生器,快取嵌入產生呼叫的結果,並以 JSON 格式儲存在 IDistributedCache. (繼承來源 CachingEmbeddingGenerator<TInput,TEmbedding>) |
| GetCacheKey(ReadOnlySpan<Object>) |
計算指定值的快取鍵。 |
| GetService(Type, Object) |
請求 給 IEmbeddingGenerator<TInput,TEmbedding> 指定類型的 |
| ReadCacheAsync(String, CancellationToken) |
若有,則回傳先前快取的 Embedding<T>。 |
| WriteCacheAsync(String, TEmbedding, CancellationToken) |
將 a |
擴充方法
| 名稱 | Description |
|---|---|
| AsBuilder<TInput,TEmbedding>(IEmbeddingGenerator<TInput,TEmbedding>) |
創造一個新的 EmbeddingGeneratorBuilder<TInput,TEmbedding> 用途 |
| GenerateAndZipAsync<TInput,TEmbedding>(IEmbeddingGenerator<TInput,TEmbedding>, IEnumerable<TInput>, EmbeddingGenerationOptions, CancellationToken) |
為每個提供的 |
| GenerateAsync<TInput,TEmbedding>(IEmbeddingGenerator<TInput,TEmbedding>, TInput, EmbeddingGenerationOptions, CancellationToken) |
從指定的 |
| GetRequiredService(IEmbeddingGenerator, Type, Object) |
會要求 需要 IEmbeddingGenerator<TInput,TEmbedding> 指定類型的 |
| GetRequiredService<TService>(IEmbeddingGenerator, Object) |
會請求 一個 IEmbeddingGenerator<TInput,TEmbedding> 類型的 |
| GetService<TService>(IEmbeddingGenerator, Object) |
請求 一個 IEmbeddingGenerator<TInput,TEmbedding> 類型的 |