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(litellm_logging.py): support emitting raw response on self.litellm_request_debug is true

Krrish Dholakia48619f2b7bd6
diff --git a/litellm/litellm_core_utils/litellm_logging.py b/litellm/litellm_core_utils/litellm_logging.py
index 59dd09f2728..2f21d280899 100644
--- a/litellm/litellm_core_utils/litellm_logging.py
+++ b/litellm/litellm_core_utils/litellm_logging.py
@@ -996,8 +996,14 @@ class Logging(LiteLLMLoggingBaseClass):
self.model_call_details["additional_args"] = additional_args
self.model_call_details["log_event_type"] = "post_api_call"
+ if self.litellm_request_debug:
+ attr = "warning"
+ else:
+ attr = "debug"
+
if json_logs:
- verbose_logger.debug(
+ callattr = getattr(verbose_logger, attr)
+ callattr(
"RAW RESPONSE:\n{}\n\n".format(
self.model_call_details.get(
"original_response", self.model_call_details
@@ -1005,7 +1011,8 @@ class Logging(LiteLLMLoggingBaseClass):
),
)
else:
- print_verbose(
+ callattr = getattr(verbose_logger, attr)
+ callattr(
"RAW RESPONSE:\n{}\n\n".format(
self.model_call_details.get(
"original_response", self.model_call_details