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
refactor(logging): drop the type-gate commentary
Marty Sullivanb048ce4cc118
diff --git a/litellm/litellm_core_utils/redact_messages.py b/litellm/litellm_core_utils/redact_messages.pyindex e91acaa97ca..0d590e1ceba 100644--- a/litellm/litellm_core_utils/redact_messages.py+++ b/litellm/litellm_core_utils/redact_messages.py@@ -258,13 +258,6 @@ def perform_redaction(model_call_details: dict, result, redact_streaming_respons# For async objects, return a simple redacted response without deepcopyreturn {"text": "redacted-by-litellm"}- # Only the shapes handled below can be redacted; every other type falls through- # to the placeholder return at the end of this block, which discards the copy.- # Deciding that before copying keeps the deepcopy off objects it cannot help:- # binary/HTTP response bodies (batch output, file content) hold an unpicklable- # `_thread.lock` and raise TypeError here, which aborts success logging and every- # spend callback with it, and a large batch body would be copied only to be thrown- # away.if not (isinstance(result, (litellm.ModelResponse, litellm.ResponsesAPIResponse, litellm.EmbeddingResponse))or (isinstance(result, dict) and ("choices" in result or "output" in result))diff --git a/tests/test_litellm/litellm_core_utils/test_redact_messages.py b/tests/test_litellm/litellm_core_utils/test_redact_messages.pyindex 88d2a95dd4f..8fa6d44dd8a 100644--- a/tests/test_litellm/litellm_core_utils/test_redact_messages.py+++ b/tests/test_litellm/litellm_core_utils/test_redact_messages.py@@ -688,9 +688,9 @@ class TestPerformRedaction:Binary/HTTP response bodies (batch output, file content, audio) hold anunpicklable ``_thread.lock``. Copying one raises TypeError inside- ``Logging.success_handler``, which aborts every success callback with it - so the- spend row for a completed batch is never written. The copy is also pointless:- an unrecognized shape returns the placeholder and the copy is discarded.+ ``Logging.success_handler``, which aborts the handler body at the redaction call so+ everything after it is skipped. The copy is also pointless: an unrecognized shape+ returns the placeholder and the copy is discarded.The lock is the assertion. If a deepcopy is ever reintroduced ahead of the typecheck, this raises instead of returning.