Merge pull request #2087 from BerriAI/litellm_llm_guard_integration

feat(llm_guard.py): support llm guard for content moderation
This commit is contained in:
Krish Dholakia 2024-02-19 22:48:12 -08:00 committed by GitHub
commit e2da1e8ac5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 259 additions and 0 deletions

View file

@ -1469,6 +1469,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(