Class WebSearchCallPart

All Implemented Interfaces:
PropertyChangeSource, ThoughtSignature, Rebindable

public class WebSearchCallPart extends ModelTextPart
A specialized part representing a search query or search intent generated by the model.

This part captures the explicit "Web Search" action performed by the model on the server. While the results are typically aggregated in GroundingMetadata, this part maintains the chronological record of the search query within the conversation flow.

Author:
anahata
  • Field Details

    • queries

      private List<String> queries
      The list of search queries generated by the model.
  • Constructor Details

    • WebSearchCallPart

      public WebSearchCallPart(AbstractModelMessage message, String displayText, List<String> queries, byte[] thoughtSignature)
      Constructs a new ModelSearchCallPart.
      Parameters:
      message - The model message that triggered the search.
      displayText - A human-readable summary of the search action.
      queries - The list of search queries executed.
      thoughtSignature - The signature of the thought process associated with this search, if any.
  • Method Details

    • asText

      public String asText()
      Returns the content of the part as a simple string. This is implemented by subclasses.

      Returns a formatted string indicating a hosted search call and its queries.

      Overrides:
      asText in class TextPart
      Returns:
      The text representation of the part.
    • getDefaultMaxDepth

      protected int getDefaultMaxDepth()
      Template method hook for subclasses to provide their specific default max depth policy. This is the fallback value used when no explicit maxDepth is set on the instance. Returns the default maximum depth to keep a text part in context, as defined in the agi configuration. Returns the default maximum depth for thoughts if this is a thought part, otherwise falls back to the standard text part depth.

      Returns the default maximum depth to keep a web search call part in context.

      Overrides:
      getDefaultMaxDepth in class ModelTextPart
      Returns:
      The default maximum depth for this part type.