Jaa


CachingChatClient Class

Definition

Represents a delegating chat client that caches the results of chat calls.

public ref class CachingChatClient abstract : Microsoft::Extensions::AI::DelegatingChatClient
public abstract class CachingChatClient : Microsoft.Extensions.AI.DelegatingChatClient
type CachingChatClient = class
    inherit DelegatingChatClient
Public MustInherit Class CachingChatClient
Inherits DelegatingChatClient
Inheritance
CachingChatClient
Derived

Constructors

CachingChatClient(IChatClient)

Initializes a new instance of the CachingChatClient class.

Properties

CoalesceStreamingUpdates

Gets or sets a value indicating whether streaming updates are coalesced.

InnerClient

Gets the inner IChatClient.

(Inherited from DelegatingChatClient)

Methods

Dispose()

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

(Inherited from DelegatingChatClient)
Dispose(Boolean)

Provides a mechanism for releasing unmanaged resources.

(Inherited from DelegatingChatClient)
GetCacheKey(ReadOnlySpan<Object>)

Computes a cache key for the specified values.

GetResponseAsync(IEnumerable<ChatMessage>, ChatOptions, CancellationToken)
GetService(Type, Object)

Asks the IChatClient for an object of the specified type serviceType.

(Inherited from DelegatingChatClient)
GetStreamingResponseAsync(IEnumerable<ChatMessage>, ChatOptions, CancellationToken)
ReadCacheAsync(String, CancellationToken)

Returns a previously cached ChatResponse, if available. This is used when there is a call to GetResponseAsync(IEnumerable<ChatMessage>, ChatOptions, CancellationToken).

ReadCacheStreamingAsync(String, CancellationToken)

Returns a previously cached list of ChatResponseUpdate values, if available. This is used when there is a call to GetStreamingResponseAsync(IEnumerable<ChatMessage>, ChatOptions, CancellationToken).

WriteCacheAsync(String, ChatResponse, CancellationToken)

Stores a ChatResponse in the underlying cache. This is used when there is a call to GetResponseAsync(IEnumerable<ChatMessage>, ChatOptions, CancellationToken).

WriteCacheStreamingAsync(String, IReadOnlyList<ChatResponseUpdate>, CancellationToken)

Stores a list of ChatResponseUpdate values in the underlying cache. This is used when there is a call to GetStreamingResponseAsync(IEnumerable<ChatMessage>, ChatOptions, CancellationToken).

Extension Methods

AsBuilder(IChatClient)

Creates a new ChatClientBuilder using innerClient as its inner client.

GetRequiredService(IChatClient, Type, Object)

Asks the IChatClient for an object of the specified type serviceType and throws an exception if one isn't available.

GetRequiredService<TService>(IChatClient, Object)

Asks the IChatClient for an object of type TService and throws an exception if one isn't available.

GetResponseAsync(IChatClient, ChatMessage, ChatOptions, CancellationToken)

Sends a chat message and returns the response messages.

GetResponseAsync(IChatClient, String, ChatOptions, CancellationToken)

Sends a user chat text message and returns the response messages.

GetService<TService>(IChatClient, Object)

Asks the IChatClient for an object of type TService.

GetStreamingResponseAsync(IChatClient, ChatMessage, ChatOptions, CancellationToken)

Sends a chat message and streams the response messages.

GetStreamingResponseAsync(IChatClient, String, ChatOptions, CancellationToken)

Sends a user chat text message and streams the response messages.

GetResponseAsync<T>(IChatClient, ChatMessage, ChatOptions, Nullable<Boolean>, CancellationToken)

Sends a chat message, requesting a response matching the type T.

GetResponseAsync<T>(IChatClient, ChatMessage, JsonSerializerOptions, ChatOptions, Nullable<Boolean>, CancellationToken)

Sends a chat message, requesting a response matching the type T.

GetResponseAsync<T>(IChatClient, IEnumerable<ChatMessage>, ChatOptions, Nullable<Boolean>, CancellationToken)

Sends chat messages, requesting a response matching the type T.

GetResponseAsync<T>(IChatClient, IEnumerable<ChatMessage>, JsonSerializerOptions, ChatOptions, Nullable<Boolean>, CancellationToken)

Sends chat messages, requesting a response matching the type T.

GetResponseAsync<T>(IChatClient, String, ChatOptions, Nullable<Boolean>, CancellationToken)

Sends a user chat text message, requesting a response matching the type T.

GetResponseAsync<T>(IChatClient, String, JsonSerializerOptions, ChatOptions, Nullable<Boolean>, CancellationToken)

Sends a user chat text message, requesting a response matching the type T.

Applies to