-
-
Notifications
You must be signed in to change notification settings - Fork 636
Open
Labels
Non-OpenAI ModelNot an OpenAI Model.Not an OpenAI Model.bugSomething isn't workingSomething isn't working
Description
Description
I'm trying to use vision on Azure, this was working before.
It seems that Azure has changed the format of their response for the Vision endpoint.
I am creating the client with the factory etc. But since today the code that had been working has stopped working.
This results in the error Undefined array key "usage"
I'm running the latests version of the client.
Steps To Reproduce
$baseUri = 'https://tellet-azure-sweden.openai.azure.com/openai/deployments/tellet-gpt-4-vision-preview';
$client = OpenAI::factory()
->withBaseUri($baseUri)
->withHttpClient(new \GuzzleHttp\Client(['timeout' => 300, 'connect_timeout' => 300]))
->withHttpHeader('api-key', $apiKey)
->withQueryParam('api-version', '2023-12-01-preview')
->make();
$base64Image = $this->imageToBase64($image);
$encoded = 'data:image/jpeg;base64,'.$base64Image;
$imageArray[] = [
'type' => 'text',
'text' => 'Analyse this photograph and provide a detailed description of its contents. Focus on identifying and listing all visible items, with particular attention to food items present. '
];
$imageArray[] = [
'type' => 'image_url',
'image_url' => ['url' => $encoded]
];
$messagesArray = array();
$messagesArray[] = [
'role' => 'user',
'content' => $imageArray
];
$settings['messages'] = $messagesArray;
$settings['max_tokens'] = 1200;
$settings['messages'] = $messagesArray;
$response = $client->chat()->create($settings);
OpenAI PHP Client Version
v0.8.4
PHP Version
8.1
Notes
No response
Metadata
Metadata
Assignees
Labels
Non-OpenAI ModelNot an OpenAI Model.Not an OpenAI Model.bugSomething isn't workingSomething isn't working