Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add health check route #1822

Merged
merged 2 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions letta/schemas/health.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
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
Expand Up @@ -4,6 +4,7 @@
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
from letta.server.rest_api.routers.v1.tools import router as tools_router
from letta.server.rest_api.routers.v1.health import router as health_router

ROUTERS = [
tools_router,
Expand All @@ -12,4 +13,5 @@
llm_router,
blocks_router,
jobs_router,
health_router,
]
21 changes: 21 additions & 0 deletions letta/server/rest_api/routers/v1/health.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from typing import TYPE_CHECKING, List, Optional

from fastapi import APIRouter, Body, Depends, HTTPException, Query

from letta.cli.cli import version
from letta.schemas.health import Health
from letta.server.rest_api.utils import get_letta_server
from letta.server.server import SyncServer

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",
)
Loading