[Bug]: Undefined array key "code" $client->fineTuning()->listJobs()
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: https://github.com/openai-php/client/issues/336
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.
Hey, yes, it's related: the ticket explores the reason of that error and a possible fix: https://github.com/openai-php/client/issues/336
I'm facing the same issue, any solution?