I keep getting the "We could not parse the JSON body of your request." when I try to 'Initialise call' on Bubble

There is a persistent issue setting up the API call on Bubble.

Raw response for the API
Status code 400
{
“error”: {
“message”: “We could not parse the JSON body of your request. (HINT: This likely means you aren’t using your HTTP library correctly. The OpenAI API expects a JSON payload, but what was sent was not valid JSON. If you have trouble figuring out how to fix this, please contact us through our help center at .)”,
“type”: “invalid_request_error”,
“param”: null,
“code”: null
}
}

I keep getting this error when I try to initialise call on Bubble
What’s wrong in the json body of my request, I’ve been trying variations for hours.

This is using Bubbleio’s API Connector

Body :
{
model: “text-davinci-edit-001”,
input: “i took a walk in a park on a sunny afternoon, a bad time to be out.”,
instruction: “edit this sentence to add fancy words in place of common ones”,
}

1 Like

That’s not a valid JSON.

below is :

{
“model”: “text-davinci-edit-001”,
“input”: “i took a walk in a park on a sunny afternoon, a bad time to be out.”,
“instruction”: “edit this sentence to add fancy words in place of common ones”
}

Hi,

I’m having the same error response when I’m submitting my form and a call to the API is done!

Here is my API call body :

{
“model”: “gpt-3.5-turbo”,
“messages”: [
{
“role”: “system”,
“content”: "You are a LinkedIn professional content creator assistant. We’ll give you different input like the description,the tone, the style and the language of the post that you will generated. "
},
{
“role”: “user”,
“content”: "Generate a post using this prompt, based on the following description/subject : . You are a LinkedinGPT, a large language model that generates viral posts for Linkedin, the tone of the post should be : The whole post generated must be in: "
}
]
}

I’ve put the :formatted as JSON safe after my input’s values in the workflow.

I took care there are no quotes like this " or this ` in my prompts. I have a doubt if those quote ’ , like on it’s , could make an error?

Do you know where the issue is coming from?

Franck

I get this too. It does not like colons. e.g. description/subject : … and if you try and escape out the colons using find and replace, it does it everywhere! Anyone solved this?

I never did track down the issue for sure, but suspect it is to do with the way Bubble is parsing JSON. In the end I solved it with a find and replace for the following:

Replace " with "
Replace \n with \n

Not sure if this helps.