Files
PlantAI-dev/scripts/qa_v1_1_73_server.py
T
2026-08-21 11:04:28 +08:00

44 lines
1.1 KiB
Python

from __future__ import annotations
import sys
from pathlib import Path
from fastapi import FastAPI
PROJECT_ROOT = Path(__file__).resolve().parents[1]
QA_SERVICE_ROOT = PROJECT_ROOT / "services" / "qa_v1_1_73"
if str(QA_SERVICE_ROOT) not in sys.path:
sys.path.insert(0, str(QA_SERVICE_ROOT))
from src.rag.qa_v1_1_73 import __version__
from src.rag.qa_v1_1_73.api import router
from src.rag.qa_v1_1_73.backend_guard import validate_backends
app = FastAPI(
title="Plant Biology QA V1.1.73",
version=__version__,
description=(
"Production full-graph QA with assertion-anchored Qdrant recall, "
"bounded canonical Neo4j expansion, BGE reranking, and citation validation."
),
)
app.include_router(router)
@app.on_event("startup")
def validate_production_backends() -> None:
app.state.kb_backend_identity = validate_backends()
@app.get("/health")
def health():
return {
"status": "ok",
"service": "qa_v1_1_73",
"version": __version__,
"source": "plantai_git_repository",
"backend": app.state.kb_backend_identity,
}