openai-php / client

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

Fixed broken getting of body as a string #141

Closed awm1 closed 1 year ago

awm1 commented 1 year ago

as in this pull request

gehrisandro commented 1 year ago

@awm1 Could you give an example when does this problem occurs or provide a regression test?

awm1 commented 1 year ago

@awm1 Could you give an example when does this problem occurs or provide a regression test?

It occurs when I use \OpenAI::factory()->withHttpClient() + Client from php-http/guzzle7-adapter. It should be the same implementation of ClientInterface like Psr18Client, however, it returns empty getContents() due to its internal behaviour mentioned in that PR. I haven't found any standard this client violates so I suppose this fix may be good solution.

gehrisandro commented 1 year ago

@awm1 Do you have a working example of a failing setup? Maybe a repository?

The reason I ask: I could merge this PR as I don't see an issue, but I want to ensure it does not get reverted with the next refactoring as it already happened once. Therefore we need some way to write a regression test, which is only possible when I can reproduce the issue.

gehrisandro commented 1 year ago

@awm1 Still waiting for your example. But feel free to reopen this PR if needed.