fix(bedrock.py): add support for sts based boto3 initialization

https://github.com/BerriAI/litellm/issues/1476
This commit is contained in:
Krrish Dholakia 2024-01-17 12:08:39 -08:00
parent 809edbfb2d
commit cc89aa7456
5 changed files with 106 additions and 4 deletions

View file

@ -60,6 +60,7 @@ from .exceptions import (
RateLimitError,
ServiceUnavailableError,
OpenAIError,
PermissionDeniedError,
ContextWindowExceededError,
ContentPolicyViolationError,
Timeout,
@ -5924,6 +5925,14 @@ def exception_type(
llm_provider="bedrock",
response=original_exception.response,
)
if "AccessDeniedException" in error_str:
exception_mapping_worked = True
raise PermissionDeniedError(
message=f"BedrockException PermissionDeniedError - {error_str}",
model=model,
llm_provider="bedrock",
response=original_exception.response,
)
if (
"throttlingException" in error_str
or "ThrottlingException" in error_str