Gemini Tool Use
Integrate external functions and APIs with the Gemini model to extend its capabilities beyond its training data, enabling real-time data access and complex task execution.
When to use
When the Gemini model needs to perform actions or retrieve information that is outside its knowledge base or requires interaction with external systems, such as fetching current weather, searching a database, or sending an email.
How to apply
First, define the tools (functions) that the model can call, including their names, descriptions, and parameters.
Next, pass these tool definitions to the Gemini model during your API call.
When the model determines it needs a tool, it will return a tool call instead of a direct response.
Finally, execute the recommended tool call with the provided arguments and pass the tool's output back to the model for it to generate a final, informed response.
Glossary
- Tool definitions
- A structured description of an external function or API, including its name, a human-readable description of what it does, and the schema of its input parameters, allowing the LLM to understand how and when to use it.
- Tool call
- An instruction from the LLM indicating that it needs to execute a specific external function, along with the arguments (parameters) it believes are necessary for that function based on the user's prompt.
- External systems
- Any software, database, or API that exists outside of the LLM itself, which the LLM can interact with by making function calls to retrieve information or perform actions.
Sources
