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

Support for other api-versions for Azrue openai #564

Open
detrin opened this issue Mar 25, 2024 · 3 comments
Open

Support for other api-versions for Azrue openai #564

detrin opened this issue Mar 25, 2024 · 3 comments

Comments

@detrin
Copy link

detrin commented Mar 25, 2024

Right now I can not use endpoint with api-version=2024-02-15-preview looking at
https://learn.microsoft.com/en-us/azure/ai-services/openai/reference?WT.mc_id=AZ-MVP-5004796
I think the cod might be little bit outdated https://github.com/ztjhz/BetterChatGPT/blob/eb18479a6b32cde25cd61770e8f2cb971418db23/src/api/api.ts#L31C1-L45C1

@detrin
Copy link
Author

detrin commented Mar 25, 2024

maybe something like this?

const url = new URL(endpoint);

// Gets all query string value
const params = new URLSearchParams(url.search);

// Checking if api-version exist
if (params.has('api-version')) {
  // Getting api-version value and assigning it
  const apiVersion = params.get('api-version');
  console.log(apiVersion);
}

I checked the network tab and yes the request doesn't work when using custom azure endpoint, because it appends the whole path to it, making the URL invalid

@detrin
Copy link
Author

detrin commented Mar 25, 2024

I believe I know how to fix it, I will open PR

@detrin
Copy link
Author

detrin commented Mar 25, 2024

// according to https://learn.microsoft.com/en-us/azure/ai-services/openai/reference?WT.mc_id=AZ-MVP-5004796
  const apiVersions = [
    '2022-12-01',
    '2023-03-15-preview',
    '2023-05-15',
    '2023-06-01-preview',
    '2023-07-01-preview',
    '2023-08-01-preview',
    '2023-09-01-preview',
    '2023-10-01-preview',
    '2023-12-01-preview',
    '2024-02-15-preview',
    '2024-03-01-preview',
    '2024-02-01'
  ];

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

1 participant