Share via


ChatHistoryExtensions.ReduceInPlaceAsync Method

Definition

Process history reduction and mutate the provided history in place.

public static System.Threading.Tasks.Task<bool> ReduceInPlaceAsync(this Microsoft.SemanticKernel.ChatCompletion.ChatHistory chatHistory, Microsoft.SemanticKernel.ChatCompletion.IChatHistoryReducer? reducer, System.Threading.CancellationToken cancellationToken);
static member ReduceInPlaceAsync : Microsoft.SemanticKernel.ChatCompletion.ChatHistory * Microsoft.SemanticKernel.ChatCompletion.IChatHistoryReducer * System.Threading.CancellationToken -> System.Threading.Tasks.Task<bool>
<Extension()>
Public Function ReduceInPlaceAsync (chatHistory As ChatHistory, reducer As IChatHistoryReducer, cancellationToken As CancellationToken) As Task(Of Boolean)

Parameters

chatHistory
ChatHistory

The source history

reducer
IChatHistoryReducer

The target reducer

cancellationToken
CancellationToken

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

Returns

True if reduction has occurred.

Remarks

Using the existing ChatHistory for a reduction in collection size eliminates the need for re-allocation (of memory).

Applies to