What are tools?
Last updated
Last updated
Tools are a powerful feature that allows you to connect language models to external resources like search engines, APIs, functions, databases, and more. This capability enables a richer set of behaviors by leveraging data stored in tools, taking actions through APIs, interacting with databases, querying search engines, and more.
Tool use (also known as "function calling") opens up a wide range of new use cases for language models. Some examples include:
Recommending tools and offering advice on how to use them
Interacting with CRM systems to change the status of deals
Engaging with a Python interpreter to conduct data science analysis
Transforming user messages into search queries for vector databases or search engines
Automatically searching across different databases and platforms to retrieve relevant information
Conducting comparative analysis using multiple data sources
Enhanced Capabilities: Allows language models to access up-to-date information and perform actions in the real world
Flexibility: Supports a wide range of use cases and can be customized to specific needs
Improved Accuracy: By leveraging external data sources, models can provide more accurate and current information
Transparency: Some implementations provide citations, making it easy to verify the sources of information
By integrating tool use into your applications, you can significantly expand the capabilities of language models and create more powerful, flexible, and accurate AI experiences for your users.
The process of using tools with a language model typically involves four main steps:
Build each tool you want your model to use
Configure the request to the model (typically by sending a JSON schema definition containing the list of tools and its model-friendly description in the form of a prompt)
The model dynamically chooses the appropriate tool(s)
The developer executes the tool calls
The model generates an answer based on the tool results
Toolhouse simplifies tool use
Toolhouse simplify each one of these steps. With Toolhouse, you won't have to build your tools, configure them, or even execute them! Check out our Quick start (Python) to learn more.
If you don't use Toolhouse, you'll need to build, configure, run, test, and integrate your tools into any LLM you support.
To begin a tool use workflow, developers must provide:
The user request
A list of available tools (with descriptions and parameters)
(Optional) A preamble containing instructions about the task and desired output style
(Optional) Chat history for context
Based on the user's request and available tools, the model intelligently selects the appropriate tool(s) to call and determines the right parameters for each tool call.
The developer is responsible for executing the tool calls recommended by the model. This might involve pinging APIs, querying databases, or running local functions.
After executing the tool calls, the developer provides the results back to the model. The model then generates a final answer based on these tool results and the original user request.
To get the best results when using tools with language models, you'll need to take care of the following aspects:
Provide clear and descriptive names for tools and their parameters
Structure tool results comprehensively and with clear labels
Iterate on tool descriptions if the model isn't recommending them correctly
Use chat history for multi-turn conversations to maintain context
Consider including instructions in the preamble for handling irrelevant questions
With Toolhouse you only need one single step, which your regular completion call. Thanks to its SDK, Toolhouse takes care of everything else.
Toolhouse takes care of all the complexity related to implementing tool use effectively.
Tools are already described and prompted for you. Toolhouse provides meaningful description for each tools and its parameters.
Tool description are structured in a format compatible across each LLM and framework you wish to use.
You don't need to iterate on a tool description.
Tools are executed for you.
Toolhouse automatically composes the tool results into your chat history, so you don't have to manipulate the chat history yourself.