Medical Agentic RAG

Search for medical textbooks

Overview

Built for research and study of medical textbooks.

Medical Agentic RAG turns scanned Vietnamese medical textbooks into searchable sections and finds the passages that match a question, each with its book, section, page range and original page image. The agent steps on top of the search are planned (see Next).

Dai's figures, stated as goals and not a measured result of the code: about 2,000 books and 99.99%.

Not for clinical or diagnostic use. Answers come from textbooks, which can be dated or wrong.

Flow: scanned textbooks are transcribed with code checks, stored and indexed; a question is searched with hybrid search and reranking, every step traced. Planning, result checks and written answers are dashed boxes marked planned.

Who it is for

  • Medical students, lecturers and researchers who study from Vietnamese textbooks.
  • Readers who need the exact page a passage comes from.

How it works

  • AI transcription of scanned pages with code checks: a layout model crops each page, sections follow the book's own table of contents, hard pages go to a stronger model, and Vietnamese diacritics are checked.
  • Sections and page images are kept in a corpus store.
  • Hybrid search: two embedding models plus BM25 keyword search on accented and folded Vietnamese, fused with RRF, then reranked.

What is in the code

  • A search API that returns ranked sections with book, section, page range and the original page image.
  • A small test page to try the search in a browser.
  • Every step traced, from the question to the ranked results.

Tech stack

Python, FastAPI, PostgreSQL, MinIO, Qdrant, OpenSearch, Langfuse, Docker Compose, PyMuPDF, DocLayout-YOLO, vision LLMs, Qwen3 embeddings and reranker.

Next

Planned, not built yet:

  • An agent that plans the search: rewrites or splits a question and restores missing diacritics.
  • Result checks: search again, or say the answer is not in the books.
  • Written answers with citations to book, section and page.

New project? Let's talk.

Contact