From 7df56170374da7ed497556bba2ef76ba9efdede3 Mon Sep 17 00:00:00 2001 From: yhx Date: Wed, 17 Apr 2024 14:22:01 +0800 Subject: [PATCH] Add support of anthropic.claude-3-opus-20240229-v1:0 model --- README.md | 4 +++- README_CN.md | 4 +++- src/api/models/bedrock.py | 3 ++- src/api/setting.py | 1 + 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 23ae4a2..d48ed21 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,8 @@ OpenAI-compatible RESTful APIs for Amazon Bedrock ## Overview -Amazon Bedrock offers a wide range of foundation models (such as Claude 3 Sonnet/Haiku, Llama 2, Mistral/Mixtral, etc.) and a broad set of capabilities for you to build generative AI applications. Check the [Amazon Bedrock](https://aws.amazon.com/bedrock) landing page for additional information. +Amazon Bedrock offers a wide range of foundation models (such as Claude 3 Opus/Sonnet/Haiku, Llama 2, Mistral/Mixtral, +etc.) and a broad set of capabilities for you to build generative AI applications. Check the [Amazon Bedrock](https://aws.amazon.com/bedrock) landing page for additional information. Sometimes, you might have applications developed using OpenAI APIs or SDKs, and you want to experiment with Amazon Bedrock without modifying your codebase. Or you may simply wish to evaluate the capabilities of these foundation models in tools like AutoGen etc. Well, this repository allows you to access Amazon Bedrock models seamlessly through OpenAI APIs and SDKs, enabling you to test these models without code changes. @@ -30,6 +31,7 @@ Supported Amazon Bedrock models (Model IDs): - anthropic.claude-instant-v1 - anthropic.claude-v2:1 - anthropic.claude-v2 +- anthropic.claude-3-opus-20240229-v1:0 - anthropic.claude-3-sonnet-20240229-v1:0 - anthropic.claude-3-haiku-20240307-v1:0 - meta.llama2-13b-chat-v1 diff --git a/README_CN.md b/README_CN.md index bdee1a7..2a6a868 100644 --- a/README_CN.md +++ b/README_CN.md @@ -6,7 +6,8 @@ ## 概述 -Amazon Bedrock提供了广泛的基础模型(如Claude 3 Sonnet/Haiku、Llama 2、Mistral/Mixtral等),以及构建生成式AI应用程序的多种功能。更多详细信息,请查看[Amazon Bedrock](https://aws.amazon.com/bedrock)。 +Amazon Bedrock提供了广泛的基础模型(如Claude 3 Opus/Sonnet/Haiku、Llama 2、Mistral/Mixtral等),以及构建生成式AI应用程序的多种功能。更多详细信息,请查看[Amazon +Bedrock](https://aws.amazon.com/bedrock)。 有时,您可能已经使用OpenAI的API或SDK构建了应用程序,并希望在不修改代码的情况下试用Amazon Bedrock的模型。或者,您可能只是希望在AutoGen等工具中评估这些基础模型的功能。 好消息是, 这里提供了一种方便的途径,让您可以使用 @@ -32,6 +33,7 @@ OpenAI 的 API 或 SDK 无缝集成并试用 Amazon Bedrock 的模型,而无需 - anthropic.claude-instant-v1 - anthropic.claude-v2:1 - anthropic.claude-v2 +- anthropic.claude-3-opus-20240229-v1:0 - anthropic.claude-3-sonnet-20240229-v1:0 - anthropic.claude-3-haiku-20240307-v1:0 - meta.llama2-13b-chat-v1 diff --git a/src/api/models/bedrock.py b/src/api/models/bedrock.py index f131179..c345725 100644 --- a/src/api/models/bedrock.py +++ b/src/api/models/bedrock.py @@ -44,6 +44,7 @@ SUPPORTED_BEDROCK_MODELS = { "anthropic.claude-v2:1": "Claude", "anthropic.claude-v2": "Claude", "anthropic.claude-3-sonnet-20240229-v1:0": "Claude 3 Sonnet", + "anthropic.claude-3-opus-20240229-v1:0": "Claude 3 Opus", "anthropic.claude-3-haiku-20240307-v1:0": "Claude 3 Haiku", "meta.llama2-13b-chat-v1": "Llama 2 Chat 13B", "meta.llama2-70b-chat-v1": "Llama 2 Chat 70B", @@ -738,7 +739,7 @@ def get_model(model_id: str) -> BedrockModel: model_name = SUPPORTED_BEDROCK_MODELS.get(model_id, "") if DEBUG: logger.info("model name is " + model_name) - if model_name in ["Claude Instant", "Claude", "Claude 3 Sonnet", "Claude 3 Haiku"]: + if model_name in ["Claude Instant", "Claude", "Claude 3 Sonnet", "Claude 3 Haiku", "Claude 3 Opus"]: return ClaudeModel() elif model_name in ["Llama 2 Chat 13B", "Llama 2 Chat 70B"]: return Llama2Model() diff --git a/src/api/setting.py b/src/api/setting.py index 453ff66..7924245 100644 --- a/src/api/setting.py +++ b/src/api/setting.py @@ -16,6 +16,7 @@ List of Amazon Bedrock models currently supported: - anthropic.claude-instant-v1 - anthropic.claude-v2:1 - anthropic.claude-v2 +- anthropic.claude-3-opus-20240229-v1:0 - anthropic.claude-3-sonnet-20240229-v1:0 - anthropic.claude-3-haiku-20240307-v1:0 - meta.llama2-13b-chat-v1