(test) content policy violation error

This commit is contained in:
ishaan-jaff 2024-01-09 16:34:20 +05:30
parent 09874cc83f
commit cf98343eb5

View file

@ -352,6 +352,24 @@ def test_completion_mistral_exception():
# test_completion_mistral_exception() # test_completion_mistral_exception()
def test_content_policy_exceptionimage_generation_openai():
try:
litellm.set_verbose = True
response = litellm.image_generation(
prompt="a very bad prompt", model="dall-e-3"
)
print(f"response: {response}")
assert len(response.data) > 0
except litellm.ContentPolicyViolationError as e:
print("caught a content policy violation error! Passed")
pass
except Exception as e:
pytest.fail(f"An exception occurred - {str(e)}")
# test_image_generation_openai()
# # test_invalid_request_error(model="command-nightly") # # test_invalid_request_error(model="command-nightly")
# # Test 3: Rate Limit Errors # # Test 3: Rate Limit Errors
# def test_model_call(model): # def test_model_call(model):