Skip to content

Commit df66e7c

Browse files
committed
feat: introduces health endpoint
1 parent 1254b98 commit df66e7c

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

src/chat/api/app.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from chat.api.messages.router import router as messages_router
1111
from chat.api.runs.router import router as runs_router
1212
from chat.api.threads.router import router as threads_router
13+
from chat.api.health.router import router as health_router
1314

1415

1516
@asynccontextmanager
@@ -40,4 +41,5 @@ async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]: # noqa: ARG001
4041
v1_router.include_router(threads_router)
4142
v1_router.include_router(messages_router)
4243
v1_router.include_router(runs_router)
44+
v1_router.include_router(health_router)
4345
app.include_router(v1_router)

src/chat/api/health/__init__.py

Whitespace-only changes.

src/chat/api/health/router.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from fastapi import APIRouter, HTTPException, status
2+
from pydantic import BaseModel
3+
4+
5+
router = APIRouter(prefix="/health", tags=["healthcheck"])
6+
7+
8+
class HealthCheck(BaseModel):
9+
status: str = "OK"
10+
11+
12+
@router.get(
13+
"",
14+
summary="Perform a Health Check",
15+
response_description="Return HTTP Status Code 200 (OK)",
16+
status_code=status.HTTP_200_OK,
17+
)
18+
def get_health() -> HealthCheck:
19+
return HealthCheck(status="OK")

0 commit comments

Comments
 (0)