Share via


ChatCompletionAgent.InvokeAsync Method

Definition

Invokes the agent to process the given messages and generate a response.

public System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<Microsoft.SemanticKernel.ChatMessageContent>> InvokeAsync (System.Collections.Generic.IReadOnlyList<Microsoft.SemanticKernel.ChatMessageContent> messages, System.Threading.CancellationToken cancellationToken = default);
member this.InvokeAsync : System.Collections.Generic.IReadOnlyList<Microsoft.SemanticKernel.ChatMessageContent> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<Microsoft.SemanticKernel.ChatMessageContent>>
Public Function InvokeAsync (messages As IReadOnlyList(Of ChatMessageContent), Optional cancellationToken As CancellationToken = Nothing) As Task(Of IReadOnlyList(Of ChatMessageContent))

Parameters

messages
IReadOnlyList<ChatMessageContent>

A list of the messages for the agent to process.

cancellationToken
CancellationToken

An optional CancellationToken to cancel the operation.

Returns

List of messages representing the agent's response.

Applies to