From d974e5971a54b3966520bd9cc5575994a68bfdd3 Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Mon, 29 Jan 2024 15:21:08 -0800 Subject: [PATCH 1/3] (docs) /healthreadiness --- docs/my-website/docs/proxy/health.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/my-website/docs/proxy/health.md b/docs/my-website/docs/proxy/health.md index 12138ce0a..5c73de4af 100644 --- a/docs/my-website/docs/proxy/health.md +++ b/docs/my-website/docs/proxy/health.md @@ -112,7 +112,8 @@ Example Response: ```json { "status": "healthy", - "db": "connected" + "db": "connected", + "litellm_version":"1.19.2", } ``` @@ -121,7 +122,8 @@ Example Response: ```json { "status": "healthy", - "db": "Not connected" + "db": "Not connected", + "litellm_version":"1.19.2", } ``` From 6097102c2130dc89a40bcfa2bf86904545f91a9b Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Mon, 29 Jan 2024 15:27:25 -0800 Subject: [PATCH 2/3] (test) /health/readiness --- tests/test_health.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_health.py b/tests/test_health.py index f0a89f529..00f095022 100644 --- a/tests/test_health.py +++ b/tests/test_health.py @@ -70,10 +70,11 @@ async def test_health_readiness(): url = "http://0.0.0.0:4000/health/readiness" async with session.get(url) as response: status = response.status - response_text = await response.text() + response_json = await response.json() - print(response_text) - print() + print(response_json) + assert "litellm_version" in response_json + assert "status" in response_json if status != 200: raise Exception(f"Request did not return a 200 status code: {status}") From 67e8a0115d9252b7df6f994dd3eb9fdee36428ef Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Mon, 29 Jan 2024 15:28:08 -0800 Subject: [PATCH 3/3] (feat) proxy return version in /health/readiness --- litellm/proxy/proxy_server.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index d9944e6e1..dd9b509d9 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -3617,6 +3617,8 @@ async def health_readiness(): cache_type = None if litellm.cache is not None: cache_type = litellm.cache.type + from litellm._version import version + if prisma_client is not None: # if db passed in, check if it's connected if prisma_client.db.is_connected() == True: response_object = {"db": "connected"} @@ -3625,6 +3627,7 @@ async def health_readiness(): "status": "healthy", "db": "connected", "cache": cache_type, + "litellm_version": version, "success_callbacks": litellm.success_callback, } else: @@ -3632,6 +3635,7 @@ async def health_readiness(): "status": "healthy", "db": "Not connected", "cache": cache_type, + "litellm_version": version, "success_callbacks": litellm.success_callback, } raise HTTPException(status_code=503, detail="Service Unhealthy")