Hi I’m trying to build an API call from openAI but sometimes i get this error
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 [email protected] and include any relevant code you’d like help with.)”,
“type”: “invalid_request_error”,
“param”: null,
“code”: null
}
}
my API call is the following:
{
“model”: “text-davinci-003”,
“prompt”: “Q: can you explain to me this excel n <excel_formula>n”,
“temperature”: 0.22,
“max_tokens”: 500,
“top_p”: 1,
“frequency_penalty”: 0,
“presence_penalty”: 0
}
where excel_formula is set as INDEX(A1:D10, MATCH(“maximum”, A1:D10, 0), MATCH(“January”, A1:D1, 0))
I suppose that as I’m wrapping maximum in the same quotes as the whole value so it’s ending it there and messing it up.
any tip on how we can solve this? I would like to keep the "" around
I’m stucked, not sure what to do
2
Answers
I tried to put this text into the comments , but it doesn’t support rich formatting.
You have to replace
with
You have to replace the smart quotes (“) with straight quotes ("):