forked from phoenix/litellm-mirror
feat(guardrails.py): allow setting logging_only
in guardrails_config for presidio pii masking integration
This commit is contained in:
parent
f2522867ed
commit
6b78e39600
7 changed files with 71 additions and 18 deletions
|
@ -14,6 +14,7 @@ def initialize_callbacks_on_proxy(
|
|||
premium_user: bool,
|
||||
config_file_path: str,
|
||||
litellm_settings: dict,
|
||||
callback_specific_params: dict = {},
|
||||
):
|
||||
from litellm.proxy.proxy_server import prisma_client
|
||||
|
||||
|
@ -25,7 +26,6 @@ def initialize_callbacks_on_proxy(
|
|||
known_compatible_callbacks = list(
|
||||
get_args(litellm._custom_logger_compatible_callbacks_literal)
|
||||
)
|
||||
|
||||
for callback in value: # ["presidio", <my-custom-callback>]
|
||||
if isinstance(callback, str) and callback in known_compatible_callbacks:
|
||||
imported_list.append(callback)
|
||||
|
@ -54,9 +54,11 @@ def initialize_callbacks_on_proxy(
|
|||
presidio_logging_only
|
||||
) # validate boolean given
|
||||
|
||||
pii_masking_object = _OPTIONAL_PresidioPIIMasking(
|
||||
logging_only=presidio_logging_only
|
||||
)
|
||||
params = {
|
||||
"logging_only": presidio_logging_only,
|
||||
**callback_specific_params,
|
||||
}
|
||||
pii_masking_object = _OPTIONAL_PresidioPIIMasking(**params)
|
||||
imported_list.append(pii_masking_object)
|
||||
elif isinstance(callback, str) and callback == "llamaguard_moderations":
|
||||
from enterprise.enterprise_hooks.llama_guard import (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue