forked from phoenix/litellm-mirror
Merge pull request #1673 from BerriAI/litellm_version_health_readiness
[Feat] return litellm version in health/readiness
This commit is contained in:
commit
1102863ca8
3 changed files with 12 additions and 5 deletions
|
@ -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",
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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}")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue