Retrieval-Augmented Generation
Built a workflow that retrieves relevant medical reference material to provide context for generated responses.
Retrieval-Augmented Generation · Full-Stack Development
A medical-information chatbot that combines document retrieval, vector search, and language-model generation to produce responses informed by trusted reference material.

The Project
Large language models can generate fluent explanations, but their responses are not necessarily grounded in reliable reference material. This limitation is particularly important when discussing health-related information.
I developed a retrieval-augmented chatbot that combines a language model with a searchable collection of medical reference content. Instead of generating an answer entirely from the model's existing knowledge, the application retrieves relevant material and incorporates it into the response-generation process.
The project brought together backend API development, document processing, vector search, and frontend development into a single application.
Key Contributions
Built a workflow that retrieves relevant medical reference material to provide context for generated responses.
Connected a Python-based API to a Next.js interface, creating an end-to-end application.
Designed the application around established medical reference material rather than relying exclusively on a language model's general knowledge.
Behind the Build
The application uses a Next.js frontend and a Python FastAPI backend. The frontend provides the user interface, while the backend handles retrieval and language-model interactions.
The retrieval system stores OpenAI embeddings of the source content in a precomputed index and searches it with in-memory NumPy cosine similarity, then passes the most relevant passages to a language model to generate grounded responses. Questions that don't match any source closely enough are declined rather than answered from the model's general knowledge.
Separating the interface, API, and retrieval components makes the system easier to understand, maintain, and extend.
The ingestion workflow processes medical reference pages into smaller text chunks that can be embedded and stored in the vector database.
When a user submits a question, the application searches for relevant chunks and supplies the retrieved context to the language model.
This approach allows responses to draw on an identifiable collection of source material instead of relying only on the model's pretrained knowledge.
The backend is implemented with FastAPI, providing an HTTP interface for the frontend to submit questions and receive generated responses.
The application uses LangChain components to connect document retrieval, embeddings, and language-model calls.
The frontend is built with Next.js and TypeScript. It communicates with the backend through API requests and presents responses through a web interface.
One important design decision was keeping the retrieval and generation workflow on the backend rather than embedding those responsibilities in the frontend.
The project also required coordinating services with different responsibilities, including document ingestion, vector storage, API communication, and response generation.
Because the application operates in a medical-information context, source quality and the limitations of generated responses are especially important considerations.
The project demonstrates a working full-stack retrieval-augmented generation workflow, from medical-content ingestion through user-facing question answering.
It also provided practical experience integrating a vector database, embeddings, language-model calls, and a web application.
Potential future improvements include more systematic retrieval evaluation, stronger source attribution, a larger document collection, and additional safeguards for medical-information use.
The application is an engineering demonstration, not a clinically validated medical advice system. No formal accuracy or clinical performance metrics are claimed.
I evaluated the system on a 42-question benchmark: 30 questions answerable from the indexed pages and 12 that should be refused, including health topics the knowledge base doesn't cover. The correct source page ranked first for all 30 answerable questions, and all 12 out-of-scope questions were refused.
A threshold sweep showed a clear gap between the lowest-scoring answerable question (0.397) and the highest-scoring out-of-scope question (0.343), so I set the relevance threshold to 0.37. Because the benchmark is small and hand-written, expanding it with real user questions is the next step.