mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 19:24:27 +00:00
feat(guardrails.py): allow setting logging_only
in guardrails_config for presidio pii masking integration
This commit is contained in:
parent
d5f5415add
commit
6641683d66
7 changed files with 71 additions and 18 deletions
|
@ -1,5 +1,5 @@
|
|||
import litellm
|
||||
from litellm._logging import verbose_proxy_logger
|
||||
from litellm.proxy.guardrails.init_guardrails import guardrail_name_config_map
|
||||
from litellm.proxy.proxy_server import UserAPIKeyAuth
|
||||
from litellm.types.guardrails import *
|
||||
|
||||
|
@ -31,7 +31,7 @@ async def should_proceed_based_on_metadata(data: dict, guardrail_name: str) -> b
|
|||
continue
|
||||
|
||||
# lookup the guardrail in guardrail_name_config_map
|
||||
guardrail_item: GuardrailItem = guardrail_name_config_map[
|
||||
guardrail_item: GuardrailItem = litellm.guardrail_name_config_map[
|
||||
_guardrail_name
|
||||
]
|
||||
|
||||
|
@ -80,7 +80,9 @@ async def should_proceed_based_on_api_key(
|
|||
continue
|
||||
|
||||
# lookup the guardrail in guardrail_name_config_map
|
||||
guardrail_item: GuardrailItem = guardrail_name_config_map[_guardrail_name]
|
||||
guardrail_item: GuardrailItem = litellm.guardrail_name_config_map[
|
||||
_guardrail_name
|
||||
]
|
||||
|
||||
guardrail_callbacks = guardrail_item.callbacks
|
||||
if guardrail_name in guardrail_callbacks:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue