forked from phoenix/litellm-mirror
feat(prompt_injection_detection.py): support simple heuristic similarity check for prompt injection attacks
This commit is contained in:
parent
ac867daadc
commit
234cdbbfef
3 changed files with 190 additions and 0 deletions
|
@ -1665,6 +1665,18 @@ class ProxyConfig:
|
|||
|
||||
banned_keywords_obj = _ENTERPRISE_BannedKeywords()
|
||||
imported_list.append(banned_keywords_obj)
|
||||
elif (
|
||||
isinstance(callback, str)
|
||||
and callback == "detect_prompt_injection"
|
||||
):
|
||||
from litellm.proxy.enterprise.enterprise_hooks.prompt_injection_detection import (
|
||||
_ENTERPRISE_PromptInjectionDetection,
|
||||
)
|
||||
|
||||
prompt_injection_detection_obj = (
|
||||
_ENTERPRISE_PromptInjectionDetection()
|
||||
)
|
||||
imported_list.append(prompt_injection_detection_obj)
|
||||
else:
|
||||
imported_list.append(
|
||||
get_instance_fn(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue