AgentThread.MessagesReceivedAsync Method
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.
This method is called when new messages have been contributed to the chat by any participant.
protected internal virtual System.Threading.Tasks.Task MessagesReceivedAsync(System.Collections.Generic.IEnumerable<Microsoft.Extensions.AI.ChatMessage> newMessages, System.Threading.CancellationToken cancellationToken = default);
abstract member MessagesReceivedAsync : seq<Microsoft.Extensions.AI.ChatMessage> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.MessagesReceivedAsync : seq<Microsoft.Extensions.AI.ChatMessage> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Protected Friend Overridable Function MessagesReceivedAsync (newMessages As IEnumerable(Of ChatMessage), Optional cancellationToken As CancellationToken = Nothing) As Task
Parameters
- newMessages
- IEnumerable<ChatMessage>
The new messages.
- cancellationToken
- CancellationToken
The CancellationToken to monitor for cancellation requests. The default is None.
Returns
A task that completes when the context has been updated.
Exceptions
The thread has been deleted.
Remarks
Inheritors can use this method to update their context based on the new message.