From 0b899980d4fe976ff0eb0cba93f001fe1bdbadf6 Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Tue, 3 Nov 2026 18:12:51 -0800 Subject: [PATCH] fix(logging): redact reasoning_text, citations, and web search results in provider_specific_fields --- litellm/litellm_core_utils/redact_messages.py | 7 +++++++ tests/unit/litellm_core_utils/test_redact_messages.py | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/litellm/litellm_core_utils/redact_messages.py b/litellm/litellm_core_utils/redact_messages.py index 018d1ffe6c2..0e49f68043d 100644 --- a/litellm/litellm_core_utils/redact_messages.py +++ b/litellm/litellm_core_utils/redact_messages.py @@ -273,16 +273,23 @@ def _redacted_provider_specific_fields(fields: Mapping[str, object]) -> Mapping[ **fields, **({"reasoning_content": REDACTED_BY_LITELLM} if fields.get("reasoning_content") is not None else {}), **({"reasoning": REDACTED_BY_LITELLM} if fields.get("reasoning") is not None else {}), + **({"reasoning_text": REDACTED_BY_LITELLM} if fields.get("reasoning_text") is not None else {}), **{ key: None for key in ( "thinking_blocks", "reasoningContentBlocks", "citations", + "citation", + "citationsContent", "compaction_blocks", "compaction_start", "compaction_delta", "reasoning_details", + "web_search_calls", + "web_search_results", + "tool_results", + "code_interpreter_results", "token_ids", ) if key in fields diff --git a/tests/unit/litellm_core_utils/test_redact_messages.py b/tests/unit/litellm_core_utils/test_redact_messages.py index 819ca20ab3e..47654321fa1 100644 --- a/tests/unit/litellm_core_utils/test_redact_messages.py +++ b/tests/unit/litellm_core_utils/test_redact_messages.py @@ -55,10 +55,17 @@ def _provider_fields() -> dict[str, object]: return { "reasoning_content": SECRET, "reasoning": SECRET, + "reasoning_text": SECRET, "reasoning_details": [{"type": "reasoning.text", "text": SECRET, "index": 0, "format": "unknown"}], "thinking_blocks": [{"type": "thinking", "thinking": SECRET}], "reasoningContentBlocks": [{"reasoningText": {"text": SECRET}}], "citations": [{"cited_text": SECRET}], + "citationsContent": [{"citations": [{"location": {}}], "content": [{"text": SECRET}]}], + "citation": {"type": "char_location", "cited_text": SECRET}, + "web_search_calls": [{"type": "web_search_call", "action": {"type": "search", "query": SECRET}}], + "web_search_results": [{"type": "web_search_tool_result", "content": [{"title": SECRET}]}], + "tool_results": [{"type": "web_fetch_tool_result", "content": {"text": SECRET}}], + "code_interpreter_results": [{"stdout": SECRET}], "compaction_blocks": [{"type": "compaction", "content": SECRET, "signature": "compaction-signature"}], "compaction_start": {"type": "compaction", "content": SECRET}, "compaction_delta": {"type": "compaction_delta", "content": SECRET},