diff --git a/litellm/__pycache__/utils.cpython-311.pyc b/litellm/__pycache__/utils.cpython-311.pyc index 5ef3ac7b1..14fa58e19 100644 Binary files a/litellm/__pycache__/utils.cpython-311.pyc and b/litellm/__pycache__/utils.cpython-311.pyc differ diff --git a/litellm/utils.py b/litellm/utils.py index f802e7f69..ea54943fc 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -1333,7 +1333,7 @@ def exception_type(model, original_exception, custom_llm_provider): exception_mapping_worked = True if model in litellm.openrouter_models: if original_exception.http_status == 413: - raise ContextWindowExceededError( + raise InvalidRequestError( message=str(original_exception), model=model, llm_provider="openrouter" @@ -1382,8 +1382,9 @@ def exception_type(model, original_exception, custom_llm_provider): ) elif original_exception.status_code == 413: exception_mapping_worked = True - raise ContextWindowExceededError( + raise InvalidRequestError( message=f"AnthropicException - {original_exception.message}", + model=model, llm_provider="anthropic", ) elif original_exception.status_code == 429: @@ -1408,6 +1409,13 @@ def exception_type(model, original_exception, custom_llm_provider): message=f"ReplicateException - {error_str}", llm_provider="replicate", ) + elif "input is too long" in error_str: + exception_mapping_worked = True + raise ContextWindowExceededError( + message=f"ReplicateException - {error_str}", + model=model, + llm_provider="replicate", + ) elif exception_type == "ModelError": exception_mapping_worked = True raise InvalidRequestError(