Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure OpenAI API don't work #296

Open
othmanelhoufi opened this issue May 12, 2023 · 6 comments
Open

Azure OpenAI API don't work #296

othmanelhoufi opened this issue May 12, 2023 · 6 comments

Comments

@othmanelhoufi
Copy link
Contributor

I added the Azure OpenAI Endpoint and Key but get an error:

Message from Better ChatGPT:
Invalid API endpoint! We recommend you to check your free API endpoint.

And I'm sure that my credentials are correct.

@othmanelhoufi
Copy link
Contributor Author

I just fixed the problem in my fork.
Basically you don't take into account the fact that the HTTP request link for Azure OpenAI is different from OpenAI (https://learn.microsoft.com/en-us/azure/cognitive-services/openai/reference):

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

As you can see, there are informations about the model used as well as the api version in the HTTP link, so the endpoint only is not enough.

By the way, thank you for this incredible UI !
I hope my solution can help you improve it :)

@llegomark
Copy link
Contributor

For instance, the deployment ID you have created in the OAI Azure Dashboard must match with the deployment ID in betterchatgpt:

chrome_screenshot_oai azure com

const gpt3forAzure = 'gpt35turbo'; // deployment id
const model =
  config.model === 'gpt-3.5-turbo' ? gpt3forAzure : config.model;
const apiVersion = '2023-05-15';

@othmanelhoufi
Copy link
Contributor Author

You could do a mapping on deployment names to BetterGPT model names in your own fork. Or, to make it even simpler, change the deployment names in your OAI Azure Dashboard.
The idea is to have consistency in the naming.

The actual problem that was solved was about the API Request link that was not well implemented in the code. But now it works fine.

@detrin
Copy link

detrin commented Mar 25, 2024

I have the same issue, is there any plan to fix this?

@detrin
Copy link

detrin commented Mar 25, 2024

Looking at the code I think I know where there could be an issue

if (!endpoint.endsWith(path)) {
here we see that the endpoint must end with correct API version

const path = `openai/deployments/${model}/chat/completions?api-version=${apiVersion}`

but I have '2024-02-15-preview' where as in the code we see

const apiVersion =
      model === 'gpt-4' || model === 'gpt-4-32k'
        ? '2023-07-01-preview'
        : '2023-03-15-preview';

@detrin
Copy link

detrin commented Mar 25, 2024

https://learn.microsoft.com/en-us/azure/ai-services/openai/reference?WT.mc_id=AZ-MVP-5004796 yeah so there are many versions, that are not supported by BetterChatGPT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants