Share via


ChatProtocolExecutor.ProcessTurnMessagesAsync Method

Definition

Processes the current set of turn messages using the specified asynchronous processing function.

protected System.Threading.Tasks.ValueTask ProcessTurnMessagesAsync(Func<System.Collections.Generic.List<Microsoft.Extensions.AI.ChatMessage>,Microsoft.Agents.AI.Workflows.IWorkflowContext,System.Threading.CancellationToken,System.Threading.Tasks.ValueTask<System.Collections.Generic.List<Microsoft.Extensions.AI.ChatMessage>?>> processFunc, Microsoft.Agents.AI.Workflows.IWorkflowContext context, System.Threading.CancellationToken cancellationToken);
member this.ProcessTurnMessagesAsync : Func<System.Collections.Generic.List<Microsoft.Extensions.AI.ChatMessage>, Microsoft.Agents.AI.Workflows.IWorkflowContext, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask<System.Collections.Generic.List<Microsoft.Extensions.AI.ChatMessage>>> * Microsoft.Agents.AI.Workflows.IWorkflowContext * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask
Protected Function ProcessTurnMessagesAsync (processFunc As Func(Of List(Of ChatMessage), IWorkflowContext, CancellationToken, ValueTask(Of List(Of ChatMessage))), context As IWorkflowContext, cancellationToken As CancellationToken) As ValueTask

Parameters

processFunc
Func<List<ChatMessage>,IWorkflowContext,CancellationToken,ValueTask<List<ChatMessage>>>

A delegate that asynchronously processes a list of chat messages within the given workflow context and cancellation token, returning the processed list of chat messages or null.

context
IWorkflowContext

The workflow context in which the messages are processed.

cancellationToken
CancellationToken

A token that can be used to cancel the asynchronous operation.

Returns

A ValueTask that represents the asynchronous operation. The result contains the processed list of chat messages, or an empty list if the processing function returns null.

Remarks

If the provided list of chat messages is null, an initial empty list is supplied to the processing function. If the processing function returns null, an empty list is used as the result.

Applies to