openai-php / client

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

fix: exception handling for server errors with different content type header - fixes #132 #134

Closed gehrisandro closed 1 year ago

gehrisandro commented 1 year ago

This PR fixes exception handling for errors with a. content type header of application/json instead of application/json; charset=utf-8

fixes #132

tomirons commented 1 year ago

This fixes the issue I was encountering.

bmckay959 commented 1 year ago

Just adding that this also fixed my issue.

Undefined array key "choices"

I was trying to send a prompt that would take too many tokens, but was not getting a helpful response until this.