Reputation: 19
im trying to initilaize this api call with dynamic values in the <>:
``
{
"model": "gpt-4o-mini",
"messages": [
{
"role": "user",
"content": <prompt>
}
],
"temperature": <temperature>
"max_tokens": <max_tokens>
}
The dynamic values are:
it's coming back with 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 contact us through our help center at help.openai.com.)", "type": "invalid_request_error", "param": null, "code": null } ``
when i run through json validator it gives this:
Invalid JSON!
Error: Parse error on line 6:
... "content": <prompt> }
-----------------------^
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined'
I tried using a completely static JSON body (i.e., without any dynamic values) to ensure that the API call works without dynamic inputs and it did.
But can't work with dynamic. What should I do?
Upvotes: 0
Views: 160
Reputation: 1
You can always use jsonlint or some other service for validating your json payloads.
Upvotes: -1