From ace5ce0b78bcc700f2ead69182923b18e1df8596 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Mon, 13 May 2024 18:13:13 -0700 Subject: [PATCH] fix(utils.py): fix watsonx exception mapping --- litellm/tests/test_completion.py | 2 ++ litellm/utils.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/litellm/tests/test_completion.py b/litellm/tests/test_completion.py index 45a53ca56a..d08a4ae3ba 100644 --- a/litellm/tests/test_completion.py +++ b/litellm/tests/test_completion.py @@ -3342,6 +3342,8 @@ def test_completion_watsonx(): print(response) except litellm.APIError as e: pass + except litellm.RateLimitError as e: + pass except Exception as e: pytest.fail(f"Error occurred: {e}") diff --git a/litellm/utils.py b/litellm/utils.py index 14534147bb..4a8e7e6915 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -8514,7 +8514,7 @@ def exception_type( request=original_exception.request, ) elif custom_llm_provider == "watsonx": - if "token_quota_reached" in error_response: + if "token_quota_reached" in error_str: exception_mapping_worked = True raise RateLimitError( message=f"WatsonxException: Rate Limit Errror - {error_str}",