From 5eeb2875b4e633bf80083ab1e41fb2de8f293aab Mon Sep 17 00:00:00 2001 From: khanon Date: Mon, 4 Nov 2024 18:20:19 +0000 Subject: [PATCH] adds haiku 3.5 --- src/proxy/anthropic.ts | 1 + src/proxy/aws-claude.ts | 8 +++++++- src/proxy/aws.ts | 1 + src/proxy/gcp.ts | 12 +++++++++--- src/shared/key-management/aws/checker.ts | 1 + 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/proxy/anthropic.ts b/src/proxy/anthropic.ts index 7a77569..a308757 100644 --- a/src/proxy/anthropic.ts +++ b/src/proxy/anthropic.ts @@ -36,6 +36,7 @@ const getModelsResponse = () => { "claude-2.0", "claude-2.1", "claude-3-haiku-20240307", + "claude-3-5-haiku-20241022", "claude-3-opus-20240229", "claude-3-opus-latest", "claude-3-sonnet-20240229", diff --git a/src/proxy/aws-claude.ts b/src/proxy/aws-claude.ts index fca43ac..57a592b 100644 --- a/src/proxy/aws-claude.ts +++ b/src/proxy/aws-claude.ts @@ -239,8 +239,14 @@ function maybeReassignModel(req: Request) { } break; case "haiku": + switch (rev) { + case "20241022": + case "latest": + req.body.model = "anthropic.claude-3-5-haiku-20241022-v1:0"; + return; + } case "opus": - // Add after model ids are announced late 2024 + // Add after model id is announced never break; } } diff --git a/src/proxy/aws.ts b/src/proxy/aws.ts index 0da6046..c64e551 100644 --- a/src/proxy/aws.ts +++ b/src/proxy/aws.ts @@ -40,6 +40,7 @@ function handleModelsRequest(req: Request, res: Response) { "anthropic.claude-v2", "anthropic.claude-v2:1", "anthropic.claude-3-haiku-20240307-v1:0", + "anthropic.claude-3-5-haiku-20241022-v1:0", "anthropic.claude-3-sonnet-20240229-v1:0", "anthropic.claude-3-5-sonnet-20240620-v1:0", "anthropic.claude-3-5-sonnet-20241022-v2:0", diff --git a/src/proxy/gcp.ts b/src/proxy/gcp.ts index b520169..0c2a67b 100644 --- a/src/proxy/gcp.ts +++ b/src/proxy/gcp.ts @@ -25,10 +25,11 @@ const getModelsResponse = () => { // https://docs.anthropic.com/en/docs/about-claude/models const variants = [ "claude-3-haiku@20240307", + "claude-3-5-haiku@20241022", "claude-3-sonnet@20240229", - "claude-3-opus@20240229", "claude-3-5-sonnet@20240620", - "claude-3-5-sonnet-v2@20241022" + "claude-3-5-sonnet-v2@20241022", + "claude-3-opus@20240229", ]; const models = variants.map((id) => ({ @@ -152,6 +153,7 @@ function maybeReassignModel(req: Request) { 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; switch (ver) { case "3": @@ -165,7 +167,11 @@ function maybeReassignModel(req: Request) { } return; case "3.5": - req.body.model = "claude-3-5-sonnet@20240620"; + 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"; + } return; } diff --git a/src/shared/key-management/aws/checker.ts b/src/shared/key-management/aws/checker.ts index dc76853..568b402 100644 --- a/src/shared/key-management/aws/checker.ts +++ b/src/shared/key-management/aws/checker.ts @@ -20,6 +20,7 @@ const KNOWN_MODEL_IDS: ModuleAliasTuple[] = [ ["anthropic.claude-v2", "anthropic.claude-v2:1"], ["anthropic.claude-3-sonnet-20240229-v1:0"], ["anthropic.claude-3-haiku-20240307-v1:0"], + ["anthropic.claude-3-5-haiku-20241022-v1:0"], ["anthropic.claude-3-opus-20240229-v1:0"], ["anthropic.claude-3-5-sonnet-20240620-v1:0"], ["anthropic.claude-3-5-sonnet-20241022-v2:0"],