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
(sdk perf fix) - only print args passed to litellm when debugging mode is on (#7708)
Ishaan Jaff75fb37217a45
diff --git a/litellm/_logging.py b/litellm/_logging.pyindex ae17d0e5257..151ae6003d2 100644--- a/litellm/_logging.py+++ b/litellm/_logging.py@@ -102,3 +102,12 @@ def print_verbose(print_statement):print(print_statement) # noqaexcept Exception:pass+++def _is_debugging_on() -> bool:+ """+ Returns True if debugging is on+ """+ if verbose_logger.isEnabledFor(logging.DEBUG) or set_verbose is True:+ return True+ return Falsediff --git a/litellm/litellm_core_utils/litellm_logging.py b/litellm/litellm_core_utils/litellm_logging.pyindex cbec481ab0f..d4768d8a813 100644--- a/litellm/litellm_core_utils/litellm_logging.py+++ b/litellm/litellm_core_utils/litellm_logging.py@@ -4,7 +4,6 @@import copyimport datetimeimport json-import loggingimport osimport reimport subprocess@@ -23,8 +22,8 @@ from litellm import (json_logs,log_raw_request_response,turn_off_message_logging,- verbose_logger,)+from litellm._logging import _is_debugging_on, verbose_loggerfrom litellm.caching.caching import DualCache, InMemoryCachefrom litellm.caching.caching_handler import LLMCachingHandlerfrom litellm.cost_calculator import _select_model_name_for_cost_calc@@ -589,7 +588,7 @@ class Logging(LiteLLMLoggingBaseClass):Prints the RAW curl command sent from LiteLLM"""- if verbose_logger.isEnabledFor(logging.DEBUG) or litellm.set_verbose is True:+ if _is_debugging_on():if json_logs:masked_headers = self._get_masked_headers(headers)verbose_logger.debug(diff --git a/litellm/utils.py b/litellm/utils.pyindex 87bf1f142d9..c0c623256c0 100644--- a/litellm/utils.py+++ b/litellm/utils.py@@ -183,7 +183,7 @@ from litellm.llms.base_llm.completion.transformation import BaseTextCompletionCofrom litellm.llms.base_llm.embedding.transformation import BaseEmbeddingConfigfrom litellm.llms.base_llm.rerank.transformation import BaseRerankConfig-from ._logging import verbose_logger+from ._logging import _is_debugging_on, verbose_loggerfrom .caching.caching import (Cache,QdrantSemanticCache,@@ -5612,6 +5612,8 @@ def get_valid_models(check_provider_endpoint: bool = False) -> List[str]:def print_args_passed_to_litellm(original_function, args, kwargs):+ if not _is_debugging_on():+ returntry:# we've already printed this for acompletion, don't print for completionif (