interlens.context.summarize_policy¶
interlens.context.summarize_policy
¶
SummarizePolicy
¶
Bases: ContextPolicy
Compress older turns into a single summary segment instead of dropping them outright (the heaviest policy).
Keeps the preserved framing (system / moderator / private_context) and the most recent keep_last turns
verbatim, and replaces the older middle turns with one summary segment produced by summarizer — a
callable list[str] -> str over the dropped turns' contents. With no summarizer it inserts a neutral
placeholder, so it degrades to a labelled drop rather than silently losing content.
summarizer is a live callable and so is not serialized; a loaded template gets summarizer=None and
the caller re-injects one if needed.