Partager via


AgentChat.GetChatMessagesAsync Method

Definition

Overloads

GetChatMessagesAsync(CancellationToken)

Retrieve the chat history.

GetChatMessagesAsync(Agent, CancellationToken)

Retrieve the message history, either the primary history or an agent specific version.

GetChatMessagesAsync(CancellationToken)

Retrieve the chat history.

public System.Collections.Generic.IAsyncEnumerable<Microsoft.SemanticKernel.ChatMessageContent> GetChatMessagesAsync (System.Threading.CancellationToken cancellationToken = default);
member this.GetChatMessagesAsync : System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<Microsoft.SemanticKernel.ChatMessageContent>
Public Function GetChatMessagesAsync (Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of ChatMessageContent)

Parameters

cancellationToken
CancellationToken

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

Returns

The message history

Applies to

GetChatMessagesAsync(Agent, CancellationToken)

Retrieve the message history, either the primary history or an agent specific version.

public System.Collections.Generic.IAsyncEnumerable<Microsoft.SemanticKernel.ChatMessageContent> GetChatMessagesAsync (Microsoft.SemanticKernel.Agents.Agent? agent, System.Threading.CancellationToken cancellationToken = default);
member this.GetChatMessagesAsync : Microsoft.SemanticKernel.Agents.Agent * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<Microsoft.SemanticKernel.ChatMessageContent>
Public Function GetChatMessagesAsync (agent As Agent, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of ChatMessageContent)

Parameters

agent
Agent

An optional agent, if requesting an agent history.

cancellationToken
CancellationToken

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

Returns

The message history

Remarks

Any AgentChat instance does not support concurrent invocation and will throw exception if concurrent activity is attempted.

Applies to