IChatClient Interface
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.
Represents a chat completion client.
public interface class IChatClient : IDisposable
public interface IChatClient : IDisposable
type IChatClient = interface
interface IDisposable
Public Interface IChatClient
Implements IDisposable
- Derived
- Implements
Remarks
Unless otherwise specified, all members of IChatClient are thread-safe for concurrent use. It is expected that all implementations of IChatClient support being used by multiple requests concurrently.
However, implementations of IChatClient may mutate the arguments supplied to CompleteAsync(IList<ChatMessage>, ChatOptions, CancellationToken) and CompleteStreamingAsync(IList<ChatMessage>, ChatOptions, CancellationToken), such as by adding additional messages to the messages list or configuring the options instance. Thus, consumers of the interface either should avoid using shared instances of these arguments for concurrent invocations or should otherwise ensure by construction that no IChatClient instances are used which might employ such mutation. For example, the WithChatOptions method be provided with a callback that could mutate the supplied options argument, and that should be avoided if using a singleton options instance.
Properties
Metadata |
Gets metadata that describes the IChatClient. |
Methods
CompleteAsync(IList<ChatMessage>, ChatOptions, CancellationToken) |
Sends chat messages to the model and returns the response messages. |
CompleteStreamingAsync(IList<ChatMessage>, ChatOptions, CancellationToken) |
Sends chat messages to the model and streams the response messages. |
Dispose() |
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from IDisposable) |
GetService<TService>(Object) |
Asks the IChatClient for an object of type |