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
fix(otel): drop the generic BaseLLMException fallback from exception_type
mateo-berrid2e4e7468503
diff --git a/litellm/litellm_core_utils/exception_mapping_utils.py b/litellm/litellm_core_utils/exception_mapping_utils.pyindex b76c97ad2de..4ee726b67de 100644--- a/litellm/litellm_core_utils/exception_mapping_utils.py+++ b/litellm/litellm_core_utils/exception_mapping_utils.py@@ -2486,18 +2486,6 @@ def exception_type(exception_provider=exception_provider,extra_information=extra_information,)- from litellm.llms.base_llm.chat.transformation import BaseLLMException-- if custom_llm_provider and isinstance(original_exception, BaseLLMException):- _map_openai_like_exception(- model=model,- original_exception=mappable_exception,- custom_llm_provider=custom_llm_provider,- error_str=error_str,- exception_type=exception_type,- exception_provider=exception_provider,- extra_information=extra_information,- )if "BadRequestError.__init__() missing 1 required positional argument: 'param'" in str(original_exception): # deal with edge-case invalid request error bug in openai-python sdkdiff --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 3eb8094f914..6f7ea9da640 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@@ -1092,30 +1092,3 @@ def test_bedrock_mantle_context_overflow_maps_to_context_window_exceeded():assert excinfo.value.status_code == 400assert "prompt is too long: 1055489 tokens > 1050000 maximum" in excinfo.value.message--- "status_code, expected_class",- [(401, litellm.AuthenticationError), (429, litellm.RateLimitError)],-)-def test_a_base_llm_exception_without_a_provider_branch_maps_by_status_code(- status_code, expected_class, quiet_exception_mapping-):- """Regression test for LIT-6164. Native /v1/messages handlers raise raw- BaseLLMException, and providers without an exception_type branch (e.g.- minimax) must keep the upstream status instead of collapsing every failure- into a 500 APIConnectionError once that route maps its exceptions."""- from litellm.llms.base_llm.chat.transformation import BaseLLMException-- original_exception = BaseLLMException(status_code=status_code, message="upstream rejected the call")-- with pytest.raises(expected_class) as excinfo:- exception_type(- model="MiniMax-M2.5",- original_exception=original_exception,- custom_llm_provider="minimax",- )-- assert excinfo.value.status_code == status_code- assert excinfo.value.llm_provider == "minimax"- assert "MinimaxException" in excinfo.value.message