diff --git a/litellm/llms/bedrock/passthrough/transformation.py b/litellm/llms/bedrock/passthrough/transformation.py index 4eba0960232..e0f69f29e8d 100644 --- a/litellm/llms/bedrock/passthrough/transformation.py +++ b/litellm/llms/bedrock/passthrough/transformation.py @@ -206,13 +206,11 @@ class BedrockPassthroughConfig(BaseAWSLLM, BedrockModelInfo, BedrockEventStreamD # Application Inference Profile ARNs don't encode provider info in the ARN # itself. Try to derive the provider from the original LiteLLM model name # (e.g. "global.anthropic.claude-opus-4-7") stored in logging context. - fallback_model: Final = litellm_logging_obj.model_call_details.get( - "litellm_params", {} - ).get("model", "") + fallback_model: Final = litellm_logging_obj.model_call_details.get("litellm_params", {}).get( + "model", "" + ) if fallback_model: - invoke_provider = AmazonInvokeConfig.get_bedrock_invoke_provider( - fallback_model - ) + invoke_provider = AmazonInvokeConfig.get_bedrock_invoke_provider(fallback_model) if invoke_provider is None: verbose_logger.warning( f"Could not determine Bedrock invoke provider for model: {model!r}. " diff --git a/tests/test_litellm/llms/bedrock/passthrough/test_bedrock_passthrough_transformation.py b/tests/test_litellm/llms/bedrock/passthrough/test_bedrock_passthrough_transformation.py index d17d61a25ed..d564bff0032 100644 --- a/tests/test_litellm/llms/bedrock/passthrough/test_bedrock_passthrough_transformation.py +++ b/tests/test_litellm/llms/bedrock/passthrough/test_bedrock_passthrough_transformation.py @@ -1,6 +1,5 @@ from unittest.mock import MagicMock, patch - from litellm.llms.bedrock.passthrough.transformation import BedrockPassthroughConfig @@ -524,13 +523,9 @@ def test_handle_logging_collected_chunks_inference_profile_arn_falls_back_gracef # Intercept the decoder so we don't need real botocore event-stream bytes. # The import is done inside handle_logging_collected_chunks, so patch the source module. - with patch( - "litellm.llms.bedrock.chat.get_bedrock_event_stream_decoder" - ) as mock_decoder: + with patch("litellm.llms.bedrock.chat.get_bedrock_event_stream_decoder") as mock_decoder: mock_chunk_obj = MagicMock() - mock_chunk_obj._chunk_parser.return_value = ( - {} - ) # not a valid GenericStreamingChunk + mock_chunk_obj._chunk_parser.return_value = {} # not a valid GenericStreamingChunk mock_decoder.return_value = mock_chunk_obj # Must not raise ValueError.