Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure - HTTP status code: NotFound. Content: {"error":{"code":"404","message": "Resource not found"}})' #179

Open
AlexGrossi opened this issue Nov 7, 2023 · 1 comment

Comments

@AlexGrossi
Copy link

I am trying to connect to Azure using OpenAIAPI. However, despite my deployment ID and resourcename being correct, I am encountering the following error:

System.AggregateException
'One or more errors occurred. (Error at images/generations (https://LSopenAIUS.openai.azure.com/openai/deployments/lasetestai/images/generations?api-version=2022-12-01) with HTTP status code: NotFound. Content: {"error":{"code":"404","message": "Resource not found"}})'

Inner Exception:
HttpRequestException: Error at images/generations (https://LSopenAIUS.openai.azure.com/openai/deployments/lasetestai/images/generations?api-version=2022-12-01) with HTTP status code: NotFound. Content: {"error":{"code":"404","message": "Resource not found"}}

The code

public void CreateImageWithUrl(string query)
        {
            OpenAIAPI api = OpenAIAPI.ForAzure(deployment, deploymentID, key);
            //OpenAIAPI api = new OpenAIAPI(testkey2);
            var results = api.ImageGenerations.CreateImageAsync(new ImageGenerationRequest(query, 1, ImageSize._256)).Result;

            Assert.That(results.Data.First().Url.Length > 0);
            Assert.That(results.Data.First().Url.StartsWith("https://"));
            Console.WriteLine(results.Data[0].Url);
        }

What I tried
I can confirm that deployment and deployment ID are correct. However, not much more testing can be conducted further until I understand what is causing this issue.

@OkGoDoIt
Copy link
Owner

OkGoDoIt commented Dec 7, 2023

I think you need to specify a more up to date Azure API version using api.ApiVersion = "2023-03-15-preview";, although as I don't have access to the Azure API it's hard for me to debug.
See https://github.com/OkGoDoIt/OpenAI-API-dotnet#azure for Azure details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants