Skip to content

Commit

Permalink
Azure OpenAI API fix for gpt-3.5-turbo-16k (#383)
Browse files Browse the repository at this point in the history
Signed-off-by: Xtrah <[email protected]>
  • Loading branch information
Xtrah authored Aug 5, 2023
1 parent d0ddcfe commit 3477321
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ export const getChatCompletion = async (
if (isAzureEndpoint(endpoint) && apiKey) {
headers['api-key'] = apiKey;

const gpt3forAzure = 'gpt-35-turbo';
const model =
config.model === 'gpt-3.5-turbo' ? gpt3forAzure : config.model;
const model = config.model === 'gpt-3.5-turbo' ? 'gpt-35-turbo' : config.model === 'gpt-3.5-turbo-16k' ? 'gpt-35-turbo-16k' : config.model;

const apiVersion = '2023-03-15-preview';

const path = `openai/deployments/${model}/chat/completions?api-version=${apiVersion}`;
Expand Down Expand Up @@ -64,9 +63,8 @@ export const getChatCompletionStream = async (
if (isAzureEndpoint(endpoint) && apiKey) {
headers['api-key'] = apiKey;

const gpt3forAzure = 'gpt-35-turbo';
const model =
config.model === 'gpt-3.5-turbo' ? gpt3forAzure : config.model;
const model = config.model === 'gpt-3.5-turbo' ? 'gpt-35-turbo' : config.model === 'gpt-3.5-turbo-16k' ? 'gpt-35-turbo-16k' : config.model;

const apiVersion = '2023-03-15-preview';

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

0 comments on commit 3477321

Please sign in to comment.