Add rudimentary health check (#155)

This commit is contained in:
Yi Hong Ang
2025-05-08 00:35:53 -07:00
committed by GitHub
parent 4a176da038
commit 02a0241581
+12
View File
@@ -772,11 +772,23 @@ class APIHandler(BaseHTTPRequestHandler):
"""
if self.path == "/v1/models":
self.handle_models_request()
elif self.path == "/health":
self.handle_health_check()
else:
self._set_completion_headers(404)
self.end_headers()
self.wfile.write(b"Not Found")
def handle_health_check(self):
"""
Handle a GET request for the /health endpoint.
"""
self._set_completion_headers(200)
self.end_headers()
self.wfile.write('{"status": "ok"}'.encode())
self.wfile.flush()
def handle_models_request(self):
"""
Handle a GET request for the /v1/models endpoint.