From 799a2b624a92f013601f6ee7de516ebb9bed6f4a Mon Sep 17 00:00:00 2001 From: nuernber Date: Wed, 22 Oct 2025 15:24:57 -0700 Subject: [PATCH] use proper bedrock model name in health check (#15808) --- litellm/proxy/health_check.py | 4 ++++ tests/litellm_utils_tests/test_health_check.py | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/litellm/proxy/health_check.py b/litellm/proxy/health_check.py index c1103f2c12c..a0483a08bde 100644 --- a/litellm/proxy/health_check.py +++ b/litellm/proxy/health_check.py @@ -138,6 +138,7 @@ def _update_litellm_params_for_health_check( - gets a short `messages` param for health check - updates the `model` param with the `health_check_model` if it exists Doc: https://docs.litellm.ai/docs/proxy/health#wildcard-routes - updates the `voice` param with the `health_check_voice` for `audio_speech` mode if it exists Doc: https://docs.litellm.ai/docs/proxy/health#text-to-speech-models + - updates the `model` param with the Bedrock base model name if it is a Bedrock model """ litellm_params["messages"] = _get_random_llm_message() _health_check_model = model_info.get("health_check_model", None) @@ -145,6 +146,9 @@ def _update_litellm_params_for_health_check( litellm_params["model"] = _health_check_model if model_info.get("mode", None) == "audio_speech": litellm_params["voice"] = model_info.get("health_check_voice", "alloy") + if "bedrock" in litellm_params["model"]: + from litellm.llms.bedrock.common_utils import BedrockModelInfo + litellm_params["model"] = BedrockModelInfo.get_base_model(litellm_params["model"]) return litellm_params diff --git a/tests/litellm_utils_tests/test_health_check.py b/tests/litellm_utils_tests/test_health_check.py index 0a47dfc0ca3..35eef1ed47d 100644 --- a/tests/litellm_utils_tests/test_health_check.py +++ b/tests/litellm_utils_tests/test_health_check.py @@ -304,6 +304,15 @@ def test_update_litellm_params_for_health_check(): updated_params = _update_litellm_params_for_health_check(model_info, litellm_params) assert "voice" not in updated_params + # Test with Bedrock model + model_info = {} + litellm_params = { + "model": "bedrock/us-gov-west-1/anthropic.claude-3-7-sonnet-20250219-v1:0", + "api_key": "fake_key", + } + updated_params = _update_litellm_params_for_health_check(model_info, litellm_params) + assert updated_params["model"] == "anthropic.claude-3-7-sonnet-20250219-v1:0" + @pytest.mark.asyncio async def test_perform_health_check_with_health_check_model(): """