- #11 VectorIndexProtocol for typed duck-typing of vector_index param - #10 Wrap all sync VectorIndex.query() calls in asyncio.to_thread - #9 Make vector_search async (consistent with to_thread wrapping) - #12 Replace module-level singleton with app.state.query_service - #13 InMemoryGraphDB.close(destroy=False) guard for test safety - #14 Parse dates with datetime.fromisoformat in list_cases sort Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
14 lines
377 B
Python
14 lines
377 B
Python
"""FastAPI dependency providers."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from fastapi import Request
|
|
|
|
from aucourt_ingest.api.service import QueryService
|
|
|
|
|
|
def get_query_service(request: Request) -> QueryService:
|
|
svc = request.app.state.query_service
|
|
if svc is None:
|
|
raise RuntimeError("QueryService not initialised — call create_app() first")
|
|
return svc
|