mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 11:43:54 +00:00
(fix) fix moderation test
This commit is contained in:
parent
b895ac8b08
commit
afff73e38e
3 changed files with 9 additions and 6 deletions
|
@ -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")
|
||||
|
|
|
@ -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']
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue