continuedev / continue

⏩ Continue is the leading open-source AI code assistant. You can connect any models and any context to build custom autocomplete and chat experiences inside VS Code and JetBrains
https://docs.continue.dev/
Apache License 2.0
16.65k stars 1.3k forks source link

Azure Open AI not working with inline edit #1351

Closed majuansari closed 2 months ago

majuansari commented 4 months ago

Before submitting your bug report

Relevant environment info

- OS: MACOSX
- Continue: 0.0.46
- IDE: Jetbrains

Description

With Azure open ai config { "title": "Azure OpenAI", "provider": "openai", "model": "gpt-4o (v2024-05-13)", "apiBase": "https://xxxx.openai.azure.com", "engine": "gpt-4o", "apiVersion": "2024-02-01", "apiType": "azure", "apiKey": "" },

We are not able to do inline edit. Getting following error

Error: HTTP 400 Bad Request from https://majuoai-66.openai.azure.com/openai/deployments/gpt-4o/completions?api-version=2024-02-01 {"error":{"code":"OperationNotSupported","message":"The completion operation does not work with the specified model, gpt-4o. Please choose different model and try again. You can learn more about which models can be used with each operation here: https://go.microsoft.com/fwlink/?linkid=2197993."}}

To reproduce

Preset command + I and do inline edit . Every time this reproducible with the above config.

Log output

Error: HTTP 400 Bad Request from https://majuoai-66.openai.azure.com/openai/deployments/gpt-4o/completions?api-version=2024-02-01  {"error":{"code":"OperationNotSupported","message":"The completion operation does not work with the specified model, gpt-4o. Please choose different model and try again. You can learn more about which models can be used with each operation here: https://go.microsoft.com/fwlink/?linkid=2197993."}}
Tspm1eca commented 4 months ago

Continue format of the request sent is incorrect: https://github.com/continuedev/continue/issues/1350

mpaine-act commented 4 months ago

I get the same error when trying to use Completions playground with the only deployment as gpt-4o -- it is not a selectable deployment.

image

Also note the https://go.microsoft.com/fwlink/?linkid=2197993 link provided is stale, last updated in February.

majuansari commented 4 months ago

@mpaine-act if you look at the logs the API URL is https://majuoai-66.openai.azure.com/openai/deployments/gpt-4o/completions?api-version=2024-02-01 which is wrong

Instead of deployments/gpt4o/completions it should be

deployments/gpt-4o/chat/completion

chat is missed out in uri for some reason

majuansari commented 4 months ago

curl --location --request POST 'https://XX.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2024-02-15-preview' \ --header 'Content-Type: application/json' \ --header 'api-key: XXX' \ --data-raw '{ "messages": [{"role":"system","content":"You are an AI assistant that helps people find information."},{"role":"user","content":"Hi"}], "max_tokens": 800, "temperature": 0.7, "frequency_penalty": 0, "presence_penalty": 0, "top_p": 0.95, "stop": null }'

Just for reference this Curl API also returning value fine.

sestinj commented 2 months ago

@majuansari just made a fix here that should solve this in the next release

aritejhg commented 2 weeks ago

im not sure if that fixes that? The issue is at the URI not at the message received level. im still having this same issue (for vscode)