Understanding How GPT Uses Tools
Introduction & Overview
Welcome to understanding how GPT responds when it decides to use your tools! In the previous lesson, you learned how to create tool schemas that describe your functions to GPT. Now, you'll discover how to include these tools in your API requests and, more importantly, how to interpret GPT's responses when it wants to use them.
In this lesson, you'll learn how to configure your requests to enable tool use, understand the different types of responses GPT can provide, and extract the specific information you need to execute the tools GPT requests. By the end, you'll be able to recognize when GPT wants to use a tool and gather all the details needed to make that happen.
Adding Tool Guidance to Your Instructions
While GPT will automatically see and can use any tools you provide in your request, mentioning tools in your instructions can help ensure more consistent behavior and guide GPT toward using them appropriately.
Here's an example of how you can improve your instructions:
This guidance helps GPT understand your preferences for when and how to use tools, but it's not required for tool functionality. GPT can still recognize and use tools based solely on their availability in the request.
Providing Tools to GPT
The tools parameter is the essential component that makes your functions available to GPT. This parameter accepts the JSON array of schemas you created in the previous lesson:
GPT will recognize the available tools from the tools parameter alone. The instructions guidance can be helpful for encouraging consistent tool usage patterns, but GPT will still be able to see and use your tools even without explicit instructions.
