-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(fix) don't block proxy startup if license check fails & using promet…
…heus (#6839) * fix - don't block proxy startup if not a premium user * test_litellm_proxy_server_config_with_prometheus * add test for proxy startup * fix remove unused test * fix startup test * add comment on bad-license
- Loading branch information
1 parent
cc1f8ff
commit ddfe687
Showing
4 changed files
with
113 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
model_list: | ||
- model_name: gpt-4 | ||
litellm_params: | ||
model: openai/fake | ||
api_key: fake-key | ||
api_base: https://exampleopenaiendpoint-production.up.railway.app/ | ||
tags: ["teamA"] | ||
model_info: | ||
id: "team-a-model" | ||
|
||
litellm_settings: | ||
cache: true | ||
callbacks: ["prometheus"] | ||
|
||
router_settings: | ||
enable_tag_filtering: True # 👈 Key Change | ||
|
51 changes: 51 additions & 0 deletions
51
tests/basic_proxy_startup_tests/test_basic_proxy_startup.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
""" | ||
This test ensures that the proxy starts and serves requests even with a bad license. | ||
in ci/cd config.yml, we set the license to "bad-license" | ||
""" | ||
|
||
import pytest | ||
import aiohttp | ||
from typing import Optional | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_health_and_chat_completion(): | ||
""" | ||
Test health endpoints and chat completion: | ||
1. Check /health/readiness | ||
2. Check /health/liveness | ||
3. Make a chat completion call | ||
""" | ||
async with aiohttp.ClientSession() as session: | ||
# Test readiness endpoint | ||
async with session.get("http://0.0.0.0:4000/health/readiness") as response: | ||
assert response.status == 200 | ||
readiness_response = await response.json() | ||
assert readiness_response["status"] == "connected" | ||
|
||
# Test liveness endpoint | ||
async with session.get("http://0.0.0.0:4000/health/liveness") as response: | ||
assert response.status == 200 | ||
liveness_response = await response.json() | ||
print("liveness_response", liveness_response) | ||
|
||
# Make a chat completion call | ||
url = "http://0.0.0.0:4000/chat/completions" | ||
headers = { | ||
"Authorization": "Bearer sk-1234", | ||
"Content-Type": "application/json", | ||
} | ||
data = { | ||
"model": "gpt-4", | ||
"messages": [ | ||
{"role": "system", "content": "You are a helpful assistant."}, | ||
{"role": "user", "content": "Hello!"}, | ||
], | ||
} | ||
|
||
async with session.post(url, headers=headers, json=data) as response: | ||
assert response.status == 200 | ||
completion_response = await response.json() | ||
assert "choices" in completion_response |
hey @ishaan-jaff does this check make sure prometheus metrics do not work for free users ?