Merge pull request #4669 from BerriAI/litellm_logging_only_masking

Flag for PII masking on Logging only
This commit is contained in:
Krish Dholakia 2024-07-11 22:03:37 -07:00 committed by GitHub
commit d72bcdbce3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 379 additions and 81 deletions

View file

@ -46,7 +46,17 @@ def initialize_callbacks_on_proxy(
_OPTIONAL_PresidioPIIMasking,
)
pii_masking_object = _OPTIONAL_PresidioPIIMasking()
presidio_logging_only: Optional[bool] = litellm_settings.get(
"presidio_logging_only", None
)
if presidio_logging_only is not None:
presidio_logging_only = bool(
presidio_logging_only
) # validate boolean given
pii_masking_object = _OPTIONAL_PresidioPIIMasking(
logging_only=presidio_logging_only
)
imported_list.append(pii_masking_object)
elif isinstance(callback, str) and callback == "llamaguard_moderations":
from enterprise.enterprise_hooks.llama_guard import (