Class TruncatingSummarizer

java.lang.Object
ai.redouble.nucleo.harness.schema.TruncatingSummarizer
All Implemented Interfaces:
Summarizer

public class TruncatingSummarizer extends Object implements Summarizer
Default summarizer that truncates text to a character budget derived from the LLMSummarizable.size() annotation, preserving word boundaries.

Checks LLMSummarizable.staticSummary() first - if set, uses that as the summary label. Otherwise truncates the text content.

Always safe to use from any context (Tools, Thinkers, Doers) - no external calls, no blocking, no resource requirements.

Since:
0.1 (2026-04-03)
Author:
Andrey Santrosyan
  • Constructor Details

    • TruncatingSummarizer

      public TruncatingSummarizer()
  • Method Details

    • summarize

      public String summarize(String text, LLMSummarizable annotation)
      Description copied from interface: Summarizer
      Summarize text that exceeds the annotation threshold.
      Specified by:
      summarize in interface Summarizer
      Parameters:
      text - the full text to summarize
      annotation - the @LLMSummarizable annotation from the field
      Returns:
      summary string, typically in format "[SUMMARY: X chars] brief..."