From 3496a2a9bdbd06fe2c7ca58f011d655c82ad8238 Mon Sep 17 00:00:00 2001 From: nai-degen Date: Tue, 3 Dec 2024 19:53:56 -0600 Subject: [PATCH] fixes incorrect 3.5 sonnet v2 model id in gcp model reassignment --- src/proxy/gcp.ts | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/proxy/gcp.ts b/src/proxy/gcp.ts index 0c2a67b..c831d07 100644 --- a/src/proxy/gcp.ts +++ b/src/proxy/gcp.ts @@ -151,7 +151,7 @@ function maybeReassignModel(req: Request) { return; } - const [_, _cl, instant, _v, major, _sep, minor, _ctx, name, _rev] = match; + const [_, _cl, instant, _v, major, _sep, minor, _ctx, name, rev] = match; // TODO: rework this to function similarly to aws-claude.ts maybeReassignModel const ver = minor ? `${major}.${minor}` : major; @@ -167,12 +167,25 @@ function maybeReassignModel(req: Request) { } return; case "3.5": - if (name.includes("sonnet")) { - req.body.model = "claude-3-5-sonnet@20241022"; - } else if (name.includes("haiku")) { - req.body.model = "claude-3-5-haiku@20241022"; + switch (name) { + case "sonnet": + switch (rev) { + case "20241022": + case "latest": + req.body.model = "claude-3-5-sonnet-v2@20241022"; + return; + case "20240620": + req.body.model = "claude-3-5-sonnet@20240620"; + return; + } + break; + case "haiku": + req.body.model = "claude-3-5-haiku@20241022"; + return; + case "opus": + // Add after model ids are announced late 2024 + break; } - return; } // Fallback to Claude3 Sonnet