Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Error handling for RetrieveJobResponse::from() #336

Open
marcocanestrari opened this issue Feb 10, 2024 · 1 comment
Open

[Bug]: Error handling for RetrieveJobResponse::from() #336

marcocanestrari opened this issue Feb 10, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@marcocanestrari
Copy link

marcocanestrari commented Feb 10, 2024

Description

On line 70 in /Responses/FineTuning/RetriveJobResponse.php $attributes['error'] is checked assuming it's empty if there are no errors. If there are errors, RetrieveJobResponseError::from($attributes['error']) is added to the array.

isset($attributes['error']) ? RetrieveJobResponseError::from($attributes['error']) : 'null',

Apparently, OpenAI has changed the response to

[error] => Array
        (
            [error] => 
        )

The line should be updated to

isset($attributes['error']['error']) ? RetrieveJobResponseError::from($attributes['error']['error']) : 'null',

I'd do it myself and push a PR but I'm new with OpenAI APIs, and since this started yesterday after an outage, it could only be a bug from their ends that will get fixed soon.

What do you all think?

Steps To Reproduce

Call $client->fineTuning()->listJobs();

An error should get thrown:

Fatal error: Uncaught Error: OpenAI\Responses\FineTuning\RetrieveJobResponseError::__construct(): Argument #1 ($code) must be of type string, null given, called in

OpenAI PHP Client Version

v0.8.4

PHP Version

8.3.0

Notes

No response

@axelbecher
Copy link

axelbecher commented Feb 19, 2024

It appears to me, OpenAI currently returns


[error] => Array
        (
            [error] => 
        )

When everything worked fine and a real error still looks like

[error] => Array
        (
            [code] => '12345'
            [message] => 'Bla'
            ...
        )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants