openai-php / client

⚡️ OpenAI PHP is a supercharged community-maintained PHP API client that allows you to interact with OpenAI API.
MIT License
4.56k stars 466 forks source link

[Bug]: Images (Dall-e 3) method not working with Azure #358

Closed kukicado closed 1 month ago

kukicado commented 3 months ago

Description

Trying to create a custom factory to use Dall-e 3 with Azure does not work with the client library. It gives a "resource not found" error, although the resource exists and works with other client libraries.

Screenshot 2024-03-19 at 1 53 42 PM

Steps To Reproduce

1) Setup an Azure OpenAI factory:

$client = \OpenAI::factory() ->withBaseUri('{resource}.openai.azure.com/openai/deployments/{deployment-name}') ->withHttpHeader('api-key', 'XXXXX') ->withQueryParam('api-version', '2023-06-01-preview') ->make();

$response = $client->images()->create([
    'prompt' => 'a monkey eating a banana',
    'n' => 1,
    'size' => '1024x1024',
    //'response_format' => 'url',
]);

2) Try to run the route, get "resource not found" exception.

I have tried changing the base URI to {resource}.openai.azure.com as well and added deployment name in the create method, but the issue persists.

OpenAI PHP Client Version

^0.8.4

PHP Version

8.2.12

Notes

No response

berott commented 3 months ago

API-Version 2024-02-15-preview has helped for me!

gehrisandro commented 1 month ago

Hi @kukicado

This does not look like an error related to the package.

If you do not agree, feel free to reopen the issue.