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

Undefined array key "choices" {"exception":"[object] (ErrorException(code: 0): Undefined array key "choices" #147

Closed
ondraasek opened this issue Jun 17, 2023 · 4 comments

Comments

@ondraasek
Copy link

Hi I am using the newest version 0.6.1 and still having this:

[2023-06-17 09:09:12] production.ERROR: Undefined array key "choices" {"exception":"[object] (ErrorException(code: 0): Undefined array key "choices" at /home/forge/app.deeply.cz/vendor/openai-php/client/src/Responses/Chat/CreateStreamedResponse.php:44)
[stacktrace]

any idea? thanks a lot

@MantraMedia
Copy link

I am getting the same but not on every call. I think this is related to the openai api having issues.

The $attributes array is actually then

[CreateStreamedResponse.php] Line 44:
array:1 [
  "error" => array:4 [
    "message" => "The server had an error while processing your request. Sorry about that!"
    "type" => "server_error"
    "param" => null
    "code" => null
  ]
]

instead of eg

[CreateStreamedResponse.php] Line 44:
array:5 [
  "id" => "..."
  "object" => "chat.completion.chunk"
  "created" => 1234567890
  "model" => "gpt-4-0613"
  "choices" => array:1 [
    0 => array:3 [
      "index" => 0
      "delta" => array:2 [
        "role" => "assistant"
        "content" => ""
      ]
      "finish_reason" => null
    ]
  ]
]

@ondraasek
Copy link
Author

I know I fixed it by myself and use my software logic, but it seems its broken when openai doesnt work. I dont have it every request as well, just in a problem with OpenAI api

@MantraMediaMike
Copy link

I assume you were also calling gpt-4-0613 directly , or? gpt-4 seems to work fine. the new model seems to throw this error on every 2nd or 3rd request so for now we switched back to the base model.

@ondraasek
Copy link
Author

exactly gpt-4-0613. ok good to know :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants