diff --git a/litellm/utils.py b/litellm/utils.py index 7a1b70f00..9ba19b5e9 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -8220,10 +8220,7 @@ def exception_type( + "Exception" ) - if ( - "This model's maximum context length is" in error_str - or "Request too large" in error_str - ): + if "This model's maximum context length is" in error_str: exception_mapping_worked = True raise ContextWindowExceededError( message=f"{exception_provider} - {message} {extra_information}", @@ -8264,6 +8261,13 @@ def exception_type( model=model, response=original_exception.response, ) + elif "Request too large" in error_str: + raise RateLimitError( + message=f"{exception_provider} - {message} {extra_information}", + model=model, + llm_provider=custom_llm_provider, + response=original_exception.response, + ) elif ( "The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable" in error_str