IChatClient<T>
Interfaces · AiDotNet.Agentic.Models
A message-based chat model client that supports native tool calling, streaming, and structured output.
This is the foundation the agentic orchestration subsystem is built on, superseding the legacy
text-in/text-out IChatModel<T> / ILanguageModel<T>.
Known implementations: ChatClientBase<T>, IChatClientDecorator<T>, LocalEngineChatClient<T>, ManualChatClient<T>, MeaiChatClient<T>, ProcessChatClient<T>, ReasoningModelChatClient<T>, ReplayingChatClient<T>, WeightedEnsembleChatClient<T>
For Beginners
This is the “brain” interface every agent talks to. You give it the
conversation so far and some settings; it gives you back the next reply — either all at once
(GetResponseAsync) or piece by piece as it’s generated (GetStreamingResponseAsync).
Because the interface is the same for every provider, you can swap a cloud model for a local one
without rewriting your agent.
How It Works
Implementations translate a conversation (a list of ChatMessage) plus per-call
ChatOptions into a provider call, and return either a complete ChatResponse
or a stream of ChatResponseUpdate chunks. The same abstraction covers cloud providers
(OpenAI, Anthropic, Azure) and the local engine, so higher layers (tools, graph, agents) are written
once and run against any backend.
Properties
| Property | Summary |
|---|---|
string ModelId { get; } |
Gets the identifier of the underlying model (e.g., gpt-4o, claude-3-5-sonnet, or a local model name). |
Methods
| Method | Summary |
|---|---|
IAsyncEnumerable<ChatResponseUpdate> GetStreamingResponseAsync(IReadOnlyList<ChatMessage> messages, ChatOptions options, CancellationToken cancellationToken) |
Sends the conversation and streams the model’s response as a sequence of incremental updates. |
Task<ChatResponse> GetResponseAsync(IReadOnlyList<ChatMessage> messages, ChatOptions options, CancellationToken cancellationToken) |
Sends the conversation and returns the model’s complete response. |