Class Tool.Builder

  • All Implemented Interfaces:

    
    public abstract class Tool.Builder
    
                        

    Builder for Tool.

    • Constructor Detail

      • Tool.Builder

        Tool.Builder()
    • Method Detail

      • retrieval

         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. This field is not supported in Gemini API.

      • retrieval

        @CanIgnoreReturnValue() 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. This field is not supported in Gemini API.

      • functions

         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

        @CanIgnoreReturnValue() Tool.Builder functions(Array<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

         abstract Tool.Builder computerUse(ComputerUse 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

        @CanIgnoreReturnValue() Tool.Builder computerUse(ComputerUse.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.

      • fileSearch

         abstract Tool.Builder fileSearch(FileSearch fileSearch)

        Setter for fileSearch.

        fileSearch: Optional. FileSearch tool type. Tool to retrieve knowledge from Semantic Retrieval corpora. This field is not supported in Vertex AI.

      • fileSearch

        @CanIgnoreReturnValue() Tool.Builder fileSearch(FileSearch.Builder fileSearchBuilder)

        Setter for fileSearch builder.

        fileSearch: Optional. FileSearch tool type. Tool to retrieve knowledge from Semantic Retrieval corpora. This field is not supported in Vertex AI.

      • googleSearch

         abstract Tool.Builder googleSearch(GoogleSearch googleSearch)

        Setter for googleSearch.

        googleSearch: Optional. GoogleSearch tool type. Tool to support Google Search in Model. Powered by Google.

      • googleSearch

        @CanIgnoreReturnValue() Tool.Builder googleSearch(GoogleSearch.Builder googleSearchBuilder)

        Setter for googleSearch builder.

        googleSearch: Optional. GoogleSearch tool type. Tool to support Google Search in Model. Powered by Google.

      • googleMaps

         abstract Tool.Builder googleMaps(GoogleMaps googleMaps)

        Setter for googleMaps.

        googleMaps: Optional. Tool that allows grounding the model's response with geospatial context related to the user's query.

      • googleMaps

        @CanIgnoreReturnValue() Tool.Builder googleMaps(GoogleMaps.Builder googleMapsBuilder)

        Setter for googleMaps builder.

        googleMaps: Optional. Tool that allows grounding the model's response with geospatial context related to the user's query.

      • codeExecution

         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

        @CanIgnoreReturnValue() 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.

      • enterpriseWebSearch

         abstract Tool.Builder enterpriseWebSearch(EnterpriseWebSearch enterpriseWebSearch)

        Setter for enterpriseWebSearch.

        enterpriseWebSearch: Optional. Tool to support searching public web data, powered by Vertex AI Search and Sec4 compliance. This field is not supported in Gemini API.

      • enterpriseWebSearch

        @CanIgnoreReturnValue() Tool.Builder enterpriseWebSearch(EnterpriseWebSearch.Builder enterpriseWebSearchBuilder)

        Setter for enterpriseWebSearch builder.

        enterpriseWebSearch: Optional. Tool to support searching public web data, powered by Vertex AI Search and Sec4 compliance. This field is not supported in Gemini API.

      • functionDeclarations

         abstract Tool.Builder functionDeclarations(List<FunctionDeclaration> functionDeclarations)

        Setter for functionDeclarations.

        functionDeclarations: Optional. Function tool type. One or more function declarations to be passed to the model along with the current user query. Model may decide to call a subset of these functions by populating FunctionCall in the response. User should provide a FunctionResponse for each function call in the next turn. Based on the function responses, Model will generate the final response back to the user. Maximum 512 function declarations can be provided.

      • functionDeclarations

        @CanIgnoreReturnValue() Tool.Builder functionDeclarations(Array<FunctionDeclaration> functionDeclarations)

        Setter for functionDeclarations.

        functionDeclarations: Optional. Function tool type. One or more function declarations to be passed to the model along with the current user query. Model may decide to call a subset of these functions by populating FunctionCall in the response. User should provide a FunctionResponse for each function call in the next turn. Based on the function responses, Model will generate the final response back to the user. Maximum 512 function declarations can be provided.

      • functionDeclarations

        @CanIgnoreReturnValue() Tool.Builder functionDeclarations(Array<FunctionDeclaration.Builder> functionDeclarationsBuilders)

        Setter for functionDeclarations builder.

        functionDeclarations: Optional. Function tool type. One or more function declarations to be passed to the model along with the current user query. Model may decide to call a subset of these functions by populating FunctionCall in the response. User should provide a FunctionResponse for each function call in the next turn. Based on the function responses, Model will generate the final response back to the user. Maximum 512 function declarations can be provided.

      • parallelAiSearch

         abstract Tool.Builder parallelAiSearch(ToolParallelAiSearch parallelAiSearch)

        Setter for parallelAiSearch.

        parallelAiSearch: Optional. If specified, Vertex AI will use Parallel.ai to search for information to answer user queries. The search results will be grounded on Parallel.ai and presented to the model for response generation. This field is not supported in Gemini API.

      • parallelAiSearch

        @CanIgnoreReturnValue() Tool.Builder parallelAiSearch(ToolParallelAiSearch.Builder parallelAiSearchBuilder)

        Setter for parallelAiSearch builder.

        parallelAiSearch: Optional. If specified, Vertex AI will use Parallel.ai to search for information to answer user queries. The search results will be grounded on Parallel.ai and presented to the model for response generation. This field is not supported in Gemini API.

      • mcpServers

         abstract Tool.Builder mcpServers(List<McpServer> mcpServers)

        Setter for mcpServers.

        mcpServers: Optional. MCP Servers to connect to. This field is not supported in Vertex AI.

      • mcpServers

        @CanIgnoreReturnValue() Tool.Builder mcpServers(Array<McpServer> mcpServers)

        Setter for mcpServers.

        mcpServers: Optional. MCP Servers to connect to. This field is not supported in Vertex AI.

      • mcpServers

        @CanIgnoreReturnValue() Tool.Builder mcpServers(Array<McpServer.Builder> mcpServersBuilders)

        Setter for mcpServers builder.

        mcpServers: Optional. MCP Servers to connect to. This field is not supported in Vertex AI.