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]: Undefined array key "code" $client->fineTuning()->listJobs() #337

Open
vestaxpdx opened this issue Feb 10, 2024 · 3 comments
Open
Labels
bug Something isn't working

Comments

@vestaxpdx
Copy link

vestaxpdx commented Feb 10, 2024

Description

I am suddenly getting: Undefined array key "code" when calling $client->fineTuning()->listJobs()

I guess openai have changed something?

Issue seems to be here: openai-php\client\src\Responses\FineTuning\RetrieveJobResponseError.php

 /**
     * Acts as static factory, and returns a new Response instance.
     *
     * @param  array{code: string, param: ?string, message: string}  $attributes
     */
    public static function from(array $attributes): ?self
    {
        return new self(
            $attributes['code'],
            $attributes['param'],
            $attributes['message'],
        );
    }

Steps To Reproduce

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

OpenAI PHP Client Version

v0.8.4

PHP Version

8.2

Notes

Potentially related issue: #336

@vestaxpdx vestaxpdx added the bug Something isn't working label Feb 10, 2024
@vestaxpdx
Copy link
Author

Form some quick debugging it seems $attributes only contains $attributes['error'] which = null.

The only way I could quickly hot fix to get my project working again was by adding null coalescing operators, which is a dirty fix I know...

return new self(
            $attributes['code'] ?? '',
            $attributes['param'] ?? '',
            $attributes['message'] ?? '',
        );

Then my finetune jobs load again as normal.

@marcocanestrari
Copy link

marcocanestrari commented Feb 10, 2024

Hey, yes, it's related: the ticket explores the reason of that error and a possible fix: #336

@adnane-ka
Copy link

I'm facing the same issue, any solution?

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

3 participants