Class TurnCountTrigger
java.lang.Object
org.springframework.ai.session.compaction.TurnCountTrigger
- All Implemented Interfaces:
CompactionTrigger
Fires when the view holds more than a number of turns: a user message and everything up
to the next one. Counting turns rather than events follows the shape of the
conversation, and never fires in the middle of a tool-calling exchange. Pair it with a
turn window, so the threshold and the window count
the same thing.- Since:
- 2.1.0
- Author:
- Christian Tzolov
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintbooleanshouldCompact(CompactionRequest request) Whether the view should be compacted now.
-
Constructor Details
-
TurnCountTrigger
public TurnCountTrigger(int maxTurns) - Parameters:
maxTurns- the number of turns the view may hold before compaction; positive
-
-
Method Details
-
shouldCompact
Description copied from interface:CompactionTriggerWhether the view should be compacted now.- Specified by:
shouldCompactin interfaceCompactionTrigger
-
getMaxTurns
public int getMaxTurns()
-