Share via


ChatHistoryTruncationReducer Class

Definition

Truncate the chat history to the target message count.

public class ChatHistoryTruncationReducer : Microsoft.SemanticKernel.ChatCompletion.IChatHistoryReducer
type ChatHistoryTruncationReducer = class
    interface IChatHistoryReducer
Public Class ChatHistoryTruncationReducer
Implements IChatHistoryReducer
Inheritance
ChatHistoryTruncationReducer
Implements

Remarks

Truncation will always avoid orphaning function-content as the presence of a function-call _must_ be followed by a function-result. When a threshold count is is provided (recommended), reduction will scan within the threshold window in an attempt to avoid orphaning a user message from an assistant response.

Constructors

ChatHistoryTruncationReducer(Int32, Nullable<Int32>)

Initializes a new instance of the ChatHistoryTruncationReducer class.

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

GetHashCode()

Serves as the default hash function.

ReduceAsync(IReadOnlyList<ChatMessageContent>, CancellationToken)

Reduces the chat history.

Applies to