OpenAI-DotNet: Default API version 2022-12-01 results in 404 on chat completion request for new Azure OpenAI deployments

Bug Report

Overview

By default, “2022-12-01” is used as the ApiVersion. However, this results in a 404 being returned from Azure OpenAI when the deployment was recently created. With the same setup and only setting ApiVersion to “2023-05-15”, a valid result is returned.

{
	"error": {
		"code": "404",
		"message": "Resource not found"
	}
}

To Reproduce

Steps to reproduce the behavior:

  1. Create a new OpenAIClient with only resourceName and deploymentId from Azure being set.
  2. Use the api.ChatEndpoint.GetCompletionAsync method to make a completion request

Expected behavior

It should work out of the box.

Screenshots

image image

Additional context

For the first basic tests, updating the ApiVersion seems to be no problem. However, in a quick search I could not find a diff between both API versions. Maybe this issue could be migrated into a generic “support API version 2023-05-15” feature support ticket?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 30 (30 by maintainers)

Commits related to this issue

Most upvoted comments

Some interesting things:

I think we have two options here:

a) make the API version for Azure credential setup a mandatory field. We might want to consider offering an Enum in the future.

b) go with the latest stable API version and hope for MS not to update the API a lot, and also not deprecate older versions too often (so that no 404 occurs, and also newer API versions are deployed automatically).

It would be helpful to have some insights from Microsoft on this topic. Without knowing this, perhaps it would be the best to document this now (like add a hint to the Azure setup section of this repo’s readme). Then let’s wait and observe how often Microsoft changes APIs (I don’t expect any changes without OpenAI adding new stuff to their API) and how the deal with backwards compatibility (more 404s or not).

Might be better off just using the official Azure OpenAI Client, tbh

The official package is way behind and does not offer nearly the features that this one does. I predict that the future will have 50% of the people using this package, using it on Azure OpenAI.

@sibbl I agree with everything you said…

I think we have two options here:

a) make the API version for Azure credential setup a mandatory field. We might want to consider offering an Enum in the future.

b) go with the latest stable API version and hope for MS not to update the API a lot, and also not deprecate older versions too often (so that no 404 occurs, and also newer API versions are deployed automatically).

I vote for option A 😃

Thanks for the links. Also, I found this:

Working with the ChatGPT models

image

And this:

API Key:

image

Azure Open AI is 3.30 times faster than OpenAI

I’m well aware

I just hate that the API surface isn’t smooth enough for this type of missmatch

@StephenHodgson as mentioned in my PR, the only diff between both spec files is the addition of the chat completion endpoint and the version change. For me, the endpoint is working as expected when using it with the latest Nuget version of this project.

Also, I think that either your option (recreate deployment) is a solution, or it works out of the box because Microsoft deployed the new version also for old deployments. I see no reason why they wouldn’t do this and also understand their “What’s new” hint box in that way.

But yes, I agree that specifying the API version might be the best solution for now. Maybe the Readme could aggregate supported API versions.

However, as the whole Microsoft Azure OpenAI is still in preview stage, I personally would kind of expect my application to break when updating dependencies anyway. But that’s just my personal opinion.

(also Syncfusion just finished tech edits on my book, expect a ton of traffic once it gets released because all examples use OpenAI-DotNet 😉)

If someone uses the “default value” it’s gonna eventually break when they update OpenAI-DotNet but their model in Azure is still an older version. (again, let me know if I am simply misunderstanding the issue!)

This is why you have to set this youself

This is what I mean. If you choose a different API version, then it would make sense you would get a 404 if you also don’t update the client to use the specified version.

So, there is no Bug, correct?

This is why you have to set this youself

This is what I mean. If you choose a different API version, then it would make sense you would get a 404 if you also don’t update the client to use the specified version.

So the default API version is no longer valid? Should be an easy update.

Would you mind making the necessary changes?