From 0837c89a426f57a915370e1b37bffac2e963006f Mon Sep 17 00:00:00 2001 From: nai-degen Date: Mon, 2 Oct 2023 03:53:04 -0500 Subject: [PATCH] fixes incorrect context size limit for aws claude v1 --- src/proxy/middleware/request/validate-context-size.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/proxy/middleware/request/validate-context-size.ts b/src/proxy/middleware/request/validate-context-size.ts index a0b04c8..2eb143c 100644 --- a/src/proxy/middleware/request/validate-context-size.ts +++ b/src/proxy/middleware/request/validate-context-size.ts @@ -48,11 +48,11 @@ export const validateContextSize: RequestPreprocessor = async (req) => { modelMax = 32768; } else if (model.match(/gpt-4/)) { modelMax = 8192; - } else if (model.match(/claude-(?:instant-)?v1(?:\.\d)?-100k/)) { + } else if (model.match(/^claude-(?:instant-)?v1(?:\.\d)?-100k/)) { modelMax = 100000; - } else if (model.match(/claude-(?:instant-)?v1(?:\.\d)?$/)) { + } else if (model.match(/^claude-(?:instant-)?v1(?:\.\d)?$/)) { modelMax = 9000; - } else if (model.match(/claude-2/)) { + } else if (model.match(/^claude-2/)) { modelMax = 100000; } else if (model.match(/^text-bison-\d{3}$/)) { modelMax = BISON_MAX_CONTEXT;