fix(utils.py): add exception mapping for bedrock image internal server error

This commit is contained in:
Krrish Dholakia 2024-07-19 19:30:41 -07:00
parent 4de19cb116
commit e2d275f1b7
2 changed files with 9 additions and 0 deletions

View file

@ -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:

View file

@ -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