Class ContextSummaryProvider

java.lang.Object
uno.anahata.ai.context.provider.ContextProvider
uno.anahata.ai.context.provider.spi.ContextSummaryProvider

public class ContextSummaryProvider extends ContextProvider
A critical context provider that injects a detailed, machine-readable summary of the entire conversation history into the model's prompt.

This summary includes unique IDs for every message and part, allowing the model to perform precise context pruning and management. It also provides instructions on the "Prune-As-You-Go" protocol.

  • Constructor Details

  • Method Details

    • getId

      public String getId()
      Description copied from class: ContextProvider
      Gets the unique identifier for this provider.

      This ID is used for internal tracking, configuration, and persistence.

      Specified by:
      getId in class ContextProvider
      Returns:
      A non-null, unique string ID (e.g., "core-context-summary").
    • getDisplayName

      public String getDisplayName()
      Description copied from class: ContextProvider
      Gets the human-readable display name for this provider.
      Specified by:
      getDisplayName in class ContextProvider
      Returns:
      A non-null, descriptive name.
    • getParts

      public List<com.google.genai.types.Part> getParts(Chat chat)
      Description copied from class: ContextProvider
      Generates a list of Part objects to be included in the model's prompt.

      This method is called by the ContentFactory before each request. Implementations should be efficient and avoid long-running operations.

      Specified by:
      getParts in class ContextProvider
      Parameters:
      chat - The current Chat instance, providing access to the session state.
      Returns:
      A list of Parts, or an empty list if the provider has no content to add.