From b2fcef83cc4279a120b822ef61c67c5e52130344 Mon Sep 17 00:00:00 2001 From: basil-k-aji-dev <70605804+basil-k-aji-dev@users.noreply.github.com> Date: Sat, 3 Oct 2026 11:25:09 +0530 Subject: [PATCH] feat(presidio): annotate the analyzer-result locals the token suffix reads entity_type and value come out of an untyped analyzer mapping. They only fed an f-string before, where an Any costs nothing; passing them to _stable_token_suffix makes them call arguments, which is what the remaining unknown-argument error was. --- litellm/proxy/guardrails/guardrail_hooks/presidio.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/litellm/proxy/guardrails/guardrail_hooks/presidio.py b/litellm/proxy/guardrails/guardrail_hooks/presidio.py index 086468f16bb..2cbb6c4e8ac 100644 --- a/litellm/proxy/guardrails/guardrail_hooks/presidio.py +++ b/litellm/proxy/guardrails/guardrail_hooks/presidio.py @@ -869,8 +869,10 @@ class _OPTIONAL_PresidioPIIMasking(CustomGuardrail): for ar in reversed(sorted_forward): start = ar["start"] end = ar["end"] - entity_type = ar["entity_type"] - value = text[start:end] + # Annotated because the analyzer result is an untyped mapping: both now + # reach _stable_token_suffix as call arguments, where an Any counts. + entity_type: str = ar["entity_type"] + value: str = text[start:end] suffix = ( self._stable_token_suffix(entity_type, value) if self.presidio_stable_tokens