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
Fixed formatting
Shubham Pathakb8195f091bda
diff --git a/litellm/litellm_core_utils/exception_mapping_utils.py b/litellm/litellm_core_utils/exception_mapping_utils.pyindex f9cebeb1765..c6d3637ffcb 100644--- a/litellm/litellm_core_utils/exception_mapping_utils.py+++ b/litellm/litellm_core_utils/exception_mapping_utils.py@@ -1498,7 +1498,7 @@ def exception_type( # type: ignore # noqa: PLR0915message=f"CohereException - {original_exception.message}",llm_provider="cohere",model=model,- request=getattr(original_exception, "request", None),,+ request=getattr(original_exception, "request", None),)raise original_exceptionelif custom_llm_provider == "huggingface":@@ -1573,7 +1573,7 @@ def exception_type( # type: ignore # noqa: PLR0915message=f"HuggingfaceException - {original_exception.message}",llm_provider="huggingface",model=model,- request=getattr(original_exception, "request", None),,+ request=getattr(original_exception, "request", None),)elif custom_llm_provider == "ai21":if hasattr(original_exception, "message"):@@ -1632,7 +1632,7 @@ def exception_type( # type: ignore # noqa: PLR0915message=f"AI21Exception - {original_exception.message}",llm_provider="ai21",model=model,- request=getattr(original_exception, "request", None),,+ request=getattr(original_exception, "request", None),)elif custom_llm_provider == "nlp_cloud":if "detail" in error_str:@@ -1659,7 +1659,7 @@ def exception_type( # type: ignore # noqa: PLR0915message=f"NLPCloudException - {error_str}",model=model,llm_provider="nlp_cloud",- request=getattr(original_exception, "request", None),,+ request=getattr(original_exception, "request", None),)if hasattr(original_exception, "status_code"@@ -1719,7 +1719,7 @@ def exception_type( # type: ignore # noqa: PLR0915message=f"NLPCloudException - {original_exception.message}",llm_provider="nlp_cloud",model=model,- request=getattr(original_exception, "request", None),,+ request=getattr(original_exception, "request", None),)elif (original_exception.status_code == 504@@ -1739,7 +1739,7 @@ def exception_type( # type: ignore # noqa: PLR0915message=f"NLPCloudException - {original_exception.message}",llm_provider="nlp_cloud",model=model,- request=getattr(original_exception, "request", None),,+ request=getattr(original_exception, "request", None),)elif custom_llm_provider == "together_ai":try:@@ -1848,7 +1848,7 @@ def exception_type( # type: ignore # noqa: PLR0915message=f"TogetherAIException - {original_exception.message}",llm_provider="together_ai",model=model,- request=getattr(original_exception, "request", None),,+ request=getattr(original_exception, "request", None),)elif custom_llm_provider == "aleph_alpha":if (@@ -1953,7 +1953,7 @@ def exception_type( # type: ignore # noqa: PLR0915message=f"VLLMException - {original_exception.message}",llm_provider="vllm",model=model,- request=getattr(original_exception, "request", None),,+ request=getattr(original_exception, "request", None),)elif custom_llm_provider == "azure" or custom_llm_provider == "azure_text":message = get_error_message(error_obj=original_exception)@@ -2208,7 +2208,7 @@ def exception_type( # type: ignore # noqa: PLR0915message=f"APIError: {exception_provider} - {error_str}",llm_provider=custom_llm_provider,model=model,- request=getattr(original_exception, "request", None),,+ request=getattr(original_exception, "request", None),litellm_debug_info=extra_information,)else:@@ -2243,7 +2243,7 @@ def exception_type( # type: ignore # noqa: PLR0915message="{} - {}".format(exception_provider, error_str),llm_provider=custom_llm_provider,model=model,- request=getattr(original_exception, "request", None),,+ request=getattr(original_exception, "request", None),)else:raise APIConnectionError(