The Importance of YouTube Engagement
Thank you to everyone who likes, subscribes and comments on our videos. It really helps us out on YouTube, helps us get discovered by more people. I'm creating this video in response to a comment we received and that was a question about OpenAI, the Bubble API connector and how we can add additional parameters into the API call, in particular temperature.
Setting Up the API Call
If I swap back into the API connector, I've got this API call set up and if you want help getting this far, we've now got loads of videos about OpenAI on our website, planetnocode.com that you can check out and get access to. If you become a member, you get access to even more videos.
Adding Temperature Parameter
So I want to add in temperature here and it's really simple. I'm just going to add it in and then type in temperature. It's really important that we follow JSON syntax here. So that is using the double quotes, the speech marks, making sure that between each line, we have a comma, making sure that the final one doesn't have a comma, it only goes in between.
Checking the Documentation
Then if I go back to the documentation, temperature is looking for a value between one and two. So I'll go back and I can just put into here. Let's try this. And then I'm just going to update the call here so that I don't have to allow make it JSON safe in my workflows or just rather test it here in the API connector.
Testing the API Call
I'm just going to say "write about no code". Okay, I've got an error back and that's probably because I've made a syntax error. Right, I've not got a comma there. I thought I had. Let's try that again. And it's not type number. Okay, now I was honestly thinking in the back of my mind this would happen.
Correcting the Syntax Error
That's because when you declare a string or a piece of text, you have to put it between double quotes, speech marks. But I think if you declare a number or an integer, you don't need the speech marks.
Successful API Response
Okay, and there we've got it. We get our response back and let's just check the temperature is as I set it. Does it give the temperature in the returning message? No, it doesn't. But anyway, you've seen that it is accepted.
Conclusion
So as long as you are careful with how you structure your JSON, that is how you can add additional parameters into OpenAI.