First timer here and I keep on getting this issue when trying to link Open AI’s API to bubble.
This is the error i am receiving
There was an issue setting up your call.
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 send an email to support@openai.com and include any relevant code you’d like help with.)”,
“type”: “invalid_request_error”,
“param”: null,
“code”: null
}
}
JSON Body looks like this
{
“model”: “text-davinci-003”,
“prompt”: “Generate three different bullet points for a product with the given name, features, keywords, and tone of voice. Start each bullet point by using the feature first followed by a dash. Each bullet point should be 200 characters long.\n\n\nInput: \n- Product Name: \n- Features: \n- Keywords: \n- Tone of Voice: \n\nOutput: \n- Bullet Point 1: ([FEATURE 1] - [KEYWORD AND DESCRIPTION 1] - [200 CHARACTERS])\n- Bullet Point 2: ([FEATURE 2] - [KEYWORD AND DESCRIPTION 2] - [200 CHARACTERS])\n- Bullet Point 3: ([FEATURE 3] - [KEYWORD AND DESCRIPTION 3] - [200 CHARACTERS])\n”,
“temperature”: 1,
“max_tokens”: 887,
“top_p”: 1,
“frequency_penalty”: 1,
“presence_penalty”: 1
}
In all seriousness, @iansouza1992 (sorry, wrong tag initially), you’re not actually using curly quotes in your actual code, right? It may be looking like that here in the forum because you didn’t format it as code, but here’s a valid JSON version of your body:
{
"model": "text-davinci-003",
"prompt": "Generate three different bullet points for a product with the given name, features, keywords, and tone of voice. Start each bullet point by using the feature first followed by a dash. Each bullet point should be 200 characters long.\n\n\nInput: \n- Product Name: \n- Features: \n- Keywords: \n- Tone of Voice: \n\nOutput: \n- Bullet Point 1: ([FEATURE 1] - [KEYWORD AND DESCRIPTION 1] - [200 CHARACTERS])\n- Bullet Point 2: ([FEATURE 2] - [KEYWORD AND DESCRIPTION 2] - [200 CHARACTERS])\n- Bullet Point 3: ([FEATURE 3] - [KEYWORD AND DESCRIPTION 3] - [200 CHARACTERS])\n",
"temperature": 1,
"max_tokens": 887,
"top_p": 1,
"frequency_penalty": 1,
"presence_penalty": 1
}
(Which is not to say that this is a fully valid body for your POST, but at least it’s syntactically correct. Note that the API may have other issues with your call, but you most def can’t use curly quotes. Use an actual code editor for composing such things – like VSCode – not Microsoft Word or whatnot.)