From 34773212eafd9f93a1285fb8a185e8a4a412c89c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mats=20Fins=C3=A5s?= <12988459+Xtrah@users.noreply.github.com> Date: Sat, 5 Aug 2023 07:22:05 +0200 Subject: [PATCH] Azure OpenAI API fix for gpt-3.5-turbo-16k (#383) Signed-off-by: Xtrah <12988459+Xtrah@users.noreply.github.com> --- src/api/api.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/api/api.ts b/src/api/api.ts index 20073cf..68c308f 100644 --- a/src/api/api.ts +++ b/src/api/api.ts @@ -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}`; @@ -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}`;