Closed vadimpronin closed 10 months ago
@vadimpronin Thank you for raising the issue. You should be able work around this by using "properties" => (object) [],
.
But I haven't tested it. Would love to hear if this solves your problem.
The other option would be to use JSON_FORCE_OBJECT
when we do json_encode in the client. But I am currently not sure if this would break other stuff.
"properties" => (object) []
did help, thank you!
When calling chat completions endpoint with "tools" parameter which contains a function without parameters the following error is thrown:
Invalid schema for function 'myFunctionName': [] is not of type 'object'
Example request:
This happens because empty array $request['tools'][0]['function']['parameters'] is json encoded into [] instead of {} as required by OpenAI API:
https://platform.openai.com/docs/api-reference/chat/create