#JSON Response Format using github.com/openai-php/laravel

13 messages · Page 1 of 1 (latest)

ionic haven
#

The OpenAI docs descripe a response_format of type json_object when using gpt-3.5-turbo-1106 or newer. This does not seem to work with the PHP client. I am using 'response_format' => '{"type": "json_object"}' as described in the docs, and have the required 'respond with json' in the message. I get the 'json_object' is not of type 'object' - 'response_format' error.

cold jay
#

Why are you not just using the facade? If you're not taking advantage of that, then don't use the laravel package...

#

If you are just interfacing with the openai-php client and not using the facades etc, then having extra packages is pointless You don't HAVE to use a package just because it has the "laravel" name in it, you can use the openai-php client directly instead

ionic haven
#

I am using the facade, this is variable in the message component of OpenAI::chat()->create().

cold jay
#

There is zero reference to response_format = 'json_object' that I can see, 'verbose_json' is an option

ionic haven
#

verbose_json is for the voice api call

cold jay
#

Right, where have you seen "json_object" as "response_format" in the docs?

#

And I'm talking the PHP Client, not the official API docs

ionic haven
#

I am asking if it is supported or if anyone has used the json support, it's not in the docs.

cold jay
#

If it's not in the docs, then I'd suggest you open up a discussion on the OpenAI PHP github repo

#

Or open up an Issue

#

Discord isn't the place to make feature requests

#

It may be that it's in the roadmap