fix(logging): redact reasoning_text, citations, and web search results in provider_specific_fields

This commit is contained in:
mateo-berri 2026-11-03 18:12:51 -08:00
parent b208725272
commit 0b899980d4
2 changed files with 14 additions and 0 deletions

View file

@ -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

View file

@ -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},