openai-php / client

⚡️ OpenAI PHP is a supercharged community-maintained PHP API client that allows you to interact with OpenAI API.
MIT License
4.56k stars 465 forks source link

[Bug]: Undefined array key "outputs" when using code interpreter on a thread #412

Closed KaracsonyMarton closed 1 month ago

KaracsonyMarton commented 1 month ago

Description

Undefined array key "outputs" Error

Description: An Undefined array key "outputs" error occurs when running the OpenAI PHP client. This issue appears to be related to the response handling in the ThreadRunStepResponseCodeInterpreter.php file.

Error Log:

[2024-05-27 21:55:06] local.ERROR: Undefined array key "outputs" {"userId":1,"exception":"[object] (ErrorException(code: 0): Undefined array key \"outputs\" at /var/www/html/vendor/openai-php/client/src/Responses/Threads/Runs/Steps/ThreadRunStepResponseCodeInterpreter.php:44) [stacktrace]

0 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(255): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError()

1 /var/www/html/vendor/openai-php/client/src/Responses/Threads/Runs/Steps/ThreadRunStepResponseCodeInterpreter.php(44): Illuminate\Foundation\Bootstrap\HandleExceptions->Illuminate\Foundation\Bootstrap\{closure}()

2 /var/www/html/vendor/openai-php/client/src/Responses/Threads/Runs/Steps/ThreadRunStepResponseCodeToolCall.php(43): OpenAI\Responses\Threads\Runs\Steps\ThreadRunStepResponseCodeInterpreter::from()

3 /var/www/html/vendor/openai-php/client/src/Responses/Threads/Runs/Steps/ThreadRunStepResponseToolCallsStepDetails.php(42): OpenAI\Responses\Threads\Runs\Steps\ThreadRunStepResponseCodeToolCall::from()

4 [internal function]: OpenAI\Responses\Threads\Runs\Steps\ThreadRunStepResponseToolCallsStepDetails::OpenAI\Responses\Threads\Runs\Steps\{closure}()

5 /var/www/html/vendor/openai-php/client/src/Responses/Threads/Runs/Steps/ThreadRunStepResponseToolCallsStepDetails.php(40): array_map()

6 /var/www/html/vendor/openai-php/client/src/Responses/Threads/Runs/Steps/Delta/ThreadRunStepDeltaObject.php(39): OpenAI\Responses\Threads\Runs\Steps\ThreadRunStepResponseToolCallsStepDetails::from()

7 /var/www/html/vendor/openai-php/client/src/Responses/Threads/Runs/Steps/Delta/ThreadRunStepDeltaResponse.php(40): OpenAI\Responses\Threads\Runs\Steps\Delta\ThreadRunStepDeltaObject::from()

8 /var/www/html/vendor/openai-php/client/src/Responses/Threads/Runs/ThreadRunStreamResponse.php(63): OpenAI\Responses\Threads\Runs\Steps\Delta\ThreadRunStepDeltaResponse::from()

9 /var/www/html/vendor/openai-php/client/src/Responses/StreamResponse.php(68): OpenAI\Responses\Threads\Runs\ThreadRunStreamResponse::from()

Environment:


Please let me know if further information is required or if there are any suggestions to resolve this issue. Thank you!

Steps To Reproduce

Steps to Reproduce:

  1. Enable the code interpreter on an assistant.
  2. Ask the assistant to create any file.
  3. Observe the error log for the Undefined array key "outputs" message.
  4. If the code interpreter is turned off, everything works perfectly.

OpenAI PHP Client Version

v.0.9.2

PHP Version

8.3.6

Notes

No response

gehrisandro commented 1 month ago

Hi @KaracsonyMarton

This has been fixed in https://github.com/openai-php/client/releases/tag/v0.10.0-beta.1

KaracsonyMarton commented 1 month ago

Awesome, thanks!

When do you think it will go from pre release to release?

gehrisandro commented 1 month ago

Depending on the feedback. Probably by the end of this week.