MessageCountingChatReducer class
A chat reducer that keeps the most recent messages up to a target count.
System messages are always preserved. The reducer keeps the first system message(s) and the most recent non-system messages.
- Inheritance
-
- Object
- ChatReducer
- MessageCountingChatReducer
Constructors
- MessageCountingChatReducer(int targetCount)
- Creates a new MessageCountingChatReducer.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- targetCount → int
-
The target number of messages to retain.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reduce(
List< ChatMessage> messages, {CancellationToken? cancellationToken}) → Future<List< ChatMessage> > -
Reduces the given
messages.override -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited