openai-php / client

⚡️ OpenAI PHP is a supercharged community-maintained PHP API client that allows you to interact with OpenAI API.
MIT License
4.57k stars 466 forks source link

fix: Make object and created in StreamedResponse optional #292

Closed gerdemann closed 6 months ago

gerdemann commented 6 months ago

What:

Description:

If the endpoint does not return an object or created, an error no longer occurs.

gehrisandro commented 6 months ago

Hi @gerdemann

Thank you for your PR. According to the docs, this fields should be always part of the response and are not optional: https://github.com/openai/openai-openapi/blob/master/openapi.yaml#L5632

But sometimes the docs of OpenAI are wrong. Do you have an example how to reproduce the issue?

gerdemann commented 6 months ago

Hi @gehrisandro, I tried to connect the Mistral AI models and these fields are missing in the first stream response. But the documentation doesn't say that either: https://docs.mistral.ai/api

gehrisandro commented 6 months ago

Hi @gerdemann

Thanks for your quick reply.

As this is a client for the OpenAI API, we are not going to merge this change. But maybe you can reach out to Mistral AI to fix their response, because it's obviously wrong if they try to mirror the OpenAI API.