The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
[Buf fix] - Azure OpenAI, fix ContextWindowExceededError is not mapped from Azure openai errors (#15981)
Ishaan Jaff20f9e189fb2e
diff --git a/litellm/litellm_core_utils/exception_mapping_utils.py b/litellm/litellm_core_utils/exception_mapping_utils.pyindex c6d3637ffcb..61551b04236 100644--- a/litellm/litellm_core_utils/exception_mapping_utils.py+++ b/litellm/litellm_core_utils/exception_mapping_utils.py@@ -67,6 +67,7 @@ class ExceptionCheckers:"string too long. expected a string with maximum length","model's maximum context limit","is longer than the model's context length",+ "input tokens exceed the configured limit",]for substring in known_exception_substrings:if substring in _error_str_lowercase:diff --git a/tests/test_litellm/litellm_core_utils/test_exception_mapping_utils.py b/tests/test_litellm/litellm_core_utils/test_exception_mapping_utils.pyindex 42e65612a96..638aab8fb49 100644--- a/tests/test_litellm/litellm_core_utils/test_exception_mapping_utils.py+++ b/tests/test_litellm/litellm_core_utils/test_exception_mapping_utils.py@@ -11,6 +11,7 @@ context_window_test_cases = [("Validation Error: string too long. expected a string with maximum length 1000.", True),("Your prompt is longer than the model's context length of 2048.", True),("AWS Bedrock Error: The request payload size has exceed context limit.", True),+ ("Input tokens exceed the configured limit of 272000 tokens. Your messages resulted in 509178 tokens. Please reduce the length of the messages.", True),# Test case insensitivity("ERROR: THIS MODEL'S MAXIMUM CONTEXT LENGTH IS 1024.", True),