feat: Add Azure Content-Safety Proxy hooks

Signed-off-by: Lunik <lunik@tiwabbit.fr>
This commit is contained in:
Lunik 2024-05-02 23:12:48 +02:00
parent 7ffe410097
commit 6cec252b07
No known key found for this signature in database
GPG key ID: AEC152C8AC2C85EE
2 changed files with 174 additions and 0 deletions

View file

@ -2235,6 +2235,23 @@ class ProxyConfig:
batch_redis_obj = _PROXY_BatchRedisRequests()
imported_list.append(batch_redis_obj)
elif (
isinstance(callback, str)
and callback == "azure_content_safety"
):
from litellm.proxy.hooks.azure_content_safety import (
_PROXY_AzureContentSafety,
)
azure_content_safety_params = litellm_settings["azure_content_safety_params"]
for k, v in azure_content_safety_params.items():
if v is not None and isinstance(v, str) and v.startswith("os.environ/"):
azure_content_safety_params[k] = litellm.get_secret(v)
azure_content_safety_obj = _PROXY_AzureContentSafety(
**azure_content_safety_params,
)
imported_list.append(azure_content_safety_obj)
else:
imported_list.append(
get_instance_fn(