Skip to content

Commit

Permalink
feat: add health check route (#1822)
Browse files Browse the repository at this point in the history
  • Loading branch information
4shub authored Oct 2, 2024
2 parents e7c862b + ce32a47 commit 5fb1649
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
10 changes: 10 additions & 0 deletions letta/schemas/health.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from pydantic import BaseModel


class Health(BaseModel):
"""
Health check response body
"""

version: str
status: str
2 changes: 2 additions & 0 deletions letta/server/rest_api/routers/v1/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -12,4 +13,5 @@
llm_router,
blocks_router,
jobs_router,
health_router,
]
20 changes: 20 additions & 0 deletions letta/server/rest_api/routers/v1/health.py
Original file line number Diff line number Diff line change
@@ -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",
)

0 comments on commit 5fb1649

Please sign in to comment.