AgentChat 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.
Provides a point of interaction for one or more agents.
public abstract class AgentChat
type AgentChat = class
Public MustInherit Class AgentChat
- Inheritance
-
AgentChat
- Derived
Remarks
AgentChat instances don't support concurrent invocation and will throw an exception if concurrent activity is attempted for any public method.
Constructors
AgentChat() |
Initializes a new instance of the AgentChat class. |
Properties
Agents |
Gets the agents participating in the chat. |
History |
Gets the internal history to expose it to subclasses. |
IsActive |
Gets a value that indicates whether a chat operation is active. Activity is defined as any execution of a public method. |
Logger |
Gets the ILogger associated with this chat. |
LoggerFactory |
Gets the ILoggerFactory associated with the AgentChat. |
Methods
AddChatMessage(ChatMessageContent) |
Appends a message to the conversation. Adding a message while an agent is active is not allowed. |
AddChatMessages(IReadOnlyList<ChatMessageContent>) |
Appends messages to the conversation. Adding messages while an agent is active is not allowed. |
GetChatMessagesAsync(Agent, CancellationToken) |
Retrieves the message history, either the primary history or an agent-specific version. |
GetChatMessagesAsync(CancellationToken) |
Retrieves the chat history. |
InvokeAgentAsync(Agent, CancellationToken) |
Processes a discrete incremental interaction between a single Agent and a AgentChat. |
InvokeAsync(CancellationToken) |
Processes a series of interactions between the agents participating in this chat. |
InvokeStreamingAgentAsync(Agent, CancellationToken) |
Processes a discrete incremental interaction between a single Agent and a AgentChat. |
InvokeStreamingAsync(CancellationToken) |
Processes a series of interactions between the agents participating in this chat. |
ResetAsync(CancellationToken) |
Resets the chat, clearing all history and persisted state. All agents will remain present. |
SetActivityOrThrow() |
Checks to ensure the chat is not concurrently active and throws an exception if it is. If not, activity is signaled. |