Closed beliven-daniele-sarnari closed 1 month ago
On Azure, with Asynchronous Filter enabled, in the stream a different packet can exist and throw the following error:
ErrorException Undefined array key "delta" at vendor/openai-php/client/src/Responses/Chat/CreateStreamedResponseChoice.php:23 19▕ public static function from(array $attributes): self 20▕ { 21▕ return new self( 22▕ $attributes['index'], ➜ 23▕ CreateStreamedResponseDelta::from($attributes['delta']), 24▕ $attributes['finish_reason'] ?? null, 25▕ ); 26▕ } 27▕ +2 vendor frames 3 [internal]:0 OpenAI\Responses\Chat\CreateStreamedResponse::OpenAI\Responses\Chat\{closure}() +2 vendor frames
Normal packet:
array(3) { ["delta"]=> array(1) { ["content"]=> string(6) "amento" } ["finish_reason"]=> NULL ["index"]=> int(0) }
Asynchronous Filter packet:
array(4) { ["content_filter_offsets"]=> array(3) { ["check_offset"]=> int(61342) ["start_offset"]=> int(61342) ["end_offset"]=> int(62102) } ["content_filter_results"]=> array(4) { ["hate"]=> array(2) { ["filtered"]=> bool(false) ["severity"]=> string(4) "safe" } ["self_harm"]=> array(2) { ["filtered"]=> bool(false) ["severity"]=> string(4) "safe" } ["sexual"]=> array(2) { ["filtered"]=> bool(false) ["severity"]=> string(4) "safe" } ["violence"]=> array(2) { ["filtered"]=> bool(false) ["severity"]=> string(4) "safe" } } ["finish_reason"]=> NULL ["index"]=> int(0) }
https://github.com/openai-php/client/issues/407
Checkout discussion here: #407
What:
Description:
On Azure, with Asynchronous Filter enabled, in the stream a different packet can exist and throw the following error:
Normal packet:
Asynchronous Filter packet:
Related:
https://github.com/openai-php/client/issues/407