Package com.google.genai.types
Class Tool
java.lang.Object
com.google.genai.JsonSerializable
com.google.genai.types.Tool
Tool details of a tool that the model may use to generate a response.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class com.google.genai.JsonSerializable
MAX_READ_LENGTH_PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Tool.Builderbuilder()Instantiates a builder for Tool.abstract Optional<ToolCodeExecution>Optional.abstract Optional<ComputerUse>Optional.abstract Optional<EnterpriseWebSearch>Optional.abstract Optional<FileSearch>Optional.static ToolDeserializes a JSON string to a Tool object.abstract Optional<List<FunctionDeclaration>>Optional.The java.lang.reflect.Method instance.abstract Optional<GoogleMaps>Optional.abstract Optional<GoogleSearch>Optional.abstract Optional<GoogleSearchRetrieval>Optional.Optional.abstract Tool.BuilderCreates a builder with the same values as this instance.abstract Optional<UrlContext>Optional.Methods inherited from class com.google.genai.JsonSerializable
fromJsonNode, fromJsonString, objectMapper, setMaxReadLength, stringToJsonNode, toJson, toJsonNode, toJsonString
-
Constructor Details
-
Tool
public Tool()
-
-
Method Details
-
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
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
Optional. Tool to support the model interacting directly with the computer. If enabled, it automatically populates computer-use specific Function Declarations. -
fileSearch
Optional. Tool to retrieve knowledge from the File Search Stores. -
codeExecution
Optional. CodeExecution tool type. Enables the model to execute code as part of generation. -
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
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. -
googleMaps
Optional. GoogleMaps tool type. Tool to support Google Maps in Model. -
googleSearch
Optional. GoogleSearch tool type. Tool to support Google Search in Model. Powered by Google. -
googleSearchRetrieval
Optional. Specialized retrieval tool that is powered by Google Search. -
urlContext
Optional. Tool to support URL context retrieval. -
builder
Instantiates a builder for Tool. -
toBuilder
Creates a builder with the same values as this instance. -
fromJson
Deserializes a JSON string to a Tool object.
-