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", } ``` 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") 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}")