Class Tool.Builder

java.lang.Object
com.google.genai.types.Tool.Builder
Enclosing class:
Tool

public abstract static class Tool.Builder extends Object
Builder for Tool.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • functionDeclarations

      public abstract Tool.Builder functionDeclarations(List<FunctionDeclaration> functionDeclarations)
      Setter for functionDeclarations.

      functionDeclarations: List of function declarations that the tool supports.

    • functionDeclarations

      public Tool.Builder functionDeclarations(FunctionDeclaration... functionDeclarations)
      Setter for functionDeclarations.

      functionDeclarations: List of function declarations that the tool supports.

    • functionDeclarations

      public Tool.Builder functionDeclarations(FunctionDeclaration.Builder... functionDeclarationsBuilders)
      Setter for functionDeclarations builder.

      functionDeclarations: List of function declarations that the tool supports.

    • retrieval

      public abstract Tool.Builder retrieval(Retrieval retrieval)
      Setter for retrieval.

      retrieval: Optional. Retrieval tool type. System will always execute the provided retrieval tool(s) to get external knowledge to answer the prompt. Retrieval results are presented to the model for generation.

    • retrieval

      public Tool.Builder retrieval(Retrieval.Builder retrievalBuilder)
      Setter for retrieval builder.

      retrieval: Optional. Retrieval tool type. System will always execute the provided retrieval tool(s) to get external knowledge to answer the prompt. Retrieval results are presented to the model for generation.

    • googleSearch

      public abstract Tool.Builder googleSearch(GoogleSearch googleSearch)
      Setter for googleSearch.

      googleSearch: Optional. Google Search tool type. Specialized retrieval tool that is powered by Google Search.

    • googleSearch

      public Tool.Builder googleSearch(GoogleSearch.Builder googleSearchBuilder)
      Setter for googleSearch builder.

      googleSearch: Optional. Google Search tool type. Specialized retrieval tool that is powered by Google Search.

    • googleSearchRetrieval

      public abstract Tool.Builder googleSearchRetrieval(GoogleSearchRetrieval googleSearchRetrieval)
      Setter for googleSearchRetrieval.

      googleSearchRetrieval: Optional. GoogleSearchRetrieval tool type. Specialized retrieval tool that is powered by Google search.

    • googleSearchRetrieval

      public Tool.Builder googleSearchRetrieval(GoogleSearchRetrieval.Builder googleSearchRetrievalBuilder)
      Setter for googleSearchRetrieval builder.

      googleSearchRetrieval: Optional. GoogleSearchRetrieval tool type. Specialized retrieval tool that is powered by Google search.

    • enterpriseWebSearch

      public abstract Tool.Builder enterpriseWebSearch(EnterpriseWebSearch enterpriseWebSearch)
      Setter for enterpriseWebSearch.

      enterpriseWebSearch: Optional. Enterprise web search tool type. Specialized retrieval tool that is powered by Vertex AI Search and Sec4 compliance.

    • enterpriseWebSearch

      public Tool.Builder enterpriseWebSearch(EnterpriseWebSearch.Builder enterpriseWebSearchBuilder)
      Setter for enterpriseWebSearch builder.

      enterpriseWebSearch: Optional. Enterprise web search tool type. Specialized retrieval tool that is powered by Vertex AI Search and Sec4 compliance.

    • googleMaps

      public abstract Tool.Builder googleMaps(GoogleMaps googleMaps)
      Setter for googleMaps.

      googleMaps: Optional. Google Maps tool type. Specialized retrieval tool that is powered by Google Maps.

    • googleMaps

      public Tool.Builder googleMaps(GoogleMaps.Builder googleMapsBuilder)
      Setter for googleMaps builder.

      googleMaps: Optional. Google Maps tool type. Specialized retrieval tool that is powered by Google Maps.

    • urlContext

      public abstract Tool.Builder urlContext(UrlContext urlContext)
      Setter for urlContext.

      urlContext: Optional. Tool to support URL context retrieval.

    • urlContext

      public Tool.Builder urlContext(UrlContext.Builder urlContextBuilder)
      Setter for urlContext builder.

      urlContext: Optional. Tool to support URL context retrieval.

    • functions

      public abstract Tool.Builder functions(List<Method> functions)
      Setter for functions.

      functions: The java.lang.reflect.Method instance. If provided, it will to be parsed into a list of FunctionDeclaration instances, and be assigned to the functionDeclarations field.

    • functions

      public Tool.Builder functions(Method... functions)
      Setter for functions.

      functions: The java.lang.reflect.Method instance. If provided, it will to be parsed into a list of FunctionDeclaration instances, and be assigned to the functionDeclarations field.

    • computerUse

      public abstract Tool.Builder computerUse(ToolComputerUse computerUse)
      Setter for computerUse.

      computerUse: Optional. Tool to support the model interacting directly with the computer. If enabled, it automatically populates computer-use specific Function Declarations.

    • computerUse

      public Tool.Builder computerUse(ToolComputerUse.Builder computerUseBuilder)
      Setter for computerUse builder.

      computerUse: Optional. Tool to support the model interacting directly with the computer. If enabled, it automatically populates computer-use specific Function Declarations.

    • codeExecution

      public abstract Tool.Builder codeExecution(ToolCodeExecution codeExecution)
      Setter for codeExecution.

      codeExecution: Optional. CodeExecution tool type. Enables the model to execute code as part of generation.

    • codeExecution

      public Tool.Builder codeExecution(ToolCodeExecution.Builder codeExecutionBuilder)
      Setter for codeExecution builder.

      codeExecution: Optional. CodeExecution tool type. Enables the model to execute code as part of generation.

    • build

      public abstract Tool build()