Skip to content

[Bug]: /vendor/openai-php/client/src/Transporters/HttpTransporter.php(61): json_decode() #341

@chengxs1994

Description

@chengxs1994

Description

When the content returned by openai is not JSON,/vendor/openai php/client/src/Transporters/HttpTransporter. php (61): will throw an exception, but we cannot obtain the specific content by capturing the DeserializableResponse

Could we add the contents attribute to the UnserializableResponse class?

Steps To Reproduce

try {
    /** @var array{error?: array{message: string, type: string, code: string}} $data */
    $data = json_decode($contents, true, flags: JSON_THROW_ON_ERROR);
} catch (JsonException $jsonException) {
    throw new UnserializableResponse($jsonException);
}

OpenAI PHP Client Version

v0.8.1

PHP Version

8.1

Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions