CachingChatClient.EnableCaching 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.
Determines whether caching should be used with the specified request.
protected:
virtual bool EnableCaching(System::Collections::Generic::IEnumerable<Microsoft::Extensions::AI::ChatMessage ^> ^ messages, Microsoft::Extensions::AI::ChatOptions ^ options);
protected virtual bool EnableCaching(System.Collections.Generic.IEnumerable<Microsoft.Extensions.AI.ChatMessage> messages, Microsoft.Extensions.AI.ChatOptions? options);
abstract member EnableCaching : seq<Microsoft.Extensions.AI.ChatMessage> * Microsoft.Extensions.AI.ChatOptions -> bool
override this.EnableCaching : seq<Microsoft.Extensions.AI.ChatMessage> * Microsoft.Extensions.AI.ChatOptions -> bool
Protected Overridable Function EnableCaching (messages As IEnumerable(Of ChatMessage), options As ChatOptions) As Boolean
Parameters
- messages
- IEnumerable<ChatMessage>
The sequence of chat messages included in the request.
- options
- ChatOptions
The chat options included in the request.
Returns
true
if caching should be used for the request, such that the CachingChatClient
will try to satisfy the request from the cache, or if it can't, will try to cache the fetched response.
false
if caching should not be used for the request, such that the request will
be passed through to the inner IChatClient without attempting to read from or write to the cache.
Remarks
The default implementation returns true
as long as the options
does not have a ConversationId set.