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(openai.py): fix post call error logging for aembedding calls

Krrish Dholakiab91e5d3887f3
diff --git a/litellm/llms/openai.py b/litellm/llms/openai.py
index d62e89f8afd..941b498437b 100644
--- a/litellm/llms/openai.py
+++ b/litellm/llms/openai.py
@@ -1376,8 +1376,22 @@ class OpenAIChatCompletion(BaseLLM):
_response_headers=headers,
) # type: ignore
except OpenAIError as e:
+ ## LOGGING
+ logging_obj.post_call(
+ input=input,
+ api_key=api_key,
+ additional_args={"complete_input_dict": data},
+ original_response=str(e),
+ )
raise e
except Exception as e:
+ ## LOGGING
+ logging_obj.post_call(
+ input=input,
+ api_key=api_key,
+ additional_args={"complete_input_dict": data},
+ original_response=str(e),
+ )
status_code = getattr(e, "status_code", 500)
error_headers = getattr(e, "headers", None)
raise OpenAIError(