Skip to content

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]

fix(utils.py): fix message replace

Krrish Dholakia0a15d3b3c3c8
diff --git a/litellm/utils.py b/litellm/utils.py
index 68eac7c3aec..81ba950870e 100644
--- a/litellm/utils.py
+++ b/litellm/utils.py
@@ -6649,9 +6649,14 @@ def exception_type(
else:
message = str(original_exception)
- if message is not None and isinstance(message, str):
+ if message is not None and isinstance(
+ message, str
+ ): # done to prevent user-confusion. Relevant issue - https://github.com/BerriAI/litellm/issues/1414
message = message.replace("OPENAI", custom_llm_provider.upper())
- message = message.replace("OpenAI", custom_llm_provider)
+ message = message.replace(
+ "openai.OpenAIError",
+ "{}.{}Error".format(custom_llm_provider, custom_llm_provider),
+ )
if custom_llm_provider == "openai":
exception_provider = "OpenAI" + "Exception"
else: