mirror of
https://github.com/getzep/graphiti.git
synced 2025-06-27 02:00:02 +00:00

* chore: Add healthcheck endpoint + build indexes and constraints on svc startup * chore: Bring back driver close call
30 lines
719 B
Python
30 lines
719 B
Python
from contextlib import asynccontextmanager
|
|
|
|
from fastapi import FastAPI
|
|
from fastapi.responses import JSONResponse
|
|
|
|
from graph_service.config import get_settings
|
|
from graph_service.routers import ingest, retrieve
|
|
from graph_service.zep_graphiti import initialize_graphiti
|
|
|
|
|
|
@asynccontextmanager
|
|
async def lifespan(_: FastAPI):
|
|
settings = get_settings()
|
|
await initialize_graphiti(settings)
|
|
yield
|
|
# Shutdown
|
|
# No need to close Graphiti here, as it's handled per-request
|
|
|
|
|
|
app = FastAPI(lifespan=lifespan)
|
|
|
|
|
|
app.include_router(retrieve.router)
|
|
app.include_router(ingest.router)
|
|
|
|
|
|
@app.get('/healthcheck')
|
|
async def healthcheck():
|
|
return JSONResponse(content={'status': 'healthy'}, status_code=200)
|