What are tools?

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

Benefits of Tool Use

  • 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.

How Tool Use Works

The process of using tools with a language model typically involves four main steps:

  1. Build each tool you want your model to use

  2. 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)

  3. The model dynamically chooses the appropriate tool(s)

  4. The developer executes the tool calls

  5. 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 to learn more.

Tool use without Toolhouse

If you don't use Toolhouse, you'll need to build, configure, run, test, and integrate your tools into any LLM you support.

Step 1: Configure the Request

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

Step 2: Model Selects Tools

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.

Step 3: Execute Tool Calls

The developer is responsible for executing the tool calls recommended by the model. This might involve pinging APIs, querying databases, or running local functions.

Step 4: Generate Final Answer

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.

Pitfalls of tool use without Toolhouse

To get the best results when using tools with language models, you'll need to take care of the following aspects:

  1. Provide clear and descriptive names for tools and their parameters

  2. Structure tool results comprehensively and with clear labels

  3. Iterate on tool descriptions if the model isn't recommending them correctly

  4. Use chat history for multi-turn conversations to maintain context

  5. Consider including instructions in the preamble for handling irrelevant questions

Tool use with Toolhouse

With Toolhouse you only need one single step, which your regular completion call. Thanks to its SDK, Toolhouse takes care of everything else.

Benefits of tool use with Toolhouse

Toolhouse takes care of all the complexity related to implementing tool use effectively.

  1. Tools are already described and prompted for you. Toolhouse provides meaningful description for each tools and its parameters.

  2. Tool description are structured in a format compatible across each LLM and framework you wish to use.

  3. You don't need to iterate on a tool description.

  4. Tools are executed for you.

  5. Toolhouse automatically composes the tool results into your chat history, so you don't have to manipulate the chat history yourself.

Last updated