feat(proxy_server.py): add new images/generation endpoint

This commit is contained in:
Krrish Dholakia 2023-12-21 15:39:09 +05:30
parent 8101ad6801
commit 14115d0d60
4 changed files with 112 additions and 8 deletions

View file

@ -101,7 +101,7 @@ def test_chat_completion_azure(client_no_auth):
# Run the test
# test_chat_completion_azure()
### EMBEDDING
def test_embedding(client_no_auth):
global headers
from litellm.proxy.proxy_server import user_custom_auth
@ -161,7 +161,30 @@ def test_sagemaker_embedding(client_no_auth):
# Run the test
# test_embedding()
#### IMAGE GENERATION
def test_img_gen(client_no_auth):
global headers
from litellm.proxy.proxy_server import user_custom_auth
try:
test_data = {
"model": "dall-e-3",
"prompt": "A cute baby sea otter",
"n": 1,
"size": "1024x1024"
}
response = client_no_auth.post("/v1/images/generations", json=test_data)
assert response.status_code == 200
result = response.json()
print(len(result["data"][0]["url"]))
assert len(result["data"][0]["url"]) > 10
except Exception as e:
pytest.fail(f"LiteLLM Proxy test failed. Exception - {str(e)}")
#### ADDITIONAL
# @pytest.mark.skip(reason="hitting yaml load issues on circle-ci")
def test_add_new_model(client_no_auth):
global headers