Closed sibbl closed 1 year ago
So the default API version is no longer valid? Should be an easy update.
Would you mind making the necessary changes?
I am a bit concerned about the fact that Azure is giving a 404. I wonder why they don't keep it when all the docs still consider it "stable"
I'm wondering if Azure is defaulting to the latest API version (which idk why they don't just actually version it with semver instead of this datetime crap)
My understanding is deploymentId is specific to each Azure Tenant. There is no "Global Deployment Id". This is why you have to set this youself:
or am I 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.
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?
I don't think so, but it prob doesn't hurt to bump the default API version
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!)
Hmm this is a good point
(also Syncfusion just finished tech edits on my book, expect a ton of traffic once it gets released because all examples use OpenAI-DotNet 😉)
@sibbl I kinda agree with @ADefWebserver. This may be a breaking change. You should update your client settings to specify the api version you are targeting.
@ADefWebserver @StephenHodgson I also thought about this before committing, but as far as I understand the MS docs, older deployments will also be available out of the box with the new API version. They just don't deploy new deployments under the old API version.
I'm referring to their "What's new in Azure OpenAI" page.
If you are currently using the 2023-03-15-preview API, we recommend migrating to the GA 2023-05-15 API. If you are currently using API version 2022-12-01 this API remains GA, but does not include the latest Chat Completion capabilities.
Maybe somebody with older deployments on Azure can confirm this?
Technically speaking, I compared the Swagger docs of the Azure APIs (see the links to them in my PR) and the old deployments shouldn't even have support for chat completion at all... so basically everything is still in preview anyway.
@sibbl - My "hope" is that what is required is to:
DeploymentId
in the connection settings for OpenAI-DotNetyeah I think the real fix here is just to make sure you specify your apiVersion when setting up the client:
var auth = new OpenAIAuthentication("sk-apiKey");
var settings = new OpenAIClientSettings(resourceName: "your-resource-name", deploymentId: "deployment-id", apiVersion: "2023-03-15-preview");
var api = new OpenAIClient(auth, settings);
I compared the Swagger docs of the Azure APIs
Now we do likely need to update the api to utilize some of the new changes in the schema. I did do a diff myself just to see. Only really interesting thing is the chat extensions (likely similar to the OpenAI plugins), but I'm unsure how much I want to try and support that. Might be better off just using the official Azure OpenAI Client, tbh.
I started this project over 2 years ago, long before the Azure OpenAI offerings.
@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.
No worries, I appreciate your support for my project!
If you'd like to update any support for future Azure offerings, please go ahead and submit a PR. I do not have access so cannot verify for myself unfortunately
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.
or it works out of the box because Microsoft deployed the new version also for old deployments.
I 'think' (I could be wrong) that if we don't use this option that wont happen?
@ADefWebserver this drop-down refers to the model version - not the API version. Like when a new model version of gpt-3.5 will be released, you can update from the 0301 to the new one using this dropdown.
Afaik one cannot see or control the API version anywhere in the UI.
But do you have a chat completion deployment from April or earlier and can test whether the 2023-05-15 version also works out of the box for this older deployment?
I don't like how different and difficult MSFT has made it tbh. I don't understand why the API surface is so different from the OpenAI offering.
But do you have a chat completion deployment from April or earlier and can test whether the 2023-05-15 version also works out of the box for this older deployment?
Yeah I see your point.
I have a deployment:
https://{my-resource-name}.openai.azure.com/openai/deployments/GPT35Turbo-0301/completions?api-version=2022-12-01
I use these values:
"ApiKey": "{my API Key}"
"ResourceName": "{my-resource-name}"
"DeploymentId": "GPT35Turbo-0301"
"ApiVersion": "2022-12-01"
I update to the latest OpenAI-DotNet
and I get:
GetCompletionAsync Failed! HTTP status code: NotFound | Response body: {"error":{"code":"404","message": "Resource not found"}}
However if I go to the Chat section in Azure OpenAI (as opposed to the Completions section):
I see this deployment URL:
https://{my-resource-name}.openai.azure.com/openai/deployments/GPT35Turbo-0301/chat/completions?api-version=2023-03-15-preview
I use these values:
"ApiKey": "{my API Key}"
"ResourceName": "{my-resource-name}"
"DeploymentId": "GPT35Turbo-0301"
"ApiVersion": "2023-03-15-preview"
I update to the latest OpenAI-DotNet and it works!
@sibbl I think that api-version=2022-12-01
that only shows up on the Completions (/completions) section in Azure OpenAI not the Chat (/chat/completions) section, is invalid when calling the Chat API?
I think this is what the issue is?
I don't like how different and difficult MSFT has made it tbh. I don't understand why the API surface is so different from the OpenAI offering.
I actually consider this a feature 😎
Microsoft Azure OpenAI allows you to have your own deployments and manage the quota and scaling per deployment. I think this is what is required for true enterprise deployments. OpenAI's offering is-not-that.
(of course I am sure there is 'shared' resources at some point because that is how the cloud works...)
I just hate that the API surface isn't smooth enough for this type of missmatch
calling GPT-3.5-turbo is much faster on an Azure Open AI deployment...
Azure Open AI is 3.30 times faster than OpenAI
Azure Open AI is 3.30 times faster than OpenAI
I'm well aware
Some interesting things:
2023-05-15-preview
hardcoded as their default version (see source code2023-05-15-preview
is still being used multiple weeks after making 2023-05-15
generally available (see their Whats's new page).2023-05-15
integration into their Nuget package: https://github.com/Azure/azure-sdk-for-net/issues/36442I 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).
@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
And this:
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.
To Reproduce
Steps to reproduce the behavior:
OpenAIClient
with only resourceName and deploymentId from Azure being set.api.ChatEndpoint.GetCompletionAsync
method to make a completion requestExpected behavior
It should work out of the box.
Screenshots
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?