Condividi tramite


TerminationStrategy.ShouldTerminateAsync Method

Definition

Evaluate the input message and determine if the chat has met its completion criteria.

public System.Threading.Tasks.Task<bool> ShouldTerminateAsync (Microsoft.SemanticKernel.Agents.Agent agent, System.Collections.Generic.IReadOnlyList<Microsoft.SemanticKernel.ChatMessageContent> history, System.Threading.CancellationToken cancellationToken = default);
member this.ShouldTerminateAsync : Microsoft.SemanticKernel.Agents.Agent * System.Collections.Generic.IReadOnlyList<Microsoft.SemanticKernel.ChatMessageContent> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<bool>
Public Function ShouldTerminateAsync (agent As Agent, history As IReadOnlyList(Of ChatMessageContent), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Boolean)

Parameters

agent
Agent

The agent actively interacting with the chat.

history
IReadOnlyList<ChatMessageContent>

The most recent message

cancellationToken
CancellationToken

The CancellationToken to monitor for cancellation requests. The default is None.

Returns

True to terminate chat loop.

Applies to