Closed gofortiss closed 8 months ago
something like this : $binaryData = file_get_contents($imagePath);
$base64EncodedImage = base64_encode($binaryData);
$openaiResponse = OpenAI::chat()->create([
'model' => 'gpt-4-vision-preview',
"messages" => [
[
"role" => "user",
"content" => [
["type" => "text", "text" => "What’s in this image?"],
[
"type" => "image_url",
"image_url" => "data:image/jpeg;base64,{$base64EncodedImage}"
],
],
]
],
"max_tokens" => 300
]);
Thanky @gofortiss, this should work.
As an alternative you can pass an URL for the image like "https://example.com/image.jpg".
More details in the official OpenAI docs: https://platform.openai.com/docs/guides/vision/quick-start
Hello !
Can you update the doc to add gpt-4-vision-preview ?