From the course: Build a JavaScript AI App with React and the OpenAI API

Unlock the full course today

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

Create a custom function call for the OpenAI API

Create a custom function call for the OpenAI API

- [Instructor] Here's an example of how we can reconfigure our call to the OpenAI API and to use functions. This is the same example as what I had before except I've stripped out some pieces and put in something else in place. First off, we're calling the 0613 version 3.5 because that's the one that has function calling built in. Next, I've removed the system message 'cause we no longer need it, but I've retained the regular prompt. So should I wear sunscreen today in Burnaby, which is still a question about the weather, but it's more vague as to whether or not it's the weather. I'm not explicitly saying what is the weather like in Burnaby. Scrolling down, I've now set up a functions array with one entry. There's an object here with a name, location data. So that would be the function name. And the description is get the current weather at a given location. So this is now the system message for this particular…

Contents