Share via


ChatHistoryTruncationReducer.ReduceAsync Method

Definition

Optionally reduces the chat history.

public System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Microsoft.SemanticKernel.ChatMessageContent>?> ReduceAsync (System.Collections.Generic.IReadOnlyList<Microsoft.SemanticKernel.ChatMessageContent> history, System.Threading.CancellationToken cancellationToken = default);
abstract member ReduceAsync : System.Collections.Generic.IReadOnlyList<Microsoft.SemanticKernel.ChatMessageContent> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<seq<Microsoft.SemanticKernel.ChatMessageContent>>
override this.ReduceAsync : System.Collections.Generic.IReadOnlyList<Microsoft.SemanticKernel.ChatMessageContent> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<seq<Microsoft.SemanticKernel.ChatMessageContent>>
Public Function ReduceAsync (history As IReadOnlyList(Of ChatMessageContent), Optional cancellationToken As CancellationToken = Nothing) As Task(Of IEnumerable(Of ChatMessageContent))

Parameters

history
IReadOnlyList<ChatMessageContent>

The source history (which may have been previously reduced)

cancellationToken
CancellationToken

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

Returns

The reduced history, or 'null' if no reduction has occurred

Implements

Applies to