From 740f6548a25f2deccd4d2ec5e7e4a3312435d050 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Wed, 8 Nov 2023 12:07:14 +0200 Subject: [PATCH] Increase timeouts of OAI out of quota requests --- public/scripts/openai.js | 2 +- server.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/public/scripts/openai.js b/public/scripts/openai.js index d42436b08..9420eb8c6 100644 --- a/public/scripts/openai.js +++ b/public/scripts/openai.js @@ -110,7 +110,7 @@ const max_4k = 4095; const max_8k = 8191; const max_16k = 16383; const max_32k = 32767; -const max_128k = 128 * 1024 - 1; +const max_128k = 128 * 1000; const scale_max = 8191; const claude_max = 9000; // We have a proper tokenizer, so theoretically could be larger (up to 9k) const palm2_max = 7500; // The real context window is 8192, spare some for padding due to using turbo tokenizer diff --git a/server.js b/server.js index 6ebe925b9..02aa7a1bd 100644 --- a/server.js +++ b/server.js @@ -3222,7 +3222,8 @@ app.post("/generate_openai", jsonParser, function (request, response_generate_op } else if (fetchResponse.status === 429 && retries > 0) { console.log(`Out of quota, retrying in ${Math.round(timeout / 1000)}s`); setTimeout(() => { - makeRequest(config, response_generate_openai, request, retries - 1); + timeout *= 2; + makeRequest(config, response_generate_openai, request, retries - 1, timeout); }, timeout); } else { await handleErrorResponse(fetchResponse);