Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix #692 [Bug]: Passing invalid parameters to gemini throws Undefined…#693

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
alxlab-zone66x wants to merge3 commits intoopenai-php:main
base:main
Choose a base branch
Loading
fromalxlab-zone66x:issue-692

Conversation

@alxlab-zone66x
Copy link

… array key "choices" /www/htdocs/vendor/openai-php/client/src/Responses/Chat/CreateResponse.php 54

Change-Id: Ibbf64cc554ef68844fd8338583f3fc8ec5fde413

What:

  • Bug Fix

Description:

Related:

Fix issue#692

… Undefined array key "choices" /www/htdocs/vendor/openai-php/client/src/Responses/Chat/CreateResponse.php 54Change-Id: Ibbf64cc554ef68844fd8338583f3fc8ec5fde413
Copy link
Collaborator

@iBotPeachesiBotPeaches left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Could you add a test to confirm this? I think the HttpTransporter tests is the area to make a formulated Gemini exception to confirm this.

@alxlab-zone66x
Copy link
Author

Yeah sure. That would make sense.

@alxlab-zone66x
Copy link
Author

Hmm for theErrorException type what do you thing would be best? Google returns:

[[            'error' => [                'code' => 400,                'message' => 'Invalid JSON payload received. Unknown name "ddd": Cannot find field.',                'status' => 'INVALID_ARGUMENT',                'details' => [                    [                        '@type' => 'type.googleapis.com/google.rpc.BadRequest',                        'fieldViolations' => [                            [                                'description' => 'Invalid JSON payload received. Unknown name "ddd": Cannot find field.',                            ],                        ],                    ],                ],            ],        ]]

type.googleapis.com/google.rpc.BadRequest would be more in line with OpenAI's typeinvalid_request_error, butINVALID_ARGUMENT is more informative imho.

@iBotPeaches
Copy link
Collaborator

type.googleapis.com/google.rpc.BadRequest would be more in line with OpenAI's typeinvalid_request_error, butINVALID_ARGUMENT is more informative imho.

Probably the message/status of the higher object. I think you can ignore inner details stuff.

… Undefined array key "choices" /www/htdocs/vendor/openai-php/client/src/Responses/Chat/CreateResponse.php 54Add tests for gemini with invalid parameter.Set ErrorException type to return error status for invalid gemini parameter.Change-Id: I076016d0470eb3060d3f972702e4e3701b52207d
Comment on lines +181 to +183
if (!isset($data[0]['error']['type']) &&isset($data[0]['error']['status'])) {
$data[0]['error']['type'] =$data[0]['error']['status'];
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This check is the only thing I'm iffy on right now. I'd rather the ErrorException class navigate the water of different error structures to normalize them. So the HTTPTransporter isn't required to formulate things perfectly for an exception class.

@krowinski
Copy link

Hi! Any update on this? Maybe Google should fix it ? I suppose every SDK has issues with error payloads ?

@iBotPeaches
Copy link
Collaborator

I wish Google would fix it. If you are making a parity API for OpenAI, at least make it match. My last comment is still outstanding.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@iBotPeachesiBotPeachesiBotPeaches left review comments

+2 more reviewers

@kmk142789kmk142789kmk142789 approved these changes

@prince-alipclintonprince-alipclintonprince-alipclinton approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

6 participants

@alxlab-zone66x@iBotPeaches@krowinski@kmk142789@prince-alipclinton@ammarcoux

[8]ページ先頭

©2009-2025 Movatter.jp