From e2d275f1b7ca9651802a1342383c97f192f52aaa Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Fri, 19 Jul 2024 19:30:41 -0700 Subject: [PATCH] fix(utils.py): add exception mapping for bedrock image internal server error --- litellm/tests/test_bedrock_completion.py | 2 ++ litellm/utils.py | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/litellm/tests/test_bedrock_completion.py b/litellm/tests/test_bedrock_completion.py index 3ae5af81b..220e3f62f 100644 --- a/litellm/tests/test_bedrock_completion.py +++ b/litellm/tests/test_bedrock_completion.py @@ -592,6 +592,8 @@ def test_bedrock_claude_3(image_url): assert len(response.choices) > 0 assert len(response.choices[0].message.content) > 0 + except litellm.InternalServerError: + pass except RateLimitError: pass except Exception as e: diff --git a/litellm/utils.py b/litellm/utils.py index c31c053e7..809613a09 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -6813,6 +6813,13 @@ def exception_type( model=model, llm_provider="bedrock", ) + elif "Could not process image" in error_str: + exception_mapping_worked = True + raise litellm.InternalServerError( + message=f"BedrockException - {error_str}", + model=model, + llm_provider="bedrock", + ) elif hasattr(original_exception, "status_code"): if original_exception.status_code == 500: exception_mapping_worked = True