Jaa


CachingChatClient Class

Definition

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 to coalesce streaming updates.

InnerClient

Gets the inner IChatClient.

(Inherited from DelegatingChatClient)
Metadata

Gets metadata that describes the IChatClient.

(Inherited from DelegatingChatClient)

Methods

CompleteAsync(IList<ChatMessage>, ChatOptions, CancellationToken)
CompleteStreamingAsync(IList<ChatMessage>, ChatOptions, CancellationToken)
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)
Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetCacheKey(Boolean, IList<ChatMessage>, ChatOptions)

Computes a cache key for the specified call parameters.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetService<TService>(Object)

Asks the IChatClient for an object of type TService.

(Inherited from DelegatingChatClient)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ReadCacheAsync(String, CancellationToken)

Returns a previously cached ChatCompletion, if available. This is used when there is a call to CompleteAsync(IList<ChatMessage>, ChatOptions, CancellationToken).

ReadCacheStreamingAsync(String, CancellationToken)

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

ToString()

Returns a string that represents the current object.

(Inherited from Object)
WriteCacheAsync(String, ChatCompletion, CancellationToken)

Stores a ChatCompletion in the underlying cache. This is used when there is a call to CompleteAsync(IList<ChatMessage>, ChatOptions, CancellationToken).

WriteCacheStreamingAsync(String, IReadOnlyList<StreamingChatCompletionUpdate>, CancellationToken)

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

Extension Methods

CompleteAsync(IChatClient, String, ChatOptions, CancellationToken)

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

CompleteStreamingAsync(IChatClient, String, ChatOptions, CancellationToken)

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

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

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

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

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

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

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

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

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

Applies to