diff --git a/litellm/llms/bedrock_httpx.py b/litellm/llms/bedrock_httpx.py index 3434371f6ee..ffc096f762e 100644 --- a/litellm/llms/bedrock_httpx.py +++ b/litellm/llms/bedrock_httpx.py @@ -1054,10 +1054,11 @@ class BedrockLLM(BaseLLM): "complete_input_dict": inference_params, }, ) - raise Exception( - "Bedrock HTTPX: Unsupported provider={}, model={}".format( + raise BedrockError( + status_code=400, + message="Bedrock HTTPX: Unsupported provider={}, model={}".format( provider, model - ) + ), ) ## COMPLETION CALL diff --git a/litellm/tests/test_bedrock_completion.py b/litellm/tests/test_bedrock_completion.py index 5f49bbd2c6c..4da18144d08 100644 --- a/litellm/tests/test_bedrock_completion.py +++ b/litellm/tests/test_bedrock_completion.py @@ -1157,3 +1157,16 @@ def test_bedrock_tools_pt_invalid_names(): assert len(result) == 2 assert result[0]["toolSpec"]["name"] == "a123_invalid_name" assert result[1]["toolSpec"]["name"] == "another_invalid_name" + + +def test_bad_request_error(): + with pytest.raises(litellm.BadRequestError): + completion( + model="bedrock/bad_model", + messages=[ + { + "role": "user", + "content": "What is the meaning of life", + } + ], + )