forked from phoenix/litellm-mirror
(fix) fix moderation test
This commit is contained in:
parent
573515ec3d
commit
a575efb4ee
3 changed files with 9 additions and 6 deletions
|
@ -2962,8 +2962,11 @@ def text_completion(
|
||||||
|
|
||||||
|
|
||||||
##### Moderation #######################
|
##### 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
|
# only supports open ai for now
|
||||||
api_key = (
|
api_key = (
|
||||||
api_key or litellm.api_key or litellm.openai_key or get_secret("OPENAI_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
|
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:
|
model_info:
|
||||||
base_model: azure/gpt-4
|
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:
|
litellm_settings:
|
||||||
fallbacks: [{"openai-gpt-3.5": ["azure-gpt-3.5"]}]
|
fallbacks: [{"openai-gpt-3.5": ["azure-gpt-3.5"]}]
|
||||||
success_callback: ['langfuse']
|
success_callback: ['langfuse']
|
||||||
|
|
|
@ -2093,10 +2093,6 @@ def test_completion_cloudflare():
|
||||||
|
|
||||||
|
|
||||||
def test_moderation():
|
def test_moderation():
|
||||||
import openai
|
|
||||||
|
|
||||||
openai.api_type = "azure"
|
|
||||||
openai.api_version = "GM"
|
|
||||||
response = litellm.moderation(input="i'm ishaan cto of litellm")
|
response = litellm.moderation(input="i'm ishaan cto of litellm")
|
||||||
print(response)
|
print(response)
|
||||||
output = response.results[0]
|
output = response.results[0]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue