Skip to content

Commit

Permalink
update azure endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
ztjhz committed Nov 11, 2023
1 parent b25e5c1 commit 2e27f25
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@ export const getChatCompletion = async (
const modelmapping: Partial<Record<ModelOptions, string>> = {
'gpt-3.5-turbo': 'gpt-35-turbo',
'gpt-3.5-turbo-16k': 'gpt35-turbo-16k',
'gpt-4': 'gpt4-4',
'gpt-4-32k': 'gpt4-4-32k',
};

const model = modelmapping[config.model] || config.model;

// set api version to 2023-07-01-preview for gpt-4 and gpt-4-32k, otherwise use 2023-03-15-preview
const apiVersion =
model === 'gpt4-4' || model === 'gpt4-4-32k'
model === 'gpt-4' || model === 'gpt-4-32k'
? '2023-07-01-preview'
: '2023-03-15-preview';

Expand Down Expand Up @@ -77,15 +75,13 @@ export const getChatCompletionStream = async (
const modelmapping: Partial<Record<ModelOptions, string>> = {
'gpt-3.5-turbo': 'gpt-35-turbo',
'gpt-3.5-turbo-16k': 'gpt35-turbo-16k',
'gpt-4': 'gpt4-4',
'gpt-4-32k': 'gpt4-4-32k',
};

const model = modelmapping[config.model] || config.model;

// set api version to 2023-07-01-preview for gpt-4 and gpt-4-32k, otherwise use 2023-03-15-preview
const apiVersion =
model === 'gpt4-4' || model === 'gpt4-4-32k'
model === 'gpt-4' || model === 'gpt-4-32k'
? '2023-07-01-preview'
: '2023-03-15-preview';
const path = `openai/deployments/${model}/chat/completions?api-version=${apiVersion}`;
Expand Down

0 comments on commit 2e27f25

Please sign in to comment.