AgentChat.GetChatMessagesAsync Method

Definition

Overloads

GetChatMessagesAsync(CancellationToken)

Retrieves the chat history.

GetChatMessagesAsync(Agent, CancellationToken)

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

GetChatMessagesAsync(CancellationToken)

Retrieves 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)

Retrieves 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

AgentChat instances don't support concurrent invocation and will throw exception if concurrent activity is attempted.

Applies to