DistributedCachingChatClient Class
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.
A delegating chat client that caches the results of response calls, storing them as JSON in an IDistributedCache.
public ref class DistributedCachingChatClient : Microsoft::Extensions::AI::CachingChatClient
public class DistributedCachingChatClient : Microsoft.Extensions.AI.CachingChatClient
type DistributedCachingChatClient = class
inherit CachingChatClient
Public Class DistributedCachingChatClient
Inherits CachingChatClient
- Inheritance
Remarks
The DistributedCachingChatClient employs JSON serialization as part of storing cached data. It is not guaranteed that the object models used by ChatMessage, ChatOptions, ChatResponse, ChatResponseUpdate, or any of the other objects in the chat client pipeline will roundtrip through JSON serialization with full fidelity. For example, RawRepresentation will be ignored, and Object values in AdditionalProperties will deserialize as JsonElement rather than as the original type. In general, code using DistributedCachingChatClient should only rely on accessing data that can be preserved well enough through JSON serialization and deserialization.
The provided implementation of IChatClient is thread-safe for concurrent use so long as the employed IDistributedCache is similarly thread-safe for concurrent use.
Constructors
DistributedCachingChatClient(IChatClient, IDistributedCache) |
Initializes a new instance of the DistributedCachingChatClient class. |
Properties
CoalesceStreamingUpdates |
Gets or sets a value indicating whether streaming updates are coalesced. (Inherited from CachingChatClient) |
InnerClient |
Gets the inner IChatClient. (Inherited from DelegatingChatClient) |
JsonSerializerOptions |
Gets or sets JSON serialization options to use when serializing cache data. |