Backend Systems · AI Applications
Medical RAG Agent
An end-to-end medical question-answering and patient-record system combining hybrid retrieval, agent routing, short-term memory, long-term memory, and structured medical data storage.
Problem & motivation
Medical question answering requires more than a single model call: responses need grounded retrieval, transparent routing, durable context, and structured handling of user-specific records.
Technical implementation
- Built a modular Skill abstraction for local RAG, web search, medical-record insertion, and record retrieval.
- Implemented ReAct-style tool selection with intent routing and confidence-aware decision policies.
- Added Redis short-term chat memory and a long-term memory layer backed by Redis and Milvus.
- Designed FastAPI services with PostgreSQL medical records and Celery-backed asynchronous ingestion.
- Combined vector search, BM25 hybrid retrieval, query rewriting, and reranking with a repeatable evaluation workflow.
Engineering impact
- Evaluated retrieval quality across 50 benchmark cases.
- Improved recall@5 by 10.9 percentage points over vector-only retrieval.
- Reached 0.980 hit@5 while preserving source-grounded responses.
50-case benchmark comparing vector-only retrieval with the hybrid retrieval stage.
- 0.580
- Vector recall@5
- 0.689
- Hybrid recall@5
- 0.980
- Hybrid hit@5
- +18.7%
- Relative recall improvement