A Streamlit-based Retrieval-Augmented Generation (RAG) app that lets you upload or point to a medical reference PDF (for example, the Merck Manual), builds an embeddings-backed knowledge base, and answers clinical questions grounded in the source material.
Key features
- Upload or use an existing PDF to create a local knowledge base
- Vector embeddings with ChromaDB + OpenAI embeddings
- Retrieval + generation pipeline returning evidence-based answers with source citations
- Sidebar configuration (API key, model params) and conversation history
Important: This project was developed and tested with Python 3.13. Using Python 3.14 on Windows may cause wheel/build problems for some dependencies (for example, Pillow). If you see build errors while installing dependencies, recreate the venv with Python 3.13.
Quick Start — Windows
- Install Python 3.13 (recommended).
- From the repository root create a dedicated venv and install requirements:
& "C:\\Path\\To\\Python313\\python.exe" -m venv .venv313
& ".\.venv313\\Scripts\\Activate.ps1"
python -m pip install --upgrade pip
pip install -r Project2/requirements.txt- Run the app (with the venv active):
& ".\.venv313\\Scripts\\python.exe" -m streamlit run Project2/app.pyOpen the Local URL printed by Streamlit (e.g., http://localhost:8501 or :8502).
Configuration / API keys
You must provide an OpenAI API key. Options:
- Sidebar input (quick but less secure)
Project2/config.jsonnext toapp.py:
{
"OPENAI_API_KEY": "sk-...",
"OPENAI_API_BASE": "https://api.openai.com/v1"
}- Streamlit secrets (
.streamlit/secrets.toml):
OPENAI_API_KEY = "sk-..."
OPENAI_API_BASE = "https://api.openai.com/v1" # optional- Environment variables (then restart terminal/Streamlit):
setx OPENAI_API_KEY "sk-..."
setx OPENAI_API_BASE "https://api.openai.com/v1"Provide a PDF
-
Use
Use existing PDF filein the sidebar and supply either a workspace-relative path or the absolute path. Examples:- Relative:
Project2/medical_diagnosis_manual.pdf - Absolute:
C:\\Users\\avsan\\OneDrive\\Great Learning Gen AI\\Project_2\\Project2\\medical_diagnosis_manual.pdf
- Relative:
-
Or choose
Upload new PDFand clickProcess PDFto upload and build the knowledge base for the session.
The app attempts multiple path resolutions automatically. If you see "File not found", verify the path and try an absolute path.
File map
Project2/app.py— main Streamlit applicationProject2/requirements.txt— dependenciesProject2/medical_diagnosis_manual.pdf— example PDF included
Developer notes & known issues
- The repo includes code to handle LangChain import variations and retriever API differences; if you update LangChain, watch for breaking API changes.
- Pillow and some binaries may not ship wheels for Python 3.14 on Windows; use Python 3.13 if you encounter build failures.
- Vectorstore is in-memory by default; for production, persist Chroma to disk or a managed store.
Docker
Build and run the container (example):
# build from repository root
docker build -t medical-assistant:latest Project2
# run (pass your API key)
docker run -e OPENAI_API_KEY=sk-... -p 8501:8501 medical-assistant:latestTroubleshooting
ModuleNotFoundError: make sure you installedrequirements.txtinto the same Python used to run Streamlit.Error loading credentials: No secrets found: add API key via sidebar,config.json, environment variables, or.streamlit/secrets.toml.VectorStoreRetriever has no get_relevant_documents: ensure PDF processing completed and the vectorstore was created (sidebar should showSystem Ready). The app contains retriever fallbacks to handle multiple langchain/chroma versions.
If you want, I can also add:
CONTRIBUTING.mdwith dev flow and testing steps.env.exampleand safer local dev secret handling- a persistent Chroma example
License: add your preferred license file if you plan to publish this project.