From the course: OpenAI API for Python Developers

Unlock the full course today

Join today to access over 24,900 courses taught by industry experts.

Call functions

Call functions

- [Instructor] So we did step one, which is to start the conversation and send a user query. Now we want to take care of step two and also step three. So first step two will be to check if the model detects and wants to call a function. So we're going to go back to the documentation and look at the example again. So that's going to be step one, which is already done. And then step two is to check if the model wants to call a function to execute function calling. And basically it's going to check if tool calls exist. So that's going to be an object which is existing, provided in the generated response, and this corresponds to the list of functions that we have defined, functions and parameters. So let's do that. We're going to take all of this from line 49, all the way down to here. But before that, I just want to make a quick demonstration just to show you the difference, actually, what is tool calls. So let's make a quick demonstration. I'm going to show you that first. So what is…

Contents