Skip to content

Commit dcbbf07

Browse files
committed
fastapi_health endpoint added
1 parent ff66c1e commit dcbbf07

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

app/fastapi_app.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,3 +342,19 @@ def check_word_exists(word: str):
342342
model_wv = get_model()
343343

344344
return {"word": word, "exists": clean_word in model_wv}
345+
346+
347+
@app.get("/health", response_model=HealthResponse, tags=["General"])
348+
def health_check():
349+
"""
350+
Health check endpoint — verifies API and model status.
351+
"""
352+
model_wv = ml_models.get("wv")
353+
is_loaded = model_wv is not None
354+
355+
return {
356+
"status": "ok" if is_loaded else "model_not_loaded",
357+
"model_loaded": is_loaded,
358+
"vocabulary_size": len(model_wv) if is_loaded else None,
359+
}
360+

0 commit comments

Comments
 (0)