What are tools?
Language models excel at text generation but struggle with tasks like calculations, data retrieval, or interacting with external systems. To make an analogy, these models have impressive brains or reasoning capabilities, but lack the hands to interact with the digital world.
To solve this, many AI models support tool calling (also called function calling). This unlocks the ability for models to use tools, which are code functions or APIs that perform actions.
How tool calling works
AI models that support tool calling can determine when and how to use specific tools to fulfill a user’s request. It’s up to the developer to build the tools and make them available to the model. Think of it like giving the AI a toolbox and asking it to pick the right tool for the job.
For example, if a user asks, “Who is the CEO of Apple?”, the AI can:
- Recognize the need for current information about Apple’s CEO
- Select a search tool like
Web.SearchGoogle
- Use the tool to retrieve relevant information from the web
- Write a response using the gathered data
Tool Augmented Generation (TAG)
Similar to Retrieval Augmented Generation (RAG), tool calling allows the AI to use external data to answer questions. Unlike RAG, tool calling is more flexible and allows the AI to use tools that are much more diverse than text or vector search alone.
The following is a diagram of how tool calling is used to provide context to a language model similar to RAG.
First, a language model is given a user’s request. The model then determines if it needs to use a tool to fulfill the request. If so, the model selects the appropriate tool from the tools listed in the request.
The model then predicts the parameters of that tool and passes these parameters back to the client application.
Now that the tool has been executed, the model can use the output to generate a response.
This process shows the general outline of the Tool Augmented Generation (TAG) process at a high level.
Tool calling with Arcade
Arcade streamlines tool calling by providing a standardized interface, pre-built integrations, and support for complex interactions like authorization.
For example, if a user asks, “Can you star the ArcadeAI/arcade-ai repo on Github for me?”, the AI can:
- Recognize the need to interact with the GitHub API
- Select the
GitHub.SetStarred
tool - With the help of Arcade, authorize with GitHub and get a token to act on behalf of the user (with the user’s permission, of course!)
- Use the tool to perform the action of starring the repo
- Write a response to the user explaining that the action is complete
With Arcade’s extensive tool catalog, you can easily integrate tools that:
- Interact with APIs
- Access databases
- Execute code
- Perform calculations
- Retrieve real-time data
You can also create custom tools to fit your unique needs, and let Arcade handle coordinating, authorizing, and executing them.
Next steps
- Learn how to call tools with models!
- Or, jump ahead to building your own custom tools