Skip to content
Docs
Tools

Tool Calls

Advanced AI models such as OpenAI GPT-3.5 and GPT-4 have the ability to call user-defined functions through tools. A tool has a name and a set of parameters (signature). The parameters are specified using JSON schema.

Given one or several tools, an AI model can include one or more tool calls in its response. A tool call consists of an ID, a tool name and a set of arguments that matches the tool signature.

You can invoke your tool code with the arguments and return a result. The result can be fed back to the AI model in the next request by attaching tool result messages to the chat.

Provider Support

Tool calls are currently supported by the OpenAI chat API and OpenAI-chat compatible providers with tool calling models:

  • OpenAI GPT-3.5 and variants
  • OpenAI GPT-4 and variants
  • Mistral small and large
  • Fireworks FireFunction v1

© 2023 Vercel Inc.