From 5cb0c1ad707dc9572d6b363b1025a67a6b5fe47f Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Thu, 20 Jun 2024 12:01:11 -0700 Subject: [PATCH] fix(utils.py): add new error string to context window exception mapping --- litellm/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/litellm/utils.py b/litellm/utils.py index 6b958a580..852c1d6a8 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -5688,7 +5688,11 @@ def exception_type( + "Exception" ) - if "This model's maximum context length is" in error_str: + if ( + "This model's maximum context length is" in error_str + or "string too long. Expected a string with maximum length" + in error_str + ): exception_mapping_worked = True raise ContextWindowExceededError( message=f"ContextWindowExceededError: {exception_provider} - {message}",