Interface CompactionSummarizer

All Known Implementing Classes:
ChatModelSummarizer
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface CompactionSummarizer
Writes the summary that stands in for the events a WindowCompactionStrategy covers. The strategy decides the cut; the summarizer only condenses what leaves the view into the messages of a synthetic summary turn, typically a user "shadow prompt" and an assistant summary, so the model keeps seeing a user/assistant alternation.

A summarizer that returns no messages declines: the view stays as it is and nothing is written, so a failed model call never loses history.

Since:
2.1.0
Author:
Christian Tzolov
  • Method Summary

    Modifier and Type
    Method
    Description
    Summarizes the events that leave the view.
  • Method Details

    • summarize

      List<Message> summarize(SummaryRequest request)
      Summarizes the events that leave the view.
      Parameters:
      request - what to summarize, with the prior summary to build on and the kept events for continuity
      Returns:
      the messages of the summary turn, in order; empty to leave the view unchanged