From 262b402606f81065541915b5685ea63ab11817c1 Mon Sep 17 00:00:00 2001 From: Pawan Kumar Date: Sun, 14 May 2023 21:46:38 +0530 Subject: [PATCH] fix code to adjust max_tokens according to model selection (#263) --- api/app/clients/chatgpt-client.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/app/clients/chatgpt-client.js b/api/app/clients/chatgpt-client.js index bc18d1e67c..8269b1d28e 100644 --- a/api/app/clients/chatgpt-client.js +++ b/api/app/clients/chatgpt-client.js @@ -23,12 +23,13 @@ const askClient = async ({ }; const azure = process.env.AZURE_OPENAI_API_KEY ? true : false; - + const max_tokens = (model === "gpt-4") ? 7200 : (model === "gpt-4-32k") ? 31000 : 3071; const clientOptions = { reverseProxyUrl: process.env.OPENAI_REVERSE_PROXY || null, azure, modelOptions: { model: model, + max_tokens: max_tokens, temperature, top_p, presence_penalty,