This commit is contained in:
ishaan-jaff 2023-09-19 21:57:35 -07:00
parent ade3079a28
commit 0ca08b1545
3 changed files with 5 additions and 2 deletions

View file

@ -1272,7 +1272,6 @@ def moderation(*args, **kwargs):
api_key = None api_key = None
if "api_key" in kwargs: if "api_key" in kwargs:
api_key = kwargs["api_key"] api_key = kwargs["api_key"]
api_key = ( api_key = (
api_key or api_key or
litellm.api_key or litellm.api_key or
@ -1280,6 +1279,8 @@ def moderation(*args, **kwargs):
get_secret("OPENAI_API_KEY") get_secret("OPENAI_API_KEY")
) )
openai.api_key = api_key openai.api_key = api_key
openai.api_type = "open_ai"
openai.api_base = "https://api.openai.com/v1"
response = openai.Moderation.create(*args, **kwargs) response = openai.Moderation.create(*args, **kwargs)
return response return response

View file

@ -814,6 +814,8 @@ def test_completion_ai21():
# test_completion_together_ai_stream() # test_completion_together_ai_stream()
def test_moderation(): def test_moderation():
import openai
openai.api_type = "azure"
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]

View file

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "litellm" name = "litellm"
version = "0.1.708" version = "0.1.710"
description = "Library to easily interface with LLM API providers" description = "Library to easily interface with LLM API providers"
authors = ["BerriAI"] authors = ["BerriAI"]
license = "MIT License" license = "MIT License"