Closed arturspon closed 6 months ago
@arturspon Could you please provide the full stacktrace?
Sure, here it is:
ErrorException: Undefined array key "outputs"
#15 /vendor/openai-php/client/src/Responses/Threads/Runs/Steps/ThreadRunStepResponseCodeInterpreter.php(44): Illuminate\Foundation\Bootstrap\HandleExceptions::handleError
#14 /vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(256): Illuminate\Foundation\Bootstrap\HandleExceptions::Illuminate\Foundation\Bootstrap\{closure}
#13 /vendor/openai-php/client/src/Responses/Threads/Runs/Steps/ThreadRunStepResponseCodeInterpreter.php(44): OpenAI\Responses\Threads\Runs\Steps\ThreadRunStepResponseCodeInterpreter::from
#12 /vendor/openai-php/client/src/Responses/Threads/Runs/Steps/ThreadRunStepResponseCodeToolCall.php(43): OpenAI\Responses\Threads\Runs\Steps\ThreadRunStepResponseCodeToolCall::from
#11 /vendor/openai-php/client/src/Responses/Threads/Runs/Steps/ThreadRunStepResponseToolCallsStepDetails.php(42): OpenAI\Responses\Threads\Runs\Steps\ThreadRunStepResponseToolCallsStepDetails::OpenAI\Responses\Threads\Runs\Steps\{closure}
#10 [internal](0): array_map
#9 /vendor/openai-php/client/src/Responses/Threads/Runs/Steps/ThreadRunStepResponseToolCallsStepDetails.php(40): OpenAI\Responses\Threads\Runs\Steps\ThreadRunStepResponseToolCallsStepDetails::from
#8 /vendor/openai-php/client/src/Responses/Threads/Runs/Steps/Delta/ThreadRunStepDeltaObject.php(39): OpenAI\Responses\Threads\Runs\Steps\Delta\ThreadRunStepDeltaObject::from
#7 /vendor/openai-php/client/src/Responses/Threads/Runs/Steps/Delta/ThreadRunStepDeltaResponse.php(40): OpenAI\Responses\Threads\Runs\Steps\Delta\ThreadRunStepDeltaResponse::from
#6 /vendor/openai-php/client/src/Responses/Threads/Runs/ThreadRunStreamResponse.php(63): OpenAI\Responses\Threads\Runs\ThreadRunStreamResponse::from
#5 /vendor/openai-php/client/src/Responses/StreamResponse.php(68): OpenAI\Responses\StreamResponse::getIterator
#4 /app/Http/Controllers/ChatController.php(54): App\Http\Controllers\ChatController::App\Http\Controllers\{closure}
#3 /vendor/symfony/http-foundation/StreamedResponse.php(106): Symfony\Component\HttpFoundation\StreamedResponse::sendContent
#2 /vendor/symfony/http-foundation/Response.php(398): Symfony\Component\HttpFoundation\Response::send
#1 /vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1172): Illuminate\Foundation\Application::handleRequest
#0 /public/index.php(17): null
Thanks for the quick fix @gehrisandro. I tested the code, but it's raising another error in the same file that you modified: "Undefined array key "input"
. I changed the line 48 to $attributes['input'] ?? ''
and it worked. But I feel something is off. For example, I have an assistant that always return text and an image in their responses, but when using streaming, the annotations
variable always come as an empty array, but I don't know if this has something to do with it. If I use the API to get the assistant messages after the streaming is over, then the annotations come correctly with the generated images.
Anyway, here's the stacktrace:
ErrorException: Undefined array key "input"
#15 /vendor/openai-php/client/src/Responses/Threads/Runs/Steps/ThreadRunStepResponseCodeInterpreter.php(48): Illuminate\Foundation\Bootstrap\HandleExceptions::handleError
#14 /vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(256): Illuminate\Foundation\Bootstrap\HandleExceptions::Illuminate\Foundation\Bootstrap\{closure}
#13 /vendor/openai-php/client/src/Responses/Threads/Runs/Steps/ThreadRunStepResponseCodeInterpreter.php(48): OpenAI\Responses\Threads\Runs\Steps\ThreadRunStepResponseCodeInterpreter::from
#12 /vendor/openai-php/client/src/Responses/Threads/Runs/Steps/ThreadRunStepResponseCodeToolCall.php(43): OpenAI\Responses\Threads\Runs\Steps\ThreadRunStepResponseCodeToolCall::from
#11 /vendor/openai-php/client/src/Responses/Threads/Runs/Steps/ThreadRunStepResponseToolCallsStepDetails.php(42): OpenAI\Responses\Threads\Runs\Steps\ThreadRunStepResponseToolCallsStepDetails::OpenAI\Responses\Threads\Runs\Steps\{closure}
#10 [internal](0): array_map
#9 /vendor/openai-php/client/src/Responses/Threads/Runs/Steps/ThreadRunStepResponseToolCallsStepDetails.php(40): OpenAI\Responses\Threads\Runs\Steps\ThreadRunStepResponseToolCallsStepDetails::from
#8 /vendor/openai-php/client/src/Responses/Threads/Runs/Steps/Delta/ThreadRunStepDeltaObject.php(39): OpenAI\Responses\Threads\Runs\Steps\Delta\ThreadRunStepDeltaObject::from
#7 /vendor/openai-php/client/src/Responses/Threads/Runs/Steps/Delta/ThreadRunStepDeltaResponse.php(40): OpenAI\Responses\Threads\Runs\Steps\Delta\ThreadRunStepDeltaResponse::from
#6 /vendor/openai-php/client/src/Responses/Threads/Runs/ThreadRunStreamResponse.php(63): OpenAI\Responses\Threads\Runs\ThreadRunStreamResponse::from
#5 /vendor/openai-php/client/src/Responses/StreamResponse.php(68): OpenAI\Responses\StreamResponse::getIterator
#4 /app/Http/Controllers/ChatController.php(54): App\Http\Controllers\ChatController::App\Http\Controllers\{closure}
#3 /vendor/symfony/http-foundation/StreamedResponse.php(106): Symfony\Component\HttpFoundation\StreamedResponse::sendContent
#2 /vendor/symfony/http-foundation/Response.php(398): Symfony\Component\HttpFoundation\Response::send
#1 /vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1172): Illuminate\Foundation\Application::handleRequest
#0 /public/index.php(17): null
Hi @arturspon
You are right. input
is optional too.
Going to fix this with the upcoming 0.10.x release.
Description
When sending a file to assistants in the last version and using streaming, it raises an exception with the following message: "Undefined array key "outputs".
Steps To Reproduce
1) Create an assistant; 2) Create a thread; 3) Create a message in the thread and stream the response, like below:
OpenAI PHP Client Version
v0.9.0
PHP Version
8.3.6
Notes
I was using the assistants streaming feature before it was released to the main branch, after it was released, some things changed and this behavior started to happen.