ChatReducerCompactionStrategy class
A compaction strategy that delegates to a ChatReducer to reduce the
conversation's included messages.
This strategy bridges the ChatReducer abstraction from
Microsoft.Extensions.AI into the compaction pipeline. It collects the
currently included messages from the CompactionMessageIndex, passes them
to the reducer, and rebuilds the index from the reduced message list when
the reducer produces fewer messages. The CompactionTrigger controls when
reduction is attempted. Use CompactionTriggers for common trigger
conditions such as token or message thresholds.
- Inheritance
-
- Object
- CompactionStrategy
- ChatReducerCompactionStrategy
- Available extensions
Constructors
- ChatReducerCompactionStrategy(ChatReducer chatReducer, CompactionTrigger trigger)
-
Creates a ChatReducerCompactionStrategy with
chatReducerandtrigger.
Properties
- chatReducer → ChatReducer
-
Gets the chat reducer used to reduce messages.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- target → CompactionTrigger
-
finalinherited
- trigger → CompactionTrigger
-
finalinherited
Methods
-
asChatReducer(
) → ChatReducer -
Available on CompactionStrategy, provided by the ChatStrategyExtensions extension
-
compact(
CompactionMessageIndex index, {Logger? logger, CancellationToken? cancellationToken}) → Future< bool> -
inherited
-
compactCore(
CompactionMessageIndex index, Logger logger, CancellationToken cancellationToken) → Future< bool> -
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited