Claude Claude Opus 4.8 commited on
Bump to 0.2.0 and expose version + llm_enabled on /health
Browse files/health now reports the running version and whether an LLM key is
configured, so a deploy can be verified at a glance (GET /api/health).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WN4QRr6dTE2W7hQ2SDnLmY
- backend/app/__init__.py +1 -1
- backend/app/main.py +5 -4
- backend/tests/test_health.py +4 -1
- backend/tests/test_server.py +1 -1
backend/app/__init__.py
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
"""DocuAsk backend package."""
|
| 2 |
|
| 3 |
-
__version__ = "0.
|
|
|
|
| 1 |
"""DocuAsk backend package."""
|
| 2 |
|
| 3 |
+
__version__ = "0.2.0"
|
backend/app/main.py
CHANGED
|
@@ -16,7 +16,7 @@ from fastapi.middleware.cors import CORSMiddleware
|
|
| 16 |
from pydantic import BaseModel
|
| 17 |
|
| 18 |
from . import __version__, db
|
| 19 |
-
from .generate import generate_answer
|
| 20 |
from .parsing import DocumentError, chunk_text, extract_pdf_text
|
| 21 |
from .retrieval import DocumentIndex, best_sentence
|
| 22 |
from .store import store
|
|
@@ -56,9 +56,10 @@ app.add_middleware(
|
|
| 56 |
|
| 57 |
|
| 58 |
@app.get("/health")
|
| 59 |
-
def health() -> dict[str,
|
| 60 |
-
"""Liveness probe
|
| 61 |
-
|
|
|
|
| 62 |
|
| 63 |
|
| 64 |
def _looks_like_pdf(file: UploadFile) -> bool:
|
|
|
|
| 16 |
from pydantic import BaseModel
|
| 17 |
|
| 18 |
from . import __version__, db
|
| 19 |
+
from .generate import generate_answer, llm_available
|
| 20 |
from .parsing import DocumentError, chunk_text, extract_pdf_text
|
| 21 |
from .retrieval import DocumentIndex, best_sentence
|
| 22 |
from .store import store
|
|
|
|
| 56 |
|
| 57 |
|
| 58 |
@app.get("/health")
|
| 59 |
+
def health() -> dict[str, object]:
|
| 60 |
+
"""Liveness probe. Also reports the running version and whether LLM answer
|
| 61 |
+
generation is configured, which makes deploys easy to verify."""
|
| 62 |
+
return {"status": "ok", "version": __version__, "llm_enabled": llm_available()}
|
| 63 |
|
| 64 |
|
| 65 |
def _looks_like_pdf(file: UploadFile) -> bool:
|
backend/tests/test_health.py
CHANGED
|
@@ -10,4 +10,7 @@ client = TestClient(app)
|
|
| 10 |
def test_health_returns_ok():
|
| 11 |
response = client.get("/health")
|
| 12 |
assert response.status_code == 200
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
def test_health_returns_ok():
|
| 11 |
response = client.get("/health")
|
| 12 |
assert response.status_code == 200
|
| 13 |
+
body = response.json()
|
| 14 |
+
assert body["status"] == "ok"
|
| 15 |
+
assert "version" in body
|
| 16 |
+
assert "llm_enabled" in body
|
backend/tests/test_server.py
CHANGED
|
@@ -14,4 +14,4 @@ client = TestClient(root)
|
|
| 14 |
def test_api_is_mounted_under_api_prefix():
|
| 15 |
response = client.get("/api/health")
|
| 16 |
assert response.status_code == 200
|
| 17 |
-
assert response.json() ==
|
|
|
|
| 14 |
def test_api_is_mounted_under_api_prefix():
|
| 15 |
response = client.get("/api/health")
|
| 16 |
assert response.status_code == 200
|
| 17 |
+
assert response.json()["status"] == "ok"
|