Interface ConversationSummarizer

All Known Implementing Classes:
PromptedConversationSummarizer

public interface ConversationSummarizer
Condenses the stretch of conversation that is rolling out of the context window.

This is the one part of trimming that a provider can do better than we can: OpenAI's /responses/compact and Anthropic's compaction both exist to produce exactly this text. Everything around it — which messages roll out, what is kept verbatim, when a summary is reused — is our policy and stays with the caller.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    How much of the input budget the caller holds back for the summary an implementation returns.
  • Method Summary

    Modifier and Type
    Method
    Description
    summarize(List<UIMessage> messages, ChatRequest request, AiModel model)
     
  • Field Details

    • SUMMARY_MAX_TOKENS

      static final int SUMMARY_MAX_TOKENS
      How much of the input budget the caller holds back for the summary an implementation returns.
      See Also:
  • Method Details

    • summarize

      String summarize(List<UIMessage> messages, ChatRequest request, AiModel model)
      Parameters:
      messages - the stretch leaving the window, oldest first
      model - the conversation's model, for a summarizer that has no model of its own
      Returns:
      the summary, or null when one could not be produced — the caller then trims without it