diff --git a/tests/test_litellm/llms/anthropic/chat/test_anthropic_chat_transformation.py b/tests/test_litellm/llms/anthropic/chat/test_anthropic_chat_transformation.py index 301c433e4a5..a94641f1fd2 100644 --- a/tests/test_litellm/llms/anthropic/chat/test_anthropic_chat_transformation.py +++ b/tests/test_litellm/llms/anthropic/chat/test_anthropic_chat_transformation.py @@ -1882,13 +1882,20 @@ def test_get_config_with_model_uses_dynamic_max_tokens(): Fixes: https://github.com/BerriAI/litellm/issues/8835 """ + from unittest.mock import patch + # Claude 3 model should get 4096 config_claude3 = AnthropicConfig.get_config(model="claude-3-sonnet-20240229") assert config_claude3["max_tokens"] == 4096 - # Claude 3.5 model should get 8192 - config_claude35 = AnthropicConfig.get_config(model="claude-3-5-sonnet-20241022") - assert config_claude35["max_tokens"] == 8192 + # Claude 3.5 model should get 8192 (mock get_max_tokens since the model + # may not be in the local cost map when LITELLM_LOCAL_MODEL_COST_MAP is set) + with patch( + "litellm.llms.anthropic.chat.transformation.get_max_tokens", + return_value=8192, + ): + config_claude35 = AnthropicConfig.get_config(model="claude-3-5-sonnet-20241022") + assert config_claude35["max_tokens"] == 8192 # Claude 3.7 model should get 64000 (64K default, 128K requires beta header) config_claude37 = AnthropicConfig.get_config(model="claude-3-7-sonnet-20250219") diff --git a/tests/test_litellm/llms/vertex_ai/context_caching/test_context_caching_ttl.py b/tests/test_litellm/llms/vertex_ai/context_caching/test_context_caching_ttl.py index f230d814ae6..0dd93c2c429 100644 --- a/tests/test_litellm/llms/vertex_ai/context_caching/test_context_caching_ttl.py +++ b/tests/test_litellm/llms/vertex_ai/context_caching/test_context_caching_ttl.py @@ -211,7 +211,7 @@ class TestTransformationWithTTL: vertex_project="test_project" result = transform_openai_messages_to_gemini_context_caching( - model="gemini-1.5-pro", + model="gemini-3-flash-preview", messages=messages, cache_key="test-cache-key", custom_llm_provider=custom_llm_provider, @@ -223,9 +223,9 @@ class TestTransformationWithTTL: assert result["ttl"] == "3600s" if custom_llm_provider == "gemini": - assert result["model"] == "models/gemini-1.5-pro" + assert result["model"] == "models/gemini-3-flash-preview" else: - assert result["model"] == f"projects/{vertex_project}/locations/{vertex_location}/publishers/google/models/gemini-1.5-pro" + assert result["model"] == f"projects/{vertex_project}/locations/{vertex_location}/publishers/google/models/gemini-3-flash-preview" assert result["displayName"] == "test-cache-key" @@ -250,7 +250,7 @@ class TestTransformationWithTTL: vertex_project="test_project" result = transform_openai_messages_to_gemini_context_caching( - model="gemini-1.5-pro", + model="gemini-3-flash-preview", messages=messages, cache_key="test-cache-key", custom_llm_provider=custom_llm_provider, @@ -261,9 +261,9 @@ class TestTransformationWithTTL: assert "ttl" not in result if custom_llm_provider == "gemini": - assert result["model"] == "models/gemini-1.5-pro" + assert result["model"] == "models/gemini-3-flash-preview" else: - assert result["model"] == f"projects/{vertex_project}/locations/{vertex_location}/publishers/google/models/gemini-1.5-pro" + assert result["model"] == f"projects/{vertex_project}/locations/{vertex_location}/publishers/google/models/gemini-3-flash-preview" assert result["displayName"] == "test-cache-key" @@ -286,7 +286,7 @@ class TestTransformationWithTTL: vertex_project="test_project" result = transform_openai_messages_to_gemini_context_caching( - model="gemini-1.5-pro", + model="gemini-3-flash-preview", messages=messages, cache_key="test-cache-key", custom_llm_provider=custom_llm_provider, @@ -297,9 +297,9 @@ class TestTransformationWithTTL: assert "ttl" not in result if custom_llm_provider == "gemini": - assert result["model"] == "models/gemini-1.5-pro" + assert result["model"] == "models/gemini-3-flash-preview" else: - assert result["model"] == f"projects/{vertex_project}/locations/{vertex_location}/publishers/google/models/gemini-1.5-pro" + assert result["model"] == f"projects/{vertex_project}/locations/{vertex_location}/publishers/google/models/gemini-3-flash-preview" assert result["displayName"] == "test-cache-key" @@ -332,7 +332,7 @@ class TestTransformationWithTTL: vertex_project="test_project" result = transform_openai_messages_to_gemini_context_caching( - model="gemini-1.5-pro", + model="gemini-3-flash-preview", messages=messages, cache_key="test-cache-key", custom_llm_provider=custom_llm_provider, @@ -345,9 +345,9 @@ class TestTransformationWithTTL: assert "system_instruction" in result if custom_llm_provider == "gemini": - assert result["model"] == "models/gemini-1.5-pro" + assert result["model"] == "models/gemini-3-flash-preview" else: - assert result["model"] == f"projects/{vertex_project}/locations/{vertex_location}/publishers/google/models/gemini-1.5-pro" + assert result["model"] == f"projects/{vertex_project}/locations/{vertex_location}/publishers/google/models/gemini-3-flash-preview" assert result["displayName"] == "test-cache-key" diff --git a/tests/test_litellm/test_utils.py b/tests/test_litellm/test_utils.py index 818ecd769dd..0250503dd73 100644 --- a/tests/test_litellm/test_utils.py +++ b/tests/test_litellm/test_utils.py @@ -90,7 +90,7 @@ def test_supports_function_calling_github_openai_alias(): def test_supports_function_calling_github_anthropic_alias(): assert ( litellm.utils.supports_function_calling( - model="github/claude-3-5-sonnet-latest" + model="github/claude-3-7-sonnet-20250219" ) is True )