Azure OpenAI API fix for gpt-3.5-turbo-16k (#383)

Signed-off-by: Xtrah <12988459+Xtrah@users.noreply.github.com>
This commit is contained in:
Mats Finsås 2023-08-05 07:22:05 +02:00 committed by GitHub
parent d0ddcfea6a
commit 34773212ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,9 +18,8 @@ export const getChatCompletion = async (
if (isAzureEndpoint(endpoint) && apiKey) { if (isAzureEndpoint(endpoint) && apiKey) {
headers['api-key'] = apiKey; headers['api-key'] = apiKey;
const gpt3forAzure = 'gpt-35-turbo'; 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 model =
config.model === 'gpt-3.5-turbo' ? gpt3forAzure : config.model;
const apiVersion = '2023-03-15-preview'; const apiVersion = '2023-03-15-preview';
const path = `openai/deployments/${model}/chat/completions?api-version=${apiVersion}`; const path = `openai/deployments/${model}/chat/completions?api-version=${apiVersion}`;
@ -64,9 +63,8 @@ export const getChatCompletionStream = async (
if (isAzureEndpoint(endpoint) && apiKey) { if (isAzureEndpoint(endpoint) && apiKey) {
headers['api-key'] = apiKey; headers['api-key'] = apiKey;
const gpt3forAzure = 'gpt-35-turbo'; 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 model =
config.model === 'gpt-3.5-turbo' ? gpt3forAzure : config.model;
const apiVersion = '2023-03-15-preview'; const apiVersion = '2023-03-15-preview';
const path = `openai/deployments/${model}/chat/completions?api-version=${apiVersion}`; const path = `openai/deployments/${model}/chat/completions?api-version=${apiVersion}`;