Add read-only production runtime audit
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
# ADR 0001: Use Qdrant as the vector database
|
||||
|
||||
## Status
|
||||
|
||||
Accepted
|
||||
|
||||
## Context
|
||||
|
||||
The RAG pipeline needs a vector store for drug-monograph chunks. The main
|
||||
alternative considered was **pgvector** (a Postgres extension), which would
|
||||
let us reuse the Postgres instance already needed for users/chat history —
|
||||
one fewer moving part to operate.
|
||||
|
||||
The corpus is not free-flowing prose: it's a structured per-drug reference
|
||||
with rich per-chunk metadata (drug name, section type, page range). The
|
||||
common retrieval pattern this domain calls for is "vector similarity search,
|
||||
filtered by metadata" — e.g. "search only within chỉ định sections" or
|
||||
"filter to a specific drug the user named" combined with the semantic query.
|
||||
|
||||
## Decision
|
||||
|
||||
Use **Qdrant** as a dedicated vector database, separate from Postgres.
|
||||
|
||||
## Rationale
|
||||
|
||||
- Qdrant gives first-class combined payload-filtering + ANN search in a
|
||||
single query, which is exactly the retrieval pattern this structured
|
||||
corpus needs — pgvector supports filtering too, but it's a less natural
|
||||
fit layered on top of a general-purpose relational engine.
|
||||
- Vector search becomes its own independent scaling axis, separate from the
|
||||
transactional Postgres workload (users/chat) — re-indexing or re-ingesting
|
||||
the formulary doesn't contend with transactional traffic.
|
||||
- Mature standalone Docker image for local dev, a well-supported Python
|
||||
client, and a Helm chart for the production Kubernetes deployment target.
|
||||
- Corpus size (tens of thousands of chunks) is trivial for Qdrant's HNSW
|
||||
indexing.
|
||||
|
||||
## Consequences
|
||||
|
||||
- One additional service to operate/deploy/monitor compared to pgvector
|
||||
(which would ride on the existing Postgres).
|
||||
- Revisit if operational overhead becomes a real burden at our actual scale,
|
||||
or if we want tighter transactional consistency between chat data and
|
||||
retrieval — pgvector remains a viable fallback documented here for that
|
||||
case.
|
||||
Reference in New Issue
Block a user