Closed ivanuccle closed 10 months ago
try { $result = $client->chat()->createStreamed([ 'model' => "gpt-4-vision-preview",//$openai_model, 'messages' => $messages ]); foreach ($result as $response) { error_log(json_encode(['message' => $response])); echo "event: data\n"; echo "data: " . json_encode(['message' => $response->choices[0]->delta->content]) . "\n\n"; flush(); } echo "event: stop\n"; echo "data: stopped\n\n"; } catch (Exception $e) { error_log($e->getMessage()); }
This code is working with gpt-4-1106-preview but not working gpt-4-vision-preview. Error: Undefined array key "finish_reason". Please help me asap.
gpt-4-1106-preview
gpt-4-vision-preview
Undefined array key "finish_reason".
Hi @prosedev
You are probably not using the latest version of the library. Please update.
If this does not solve your problem, please let me know.
Thanks.
Message ID: @.*** com>
This code is working with
gpt-4-1106-preview
but not workinggpt-4-vision-preview
. Error:Undefined array key "finish_reason".
Please help me asap.