mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-04 21:00:40 +08:00
Merge pull request #781 from koid/feature/support-bedrock-claude3
added support for bedrock/claude3
This commit is contained in:
@ -162,8 +162,9 @@ To use Amazon Bedrock and its foundational models, add the below configuration:
|
|||||||
|
|
||||||
```
|
```
|
||||||
[config] # in configuration.toml
|
[config] # in configuration.toml
|
||||||
model = "anthropic.claude-v2"
|
model="bedrock/anthropic.claude-3-sonnet-20240229-v1:0"
|
||||||
fallback_models="anthropic.claude-instant-v1"
|
model_turbo="bedrock/anthropic.claude-3-sonnet-20240229-v1:0"
|
||||||
|
fallback_models=["bedrock/anthropic.claude-v2:1"]
|
||||||
|
|
||||||
[aws] # in .secrets.toml
|
[aws] # in .secrets.toml
|
||||||
bedrock_region = "us-east-1"
|
bedrock_region = "us-east-1"
|
||||||
@ -171,6 +172,12 @@ bedrock_region = "us-east-1"
|
|||||||
|
|
||||||
Note that you have to add access to foundational models before using them. Please refer to [this document](https://docs.aws.amazon.com/bedrock/latest/userguide/setting-up.html) for more details.
|
Note that you have to add access to foundational models before using them. Please refer to [this document](https://docs.aws.amazon.com/bedrock/latest/userguide/setting-up.html) for more details.
|
||||||
|
|
||||||
|
If you are using the claude-3 model, please configure the following settings as there are parameters incompatible with claude-3.
|
||||||
|
```
|
||||||
|
[litellm]
|
||||||
|
drop_params = true
|
||||||
|
```
|
||||||
|
|
||||||
AWS session is automatically authenticated from your environment, but you can also explicitly set `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables.
|
AWS session is automatically authenticated from your environment, but you can also explicitly set `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables.
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,4 +23,9 @@ MAX_TOKENS = {
|
|||||||
'anthropic.claude-v1': 100000,
|
'anthropic.claude-v1': 100000,
|
||||||
'anthropic.claude-v2': 100000,
|
'anthropic.claude-v2': 100000,
|
||||||
'anthropic/claude-3-opus-20240229': 100000,
|
'anthropic/claude-3-opus-20240229': 100000,
|
||||||
|
'bedrock/anthropic.claude-instant-v1': 100000,
|
||||||
|
'bedrock/anthropic.claude-v2': 100000,
|
||||||
|
'bedrock/anthropic.claude-v2:1': 100000,
|
||||||
|
'bedrock/anthropic.claude-3-sonnet-20240229-v1:0': 100000,
|
||||||
|
'bedrock/anthropic.claude-3-haiku-20240307-v1:0': 100000,
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,8 @@ class LiteLLMAIHandler(BaseAiHandler):
|
|||||||
assert litellm_token, "LITELLM_TOKEN is required"
|
assert litellm_token, "LITELLM_TOKEN is required"
|
||||||
os.environ["LITELLM_TOKEN"] = litellm_token
|
os.environ["LITELLM_TOKEN"] = litellm_token
|
||||||
litellm.use_client = True
|
litellm.use_client = True
|
||||||
|
if get_settings().get("LITELLM.DROP_PARAMS", None):
|
||||||
|
litellm.drop_params = get_settings().litellm.drop_params
|
||||||
if get_settings().get("OPENAI.ORG", None):
|
if get_settings().get("OPENAI.ORG", None):
|
||||||
litellm.organization = get_settings().openai.org
|
litellm.organization = get_settings().openai.org
|
||||||
if get_settings().get("OPENAI.API_TYPE", None):
|
if get_settings().get("OPENAI.API_TYPE", None):
|
||||||
@ -68,6 +70,7 @@ class LiteLLMAIHandler(BaseAiHandler):
|
|||||||
)
|
)
|
||||||
if get_settings().get("AWS.BEDROCK_REGION", None):
|
if get_settings().get("AWS.BEDROCK_REGION", None):
|
||||||
litellm.AmazonAnthropicConfig.max_tokens_to_sample = 2000
|
litellm.AmazonAnthropicConfig.max_tokens_to_sample = 2000
|
||||||
|
litellm.AmazonAnthropicClaude3Config.max_tokens = 2000
|
||||||
self.aws_bedrock_client = boto3.client(
|
self.aws_bedrock_client = boto3.client(
|
||||||
service_name="bedrock-runtime",
|
service_name="bedrock-runtime",
|
||||||
region_name=get_settings().aws.bedrock_region,
|
region_name=get_settings().aws.bedrock_region,
|
||||||
|
@ -193,6 +193,7 @@ url = ""
|
|||||||
|
|
||||||
[litellm]
|
[litellm]
|
||||||
# use_client = false
|
# use_client = false
|
||||||
|
# drop_params = false
|
||||||
|
|
||||||
[pr_similar_issue]
|
[pr_similar_issue]
|
||||||
skip_comments = false
|
skip_comments = false
|
||||||
|
@ -9,7 +9,7 @@ GitPython==3.1.32
|
|||||||
google-cloud-aiplatform==1.35.0
|
google-cloud-aiplatform==1.35.0
|
||||||
google-cloud-storage==2.10.0
|
google-cloud-storage==2.10.0
|
||||||
Jinja2==3.1.2
|
Jinja2==3.1.2
|
||||||
litellm==1.29.1
|
litellm==1.31.10
|
||||||
loguru==0.7.2
|
loguru==0.7.2
|
||||||
msrest==0.7.1
|
msrest==0.7.1
|
||||||
openai==1.13.3
|
openai==1.13.3
|
||||||
|
Reference in New Issue
Block a user