Share via


ChatHistorySummarizationReducer Class

Definition

Reduce the chat history by summarizing message past the target message count.

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

Remarks

Summarization 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

ChatHistorySummarizationReducer(IChatCompletionService, Int32, Nullable<Int32>)

Initializes a new instance of the ChatHistorySummarizationReducer class.

Fields

DefaultSummarizationPrompt

The default summarization system instructions.

SummaryMetadataKey

Metadata key to indicate a summary message.

Properties

FailOnError

Flag to indicate if an exception should be thrown if summarization fails.

SummarizationInstructions

System instructions for summarization. Defaults to DefaultSummarizationPrompt.

UseSingleSummary

Flag to indicate summarization is maintained in a single message, or if a series of summations are generated over time.

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