LoggingChatClient 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 logs chat operations to an ILogger.
public ref class LoggingChatClient : Microsoft::Extensions::AI::DelegatingChatClient
public class LoggingChatClient : Microsoft.Extensions.AI.DelegatingChatClient
type LoggingChatClient = class
inherit DelegatingChatClient
Public Class LoggingChatClient
Inherits DelegatingChatClient
- Inheritance
Remarks
The provided implementation of IChatClient is thread-safe for concurrent use so long as the ILogger employed is also thread-safe for concurrent use.
When the employed ILogger enables Trace, the contents of chat messages and options are logged. These messages and options may contain sensitive application data. Trace is disabled by default and should never be enabled in a production environment. Messages and options are not logged at other logging levels.
Constructors
LoggingChatClient(IChatClient, ILogger) |
Initializes a new instance of the LoggingChatClient class. |
Properties
InnerClient |
Gets the inner IChatClient. (Inherited from DelegatingChatClient) |
JsonSerializerOptions |
Gets or sets JSON serialization options to use when serializing logging data. |
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) |
GetResponseAsync(IEnumerable<ChatMessage>, ChatOptions, CancellationToken) |
Sends chat messages and returns the response. |
GetService(Type, Object) |
Asks the IChatClient for an object of the specified type |
GetStreamingResponseAsync(IEnumerable<ChatMessage>, ChatOptions, CancellationToken) |
Sends chat messages and streams the response. |