Hello, I’ve been trying to find a similar problem in the bubble forums with something that would work, but have been unable to find a viable solution.
I was able to successfully get openAI to respond when I only used one body parameter keys, but ideally I would be using at least 3.
I am trying to have 3 variables that the user can adjust, being ‘start location’ , ‘end location’ , and ‘type’, where then the bot spits out 3 suggestions of locations of that type between the two user selected locations.
This is the error I’ve gotten:
“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”,
My existing code that does gives me the 400 error looks like this:
{
"model": "gpt-4o-mini",
"messages": [
{
"role": "system",
"content": "You are a helpful travel planner. You will take the inputs from the user and make three suggestions of places they can add to their itenerary, the locations of the suggestions should be between the start and end locations given by the user. The type of location should be based on the type they selected. Do not ask follow up questions, if there is ambiguity, be creative. Make sure to include the name of the place, the address, and a description."
},
{
"role": "user",
"content": <user_type>,<user_start>,<user_end>
}
]
}
I’ve tried with the manual inputs on the parameters to put them in “”, with no quotes, and with " " and nothing has worked.
Any help would be much appreciated.