feat: add health check route (#1822)
This commit is contained in:
10
letta/schemas/health.py
Normal file
10
letta/schemas/health.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class Health(BaseModel):
|
||||
"""
|
||||
Health check response body
|
||||
"""
|
||||
|
||||
version: str
|
||||
status: str
|
||||
@@ -1,5 +1,6 @@
|
||||
from letta.server.rest_api.routers.v1.agents import router as agents_router
|
||||
from letta.server.rest_api.routers.v1.blocks import router as blocks_router
|
||||
from letta.server.rest_api.routers.v1.health import router as health_router
|
||||
from letta.server.rest_api.routers.v1.jobs import router as jobs_router
|
||||
from letta.server.rest_api.routers.v1.llms import router as llm_router
|
||||
from letta.server.rest_api.routers.v1.sources import router as sources_router
|
||||
@@ -12,4 +13,5 @@ ROUTERS = [
|
||||
llm_router,
|
||||
blocks_router,
|
||||
jobs_router,
|
||||
health_router,
|
||||
]
|
||||
|
||||
20
letta/server/rest_api/routers/v1/health.py
Normal file
20
letta/server/rest_api/routers/v1/health.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from fastapi import APIRouter
|
||||
|
||||
from letta.cli.cli import version
|
||||
from letta.schemas.health import Health
|
||||
|
||||
if TYPE_CHECKING:
|
||||
pass
|
||||
|
||||
router = APIRouter(prefix="/health", tags=["health"])
|
||||
|
||||
|
||||
# Health check
|
||||
@router.get("/", response_model=Health, operation_id="health_check")
|
||||
def health_check():
|
||||
return Health(
|
||||
version=version(),
|
||||
status="ok",
|
||||
)
|
||||
Reference in New Issue
Block a user