Skip to content

Commit 1886d47

Browse files
authored
Merge pull request #85 from askui/feat/add-health-endpoint
introduce health endpoint for chat api
2 parents 978f472 + 971c059 commit 1886d47

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

src/chat/api/app.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from chat.api.assistants.dependencies import get_assistant_service
88
from chat.api.assistants.router import router as assistants_router
99
from chat.api.dependencies import get_settings
10+
from chat.api.health.router import router as health_router
1011
from chat.api.messages.router import router as messages_router
1112
from chat.api.runs.router import router as runs_router
1213
from chat.api.threads.router import router as threads_router
@@ -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: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from fastapi import APIRouter, status
2+
from pydantic import BaseModel
3+
4+
router = APIRouter(prefix="/health", tags=["healthcheck"])
5+
6+
7+
class HealthCheck(BaseModel):
8+
status: str = "OK"
9+
10+
11+
@router.get(
12+
"",
13+
summary="Perform a Health Check",
14+
response_description="Return HTTP Status Code 200 (OK)",
15+
status_code=status.HTTP_200_OK,
16+
)
17+
def get_health() -> HealthCheck:
18+
return HealthCheck(status="OK")

0 commit comments

Comments
 (0)