ai-genie / chatgpt-vscode

Your best AI pair programmer in VS Code
https://marketplace.visualstudio.com/items?itemName=genieai.chatgpt-vscode
ISC License
1.16k stars 72 forks source link

Unsupported data type error using Azure gpt-3.5-turbo #66

Closed makeneko closed 1 year ago

makeneko commented 1 year ago

Verify it's not a duplicate bug report

Describe the Bug

This bug is because the extension is accessing the wrong API URL.

According to microsoft's api reference, "Completions" is the same URL as "genieai.azure.url," but "Chat completions" is different from "genieai.azure.url." https://learn.microsoft.com/en-us/azure/cognitive-services/openai/reference

Completions:

POST https://{your-resource-name}.openai.azure.com/openai/deployments/{deployment-id}/completions?api-version={api-version}

Chat completions: (chat/ is in between)

POST https://{your-resource-name}.openai.azure.com/openai/deployments/{deployment-id}/chat/completions?api-version={api-version}

Please tell us if you have customized any of the extension settings or whether you are using the defaults.

"genieai.azure.url": "https://{our resource name}.openai.azure.com/openai/deployments/{our deployment name}/completions?api-version=2022-12-01"

Additional context

I can now respond to chats by rewriting "this. _ apiReverseProxyUrl" in extension.js to:

"https://{our resource name}.openai.azure.com/openai/deployments/{our deployment name}/chat/completions?api-version=2023-03-15-preview"
makeneko commented 1 year ago

I solved it myself. In the case of chatgpt 3.5 turbo on azure, I found that I just need to set the URL below.

"https://{our resource name}.openai.azure.com/openai/deployments/{our deployment name}/chat/completions?api-version=2023-03-15-preview"

YinAoXiong commented 1 year ago

I solved it myself. In the case of chatgpt 3.5 turbo on azure, I found that I just need to set the URL below.

"https://{our resource name}.openai.azure.com/openai/deployments/{our deployment name}/chat/completions?api-version=2023-03-15-preview"

Thank you very much, I have encountered the same problem.