From 3f66a1f0c970c39bd92d362f757206eb10fcac2d Mon Sep 17 00:00:00 2001 From: koid Date: Wed, 13 Mar 2024 11:10:19 +0900 Subject: [PATCH 1/7] update litellm --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 4d6daa93a..6646b2e5d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,7 @@ GitPython==3.1.32 google-cloud-aiplatform==1.35.0 google-cloud-storage==2.10.0 Jinja2==3.1.2 -litellm==1.29.1 +litellm==1.29.7 loguru==0.7.2 msrest==0.7.1 openai==1.13.3 From d62796ac681684fae8407222a6f5b26a5c5990ef Mon Sep 17 00:00:00 2001 From: koid Date: Wed, 13 Mar 2024 11:14:04 +0900 Subject: [PATCH 2/7] update max_tokens --- pr_agent/algo/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pr_agent/algo/__init__.py b/pr_agent/algo/__init__.py index 7c537e3a1..cd5354163 100644 --- a/pr_agent/algo/__init__.py +++ b/pr_agent/algo/__init__.py @@ -23,4 +23,8 @@ 'anthropic.claude-v1': 100000, 'anthropic.claude-v2': 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, } From 1ed2cd064ab364fa758567528d9933cc175c2402 Mon Sep 17 00:00:00 2001 From: koid Date: Wed, 13 Mar 2024 11:20:02 +0900 Subject: [PATCH 3/7] add config litellm.drop_params --- pr_agent/algo/ai_handlers/litellm_ai_handler.py | 2 ++ pr_agent/settings/configuration.toml | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pr_agent/algo/ai_handlers/litellm_ai_handler.py b/pr_agent/algo/ai_handlers/litellm_ai_handler.py index 51f72960e..5107c74bd 100644 --- a/pr_agent/algo/ai_handlers/litellm_ai_handler.py +++ b/pr_agent/algo/ai_handlers/litellm_ai_handler.py @@ -36,6 +36,8 @@ def __init__(self): assert litellm_token, "LITELLM_TOKEN is required" os.environ["LITELLM_TOKEN"] = litellm_token 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): litellm.organization = get_settings().openai.org if get_settings().get("OPENAI.API_TYPE", None): diff --git a/pr_agent/settings/configuration.toml b/pr_agent/settings/configuration.toml index b5a0dab1d..c3861bb00 100644 --- a/pr_agent/settings/configuration.toml +++ b/pr_agent/settings/configuration.toml @@ -192,7 +192,8 @@ pr_commands = [ url = "" [litellm] -#use_client = false +# use_client = false +# drop_params = false [pr_similar_issue] skip_comments = false From f94a0fd7046fa36836958ddb6de86b167259fd4e Mon Sep 17 00:00:00 2001 From: koid Date: Wed, 13 Mar 2024 11:24:51 +0900 Subject: [PATCH 4/7] add Claude3Config --- pr_agent/algo/ai_handlers/litellm_ai_handler.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pr_agent/algo/ai_handlers/litellm_ai_handler.py b/pr_agent/algo/ai_handlers/litellm_ai_handler.py index 5107c74bd..1c78c09d5 100644 --- a/pr_agent/algo/ai_handlers/litellm_ai_handler.py +++ b/pr_agent/algo/ai_handlers/litellm_ai_handler.py @@ -70,6 +70,7 @@ def __init__(self): ) if get_settings().get("AWS.BEDROCK_REGION", None): litellm.AmazonAnthropicConfig.max_tokens_to_sample = 2000 + litellm.AmazonAnthropicClaude3Config.max_tokens = 2000 self.aws_bedrock_client = boto3.client( service_name="bedrock-runtime", region_name=get_settings().aws.bedrock_region, From 33d2d78bbca5a2640ccdbd82a8606db6c72eb0d8 Mon Sep 17 00:00:00 2001 From: koid Date: Wed, 13 Mar 2024 11:34:54 +0900 Subject: [PATCH 5/7] update docs --- docs/docs/usage-guide/additional_configurations.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/docs/usage-guide/additional_configurations.md b/docs/docs/usage-guide/additional_configurations.md index 4a6224bd2..dbdd1ed42 100644 --- a/docs/docs/usage-guide/additional_configurations.md +++ b/docs/docs/usage-guide/additional_configurations.md @@ -162,8 +162,9 @@ To use Amazon Bedrock and its foundational models, add the below configuration: ``` [config] # in configuration.toml -model = "anthropic.claude-v2" -fallback_models="anthropic.claude-instant-v1" +model="bedrock/anthropic.claude-3-sonnet-20240229-v1:0" +model_turbo="bedrock/anthropic.claude-3-sonnet-20240229-v1:0" +fallback_models=["bedrock/anthropic.claude-v2:1"] [aws] # in .secrets.toml bedrock_region = "us-east-1" From 0cdd3bf43694df98a227e24aaefe779f636c3113 Mon Sep 17 00:00:00 2001 From: koid Date: Wed, 13 Mar 2024 14:23:57 +0900 Subject: [PATCH 6/7] update docs --- docs/docs/usage-guide/additional_configurations.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/docs/usage-guide/additional_configurations.md b/docs/docs/usage-guide/additional_configurations.md index dbdd1ed42..1a7562520 100644 --- a/docs/docs/usage-guide/additional_configurations.md +++ b/docs/docs/usage-guide/additional_configurations.md @@ -172,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. +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. From 3bae515e39b886194ff48e15897c07a691440997 Mon Sep 17 00:00:00 2001 From: koid Date: Thu, 14 Mar 2024 16:58:44 +0900 Subject: [PATCH 7/7] add claude-3-haiku --- pr_agent/algo/__init__.py | 1 + requirements.txt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pr_agent/algo/__init__.py b/pr_agent/algo/__init__.py index cd5354163..9e05ed9f8 100644 --- a/pr_agent/algo/__init__.py +++ b/pr_agent/algo/__init__.py @@ -27,4 +27,5 @@ '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, } diff --git a/requirements.txt b/requirements.txt index 6646b2e5d..97df2f93f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,7 @@ GitPython==3.1.32 google-cloud-aiplatform==1.35.0 google-cloud-storage==2.10.0 Jinja2==3.1.2 -litellm==1.29.7 +litellm==1.31.10 loguru==0.7.2 msrest==0.7.1 openai==1.13.3