Hello I made an app that uses the GPT chat API to which I send a text from the user, nevertheless 1 time out of 2 I have a problem with JSON syntax that appears. I imagine that the error comes from the special characters, could someone give me a solution to transform the text of the user into readable text by the gpt chat api. Thank you very much!
:formatted as JSON safe
{"role": "user", "content": Arbitrary text:formatted as JSON safe}
Put your prompt inside Arbitrary text.
Thank you very much, I tried with this modification and the error still appears, do you know where it could come from?
The error is :
The service Open AI - Chat GPT completion just returned an error (HTTP 400). Please consult their documentation to ensure your call is setup properly. Raw error:
{
“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 help.openai.com.)”,
“type”: “invalid_request_error”,
“param”: null,
“code”: null
}
}
You’ll need to share your API Connector call, and the action you’re using it in if you’d like specific advice
Remove the quotation marks around <prompt>
. :formatted as JSON-safe does this for you.
You should go for structured response from open ai. That way it will always send the perfect json structure. Let me know if you need more help.
Thank you very much it is working now !
GEORGE !
I worked on it for 2 hours and you got it !
THANK YOU SO MUCH
This topic was automatically closed after 69 days. New replies are no longer allowed.