From 1073ba6d13507234bb54f33518039d2a4795cc85 Mon Sep 17 00:00:00 2001 From: Harshit28j Date: Sat, 28 Feb 2026 19:06:31 +0530 Subject: [PATCH] fix req changes --- litellm/proxy/guardrails/guardrail_hooks/presidio.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/litellm/proxy/guardrails/guardrail_hooks/presidio.py b/litellm/proxy/guardrails/guardrail_hooks/presidio.py index 849b1ec9cab..adfe69315c6 100644 --- a/litellm/proxy/guardrails/guardrail_hooks/presidio.py +++ b/litellm/proxy/guardrails/guardrail_hooks/presidio.py @@ -508,7 +508,13 @@ class _OPTIONAL_PresidioPIIMasking(CustomGuardrail): masked_entity_count[entity_type] = ( masked_entity_count.get(entity_type, 0) + 1 ) - return redacted_text["text"] + # When output_parse_pii is True, new_text contains UUID-suffixed + # tokens that match the keys in pii_tokens. Returning + # redacted_text["text"] (Presidio's original output) would send + # un-suffixed tokens to the LLM, making unmasking impossible. + # When output_parse_pii is False, new_text == redacted_text["text"] + # because no UUID suffix is appended. + return new_text else: raise Exception("Invalid anonymizer response: received None") except Exception as e: