From 298a3574f4ceecae02bde28d671b740a1e777e65 Mon Sep 17 00:00:00 2001 From: "Ruperto A. Martinez" Date: Thu, 1 May 2025 17:56:54 -0400 Subject: [PATCH] Add supports_pdf_input: true to Claude 3.7 bedrock models (#9917) * Add supports_pdf_input: true to Claude 3.7 bedrock models * update unit test --------- Co-authored-by: RupertoXTI --- litellm/__init__.py | 1 + .../model_prices_and_context_window_backup.json | 2 ++ model_prices_and_context_window.json | 2 ++ tests/litellm_utils_tests/test_utils.py | 16 +++++++++++++++- .../local_testing/whitelisted_bedrock_models.txt | 1 + 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/litellm/__init__.py b/litellm/__init__.py index fcaf71c60c0..904e2bda8b2 100644 --- a/litellm/__init__.py +++ b/litellm/__init__.py @@ -354,6 +354,7 @@ project = None config_path = None vertex_ai_safety_settings: Optional[dict] = None BEDROCK_CONVERSE_MODELS = [ + "anthropic.claude-3-7-sonnet-20250219-v1:0", "anthropic.claude-3-5-haiku-20241022-v1:0", "anthropic.claude-3-5-sonnet-20241022-v2:0", "anthropic.claude-3-5-sonnet-20240620-v1:0", diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json index 21cb055669a..bf958815b93 100644 --- a/litellm/model_prices_and_context_window_backup.json +++ b/litellm/model_prices_and_context_window_backup.json @@ -8738,6 +8738,7 @@ "supports_assistant_prefill": true, "supports_prompt_caching": true, "supports_response_schema": true, + "supports_pdf_input": true, "supports_reasoning": true, "supports_tool_choice": true }, @@ -8856,6 +8857,7 @@ "supports_assistant_prefill": true, "supports_prompt_caching": true, "supports_response_schema": true, + "supports_pdf_input": true, "supports_tool_choice": true, "supports_reasoning": true }, diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json index 21cb055669a..bf958815b93 100644 --- a/model_prices_and_context_window.json +++ b/model_prices_and_context_window.json @@ -8738,6 +8738,7 @@ "supports_assistant_prefill": true, "supports_prompt_caching": true, "supports_response_schema": true, + "supports_pdf_input": true, "supports_reasoning": true, "supports_tool_choice": true }, @@ -8856,6 +8857,7 @@ "supports_assistant_prefill": true, "supports_prompt_caching": true, "supports_response_schema": true, + "supports_pdf_input": true, "supports_tool_choice": true, "supports_reasoning": true }, diff --git a/tests/litellm_utils_tests/test_utils.py b/tests/litellm_utils_tests/test_utils.py index 1c0e123ea74..398b69067a1 100644 --- a/tests/litellm_utils_tests/test_utils.py +++ b/tests/litellm_utils_tests/test_utils.py @@ -2127,6 +2127,20 @@ def test_get_provider_audio_transcription_config(): ) +@pytest.mark.parametrize( + "model, expected_bool", + [ + ("anthropic.claude-3-7-sonnet-20250219-v1:0", True), + ("us.anthropic.claude-3-7-sonnet-20250219-v1:0", True), + ], +) + +def test_claude_3_7_sonnet_supports_pdf_input(model, expected_bool): + from litellm.utils import supports_pdf_input + + assert supports_pdf_input(model) == expected_bool + + def test_get_valid_models_from_provider(): """ Test that get_valid_models returns the correct models for a given provider @@ -2178,5 +2192,5 @@ def test_get_valid_models_from_dynamic_api_key(): valid_models = get_valid_models(custom_llm_provider="anthropic", litellm_params=creds, check_provider_endpoint=True) assert len(valid_models) > 0 assert "anthropic/claude-3-7-sonnet-20250219" in valid_models - + \ No newline at end of file diff --git a/tests/local_testing/whitelisted_bedrock_models.txt b/tests/local_testing/whitelisted_bedrock_models.txt index 8ad500b4c55..c529fa0160d 100644 --- a/tests/local_testing/whitelisted_bedrock_models.txt +++ b/tests/local_testing/whitelisted_bedrock_models.txt @@ -27,6 +27,7 @@ anthropic.claude-3-5-haiku-20241022-v1:0 anthropic.claude-3-opus-20240229-v1:0 us.anthropic.claude-3-sonnet-20240229-v1:0 us.anthropic.claude-3-5-sonnet-20240620-v1:0 +us.anthropic.claude-3-7-sonnet-20250219-v1:0 us.anthropic.claude-3-5-sonnet-20241022-v2:0 us.anthropic.claude-3-haiku-20240307-v1:0 us.anthropic.claude-3-5-haiku-20241022-v1:0