From 00346360af73c29289703982a0787a282f9a07b5 Mon Sep 17 00:00:00 2001 From: nai-degen Date: Sun, 23 Jul 2023 20:13:38 -0500 Subject: [PATCH] fixes turbo-16k incompatibility --- src/proxy/middleware/request/check-context-size.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/proxy/middleware/request/check-context-size.ts b/src/proxy/middleware/request/check-context-size.ts index 20ad478..16e5db6 100644 --- a/src/proxy/middleware/request/check-context-size.ts +++ b/src/proxy/middleware/request/check-context-size.ts @@ -62,12 +62,14 @@ function validateContextSize(req: Request) { Number.MAX_SAFE_INTEGER; let modelMax = 0; - if (model.match(/gpt-3.5/)) { + if (model.match(/gpt-3.5-turbo-16k/)) { + modelMax = 16384; + } else if (model.match(/gpt-3.5-turbo/)) { modelMax = 4096; - } else if (model.match(/gpt-4/)) { - modelMax = 8192; } else if (model.match(/gpt-4-32k/)) { modelMax = 32768; + } else if (model.match(/gpt-4/)) { + modelMax = 8192; } else if (model.match(/claude-(?:instant-)?v1(?:\.\d)?(?:-100k)/)) { modelMax = 100000 * CLAUDE_TOKEN_LIMIT_ADJUSTMENT; } else if (model.match(/claude-(?:instant-)?v1(?:\.\d)?$/)) {