feat(llm_guard.py): support llm guard for content moderation

https://github.com/BerriAI/litellm/issues/2056
This commit is contained in:
Krrish Dholakia 2024-02-19 20:51:25 -08:00
parent f119e190cf
commit 66e4abcb0d
3 changed files with 227 additions and 0 deletions

View file

@ -1467,6 +1467,16 @@ class ProxyConfig:
_ENTERPRISE_GoogleTextModeration()
)
imported_list.append(google_text_moderation_obj)
elif (
isinstance(callback, str)
and callback == "llmguard_moderations"
):
from litellm.proxy.enterprise.enterprise_hooks.llm_guard import (
_ENTERPRISE_LLMGuard,
)
llm_guard_moderation_obj = _ENTERPRISE_LLMGuard()
imported_list.append(llm_guard_moderation_obj)
else:
imported_list.append(
get_instance_fn(