8000 Added health check endpoint · mikeFore4/llama-cpp-python@28652d2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 28652d2

Browse files
committed
Added health check endpoint
1 parent b64fa4e commit 28652d2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

llama_cpp/server/app.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from fastapi.middleware import Middleware
1717
from fastapi.middleware.cors import CORSMiddleware
1818
from fastapi.security import HTTPBearer
19+
from fastapi_health import health
1920
from sse_starlette.sse import EventSourceResponse
2021
from starlette_context.plugins import RequestIdPlugin # type: ignore
2122
from starlette_context.middleware import RawContextMiddleware
@@ -43,7 +44,11 @@
4344
from llama_cpp.server.errors import RouteErrorHandler
4445

4546

47+
def check_health():
48+
return True
49+
4650
router = APIRouter(route_class=RouteErrorHandler)
51+
router.add_api_route("/health", health([check_health]))
4752

4853
_server_settings: Optional[ServerSettings] = None
4954

0 commit comments

Comments
 (0)
0