OkGoDoIt / OpenAI-API-dotnet

An unofficial C#/.NET SDK for accessing the OpenAI GPT-3 API
https://www.nuget.org/packages/OpenAI/
Other
1.83k stars 426 forks source link

Azure Chat completions incorrect path #81

Open JakobWl opened 1 year ago

JakobWl commented 1 year ago

I am having struggles to use chatgpt in azure somehow the chat endpoint results in this url: https://resourceName.openai.azure.com/openai/deployments/deploymentId/chat/completions?api-version=2022-12-01 Although i want this: https://resourceName.openai.azure.com/openai/deployments/deploymentId/completions?api-version=2022-12-01

Is there any reason behind this or am I not reading the documentation correctly?

knavet commented 1 year ago

Same. I'm getting a 404 / Resource not found error

JakobWl commented 1 year ago

@knavet due to azure using the /completions path rather than /chat/completion i ended up using the CompletionsEndpoint for this but this is obviously unintentional either on azures side or this wrappers

jeffclarenz commented 1 year ago

Setting the API version to 2023-03-15-preview fixed this for me

KimihikoSaito commented 1 year ago

You can use ChatML with completions (NOT chat) endpoint. https://learn.microsoft.com/en-us/azure/cognitive-services/openai/how-to/chatgpt?pivots=programming-language-chat-ml

Tom-CCC commented 1 year ago

I believe they just added an support for this. I had to manually change my API version to make it work though to "2023-03-25-preview"

api.ApiVersion = "2023-03-15-preview";

Read first sentence under "Chat Completions" here: https://learn.microsoft.com/en-us/azure/cognitive-services/openai/reference#chat-completions