diff --git a/litellm/main.py b/litellm/main.py index 585de7fff5..352ce18827 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -2962,8 +2962,11 @@ def text_completion( ##### Moderation ####################### -@client -def moderation(input: str, model: str, api_key: Optional[str] = None, **kwargs): + + +def moderation( + input: str, model: Optional[str] = None, api_key: Optional[str] = None, **kwargs +): # only supports open ai for now api_key = ( api_key or litellm.api_key or litellm.openai_key or get_secret("OPENAI_API_KEY") diff --git a/litellm/proxy/proxy_config.yaml b/litellm/proxy/proxy_config.yaml index 8d35bcae81..d94f987db7 100644 --- a/litellm/proxy/proxy_config.yaml +++ b/litellm/proxy/proxy_config.yaml @@ -32,6 +32,10 @@ model_list: api_key: os.environ/AZURE_API_KEY # The `os.environ/` prefix tells litellm to read this from the env. See https://docs.litellm.ai/docs/simple_proxy#load-api-keys-from-vault model_info: base_model: azure/gpt-4 + - model_name: text-moderation-stable + litellm_params: + model: text-moderation-stable + api_key: os.environ/OPENAI_API_KEY litellm_settings: fallbacks: [{"openai-gpt-3.5": ["azure-gpt-3.5"]}] success_callback: ['langfuse'] diff --git a/litellm/tests/test_completion.py b/litellm/tests/test_completion.py index e93b00ef67..17ced73821 100644 --- a/litellm/tests/test_completion.py +++ b/litellm/tests/test_completion.py @@ -2093,10 +2093,6 @@ def test_completion_cloudflare(): def test_moderation(): - import openai - - openai.api_type = "azure" - openai.api_version = "GM" response = litellm.moderation(input="i'm ishaan cto of litellm") print(response) output = response.results[0]