From 66cbba3f55badf1359a6b8faffecffb55341fb94 Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Thu, 12 Oct 2023 15:57:34 -0700 Subject: [PATCH] (feat) add Rate Limit Error for bedrock --- litellm/utils.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/litellm/utils.py b/litellm/utils.py index 3694403a16..12ff1cfb08 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -2495,13 +2495,20 @@ def exception_type( model=model, llm_provider="bedrock" ) - if "The security token included in the request is invalid": + if "The security token included in the request is invalid" in error_str: exception_mapping_worked = True raise AuthenticationError( message=f"BedrockException Invalid Authentication - {error_str}", model=model, llm_provider="bedrock" ) + if "throttlingException" in error_str: + exception_mapping_worked = True + raise RateLimitError( + message=f"BedrockException: Rate Limit Error - {error_str}", + model=model, + llm_provider="bedrock" + ) elif custom_llm_provider == "sagemaker": if "Unable to locate credentials" in error_str: exception_mapping_worked = True