crgmail commited on
Commit
ec80ecb
·
verified ·
1 Parent(s): 07925ff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -214,11 +214,17 @@ async def root():
214
 
215
  @app.get("/health")
216
  async def health():
217
- return {
218
- "status": "ok",
219
- "embed_status": models["embed_status"],
220
- "rerank_status": models["rerank_status"],
221
- }
 
 
 
 
 
 
222
 
223
 
224
  @app.get("/v1/models", dependencies=[Depends(verify_api_key)])
 
214
 
215
  @app.get("/health")
216
  async def health():
217
+ embed_ok = models["embed_status"] == "ready"
218
+ rerank_ok = models["rerank_status"] == "ready"
219
+ all_ok = embed_ok and rerank_ok
220
+ return JSONResponse(
221
+ status_code=200 if all_ok else 503,
222
+ content={
223
+ "status": "ok" if all_ok else "degraded",
224
+ "embed_status": models["embed_status"],
225
+ "rerank_status": models["rerank_status"],
226
+ }
227
+ )
228
 
229
 
230
  @app.get("/v1/models", dependencies=[Depends(verify_api_key)])