Compartilhar via


IAgentThread.InvokeAsync Method

Definition

Overloads

InvokeAsync(IAgent, KernelArguments, CancellationToken)

Advance the thread with the specified agent.

InvokeAsync(IAgent, String, KernelArguments, IEnumerable<String>, CancellationToken)

Advance the thread with the specified agent.

InvokeAsync(IAgent, KernelArguments, CancellationToken)

Advance the thread with the specified agent.

public System.Collections.Generic.IAsyncEnumerable<Microsoft.SemanticKernel.Experimental.Agents.IChatMessage> InvokeAsync (Microsoft.SemanticKernel.Experimental.Agents.IAgent agent, Microsoft.SemanticKernel.KernelArguments? arguments = default, System.Threading.CancellationToken cancellationToken = default);
abstract member InvokeAsync : Microsoft.SemanticKernel.Experimental.Agents.IAgent * Microsoft.SemanticKernel.KernelArguments * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<Microsoft.SemanticKernel.Experimental.Agents.IChatMessage>
Public Function InvokeAsync (agent As IAgent, Optional arguments As KernelArguments = Nothing, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of IChatMessage)

Parameters

agent
IAgent

An agent instance.

arguments
KernelArguments

Optional arguments for parameterized instructions

cancellationToken
CancellationToken

A cancellation token

Returns

The resulting agent message(s)

Applies to

InvokeAsync(IAgent, String, KernelArguments, IEnumerable<String>, CancellationToken)

Advance the thread with the specified agent.

public System.Collections.Generic.IAsyncEnumerable<Microsoft.SemanticKernel.Experimental.Agents.IChatMessage> InvokeAsync (Microsoft.SemanticKernel.Experimental.Agents.IAgent agent, string userMessage, Microsoft.SemanticKernel.KernelArguments? arguments = default, System.Collections.Generic.IEnumerable<string>? fileIds = default, System.Threading.CancellationToken cancellationToken = default);
abstract member InvokeAsync : Microsoft.SemanticKernel.Experimental.Agents.IAgent * string * Microsoft.SemanticKernel.KernelArguments * seq<string> * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<Microsoft.SemanticKernel.Experimental.Agents.IChatMessage>
Public Function InvokeAsync (agent As IAgent, userMessage As String, Optional arguments As KernelArguments = Nothing, Optional fileIds As IEnumerable(Of String) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of IChatMessage)

Parameters

agent
IAgent

An agent instance.

userMessage
String

The user message

arguments
KernelArguments

Optional arguments for parameterized instructions

fileIds
IEnumerable<String>

up to 10 file ids to reference for the message

cancellationToken
CancellationToken

A cancellation token

Returns

The resulting agent message(s)

Applies to