Expand description
CompactionStrategy trait and the two built-in implementations.
See TruncateStrategy (drop the prefix) and SummarizeStrategy
(replace the prefix with a model-generated summary).
Structs§
- Compaction
Output - Result of a successful
CompactionStrategy::compactcall. - Summarize
Strategy - Compaction strategy that calls a
CompletionModelto summarize the dropped portion of the history into a single text message, instead of dropping it outright. - Truncate
Strategy - Default
CompactionStrategy: drop the oldest unpinned messages until the preserved tail starts at a safeUser-without-ToolResultboundary. Pinned messages from the dropped prefix survive verbatim at their relative position; the cut never strands aToolResultfrom itsToolCall. Reports underCompactionStrategy::nameas"truncate".
Constants§
- DEFAULT_
SUMMARIZER_ PROMPT - Default system prompt used by
SummarizeStrategywhen the caller does not supply one. Kept terse to leave room for the actual transcript insidemax_tokens.
Traits§
- Compaction
Strategy - User-implementable strategy for shrinking a
History’s history whenHistory::compact_if_neededruns.