Limited Time Offer: Watch All Our Bubble Tutorial Videos for Only $99 per Year!

How to change OpenAI temperature with Bubble API Connector

In this Bubble tutorial we explain how to add extra parameters to your OpenAI call such as temperature.

Thank you to everyone who likes, subscribes and comments on our videos. It really helps us out on YouTube, helps to get discovered by more people. And 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 OpenAI 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, that you can check out and get access to. If you become a member, you get access to even more videos.

Adding Parameters: Temperature

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. And 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.

Consulting OpenAI Documentation

And then if I go back to the documentation, then temperature, and it's looking for value between one and two. So go back, I could just put into here. Ah, let's try this. Let's try two. 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

So I'm just going to say, write about no code. Initialize the call. Okay, and 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.

Understanding JSON Syntax: Strings vs Numbers

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. Okay, and there we've got it. We get our response back.

Checking the Temperature Parameter

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's accepted it. So as long as you are careful with how you structure your JSON, that is how you can add additional parameters into OpenAI.

Latest videos

lockcrossmenu