From fae45aaa1eb3b7a9f06ef5decfd32084dd3d980a Mon Sep 17 00:00:00 2001 From: Gabriel Koo Date: Fri, 21 Jun 2024 06:09:38 +0800 Subject: [PATCH] feat: add support for Sonnet 3.5 (#387) Co-authored-by: Gabriel Koo --- README.md | 2 +- backend/app/bedrock.py | 2 ++ backend/app/config.py | 2 ++ backend/app/routes/schemas/conversation.py | 1 + backend/app/usecases/chat.py | 1 + docs/README_ja.md | 2 +- frontend/src/@types/conversation.d.ts | 1 + frontend/src/hooks/useModel.ts | 5 +++++ 8 files changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index db7d03641..9fd2b80d6 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ By using the [Agent functionality](./docs/AGENT.md), your chatbot can automatica ## πŸš€ Super-easy Deployment -- In the us-east-1 region, open [Bedrock Model access](https://us-east-1.console.aws.amazon.com/bedrock/home?region=us-east-1#/modelaccess) > `Manage model access` > Check `Anthropic / Claude 3 Haiku`, `Anthropic / Claude 3 Sonnet` and `Cohere / Embed Multilingual` then `Save changes`. +- In the us-east-1 region, open [Bedrock Model access](https://us-east-1.console.aws.amazon.com/bedrock/home?region=us-east-1#/modelaccess) > `Manage model access` > Check `Anthropic / Claude 3 Haiku`, `Anthropic / Claude 3 Sonnet`, `Anthropic / Claude 3.5 Sonnet` and `Cohere / Embed Multilingual` then `Save changes`.
Screenshot diff --git a/backend/app/bedrock.py b/backend/app/bedrock.py index 38566aca5..72a9dec22 100644 --- a/backend/app/bedrock.py +++ b/backend/app/bedrock.py @@ -181,6 +181,8 @@ def get_model_id(model: str) -> str: return "anthropic.claude-3-haiku-20240307-v1:0" elif model == "claude-v3-opus": return "anthropic.claude-3-opus-20240229-v1:0" + elif model == "claude-v3.5-sonnet": + return "anthropic.claude-3-5-sonnet-20240620-v1:0" elif model == "mistral-7b-instruct": return "mistral.mistral-7b-instruct-v0:2" elif model == "mixtral-8x7b-instruct": diff --git a/backend/app/config.py b/backend/app/config.py index 4446fa479..9541af0d6 100644 --- a/backend/app/config.py +++ b/backend/app/config.py @@ -66,6 +66,7 @@ class EmbeddingConfig(TypedDict): }, "claude-v3-haiku": {"input": 0.00025, "output": 0.00125}, "claude-v3-sonnet": {"input": 0.00300, "output": 0.01500}, + "claude-v3.5-sonnet": {"input": 0.00300, "output": 0.01500}, "mistral-7b-instruct": {"input": 0.00015, "output": 0.0002}, "mixtral-8x7b-instruct": {"input": 0.00045, "output": 0.0007}, "mistral-large": {"input": 0.008, "output": 0.024}, @@ -106,6 +107,7 @@ class EmbeddingConfig(TypedDict): }, "claude-v3-haiku": {"input": 0.00025, "output": 0.00125}, "claude-v3-sonnet": {"input": 0.00300, "output": 0.01500}, + "claude-v3.5-sonnet": {"input": 0.00300, "output": 0.01500}, "claude-v3-opus": {"input": 0.01500, "output": 0.07500}, "mistral-7b-instruct": {"input": 0.00015, "output": 0.0002}, "mixtral-8x7b-instruct": {"input": 0.00045, "output": 0.0007}, diff --git a/backend/app/routes/schemas/conversation.py b/backend/app/routes/schemas/conversation.py index 5222b1dba..994f08d58 100644 --- a/backend/app/routes/schemas/conversation.py +++ b/backend/app/routes/schemas/conversation.py @@ -7,6 +7,7 @@ "claude-instant-v1", "claude-v2", "claude-v3-sonnet", + "claude-v3.5-sonnet", "claude-v3-haiku", "claude-v3-opus", "mistral-7b-instruct", diff --git a/backend/app/usecases/chat.py b/backend/app/usecases/chat.py index ad0481545..e6bd5ee42 100644 --- a/backend/app/usecases/chat.py +++ b/backend/app/usecases/chat.py @@ -456,6 +456,7 @@ def propose_conversation_title( "claude-v2", "claude-v3-opus", "claude-v3-sonnet", + "claude-v3.5-sonnet", "claude-v3-haiku", "mistral-7b-instruct", "mixtral-8x7b-instruct", diff --git a/docs/README_ja.md b/docs/README_ja.md index 127a676fd..f15d4a0b3 100644 --- a/docs/README_ja.md +++ b/docs/README_ja.md @@ -34,7 +34,7 @@ ## πŸš€ γΎγšγ―γŠθ©¦γ— -- us-east-1 γƒͺージョンにて、[Bedrock Model access](https://us-east-1.console.aws.amazon.com/bedrock/home?region=us-east-1#/modelaccess) > `Manage model access` > `Anthropic / Claude 3 Haiku`, `Anthropic / Claude 3 Sonnet` `Cohere / Embed Multilingual`をチェックし、`Save changes`γ‚’γ‚―γƒͺックします +- us-east-1 γƒͺージョンにて、[Bedrock Model access](https://us-east-1.console.aws.amazon.com/bedrock/home?region=us-east-1#/modelaccess) > `Manage model access` > `Anthropic / Claude 3 Haiku`, `Anthropic / Claude 3 Sonnet`, `Anthropic / Claude 3.5 Sonnet` `Cohere / Embed Multilingual`をチェックし、`Save changes`γ‚’γ‚―γƒͺックします
γ‚Ήγ‚―γƒͺγƒΌγƒ³γ‚·γƒ§γƒƒγƒˆ diff --git a/frontend/src/@types/conversation.d.ts b/frontend/src/@types/conversation.d.ts index 8fc5324bb..bb26c704b 100644 --- a/frontend/src/@types/conversation.d.ts +++ b/frontend/src/@types/conversation.d.ts @@ -4,6 +4,7 @@ export type Model = | 'claude-v2' | 'claude-v3-opus' | 'claude-v3-sonnet' + | 'claude-v3.5-sonnet' | 'claude-v3-haiku' | 'mistral-7b-instruct' | 'mixtral-8x7b-instruct' diff --git a/frontend/src/hooks/useModel.ts b/frontend/src/hooks/useModel.ts index e8013d69d..ae233a194 100644 --- a/frontend/src/hooks/useModel.ts +++ b/frontend/src/hooks/useModel.ts @@ -18,6 +18,11 @@ const availableModels: { label: 'Claude 3 (Sonnet)', supportMediaType: ['image/jpeg', 'image/png', 'image/gif', 'image/webp'], }, + { + modelId: 'claude-v3.5-sonnet', + label: 'Claude 3.5 (Sonnet)', + supportMediaType: ['image/jpeg', 'image/png', 'image/gif', 'image/webp'], + }, { modelId: 'claude-v3-opus', label: 'Claude 3 (Opus)',