| title | emoji | colorFrom | colorTo | sdk | pinned |
|---|---|---|---|---|---|
Medical Rag Chatbot |
⚡ |
red |
green |
docker |
false |
FastAPI · LangChain · Pinecone · Google Gemini
A Retrieval-Augmented Generation (RAG) based medical chatbot that provides grounded, evidence-based medical information using external medical documents stored in Pinecone.
The system is intentionally designed with strict safety constraints:
- Responses are generated only from retrieved medical context
- If no relevant context is found, the chatbot refuses to guess
- The system is for educational purposes only
Before running ingestion or starting the chatbot, a Pinecone index must be created manually via the Pinecone dashboard.
Steps:
- Log in to the Pinecone web dashboard
- Create a new index
- Configure the index with:
- Embedding dimension matching the embedding model
- Similarity metric (e.g. cosine)
- Save the index name
⚠️ Index creation is not handled by this codebase.
All medical knowledge lives in Pinecone.
The chatbot will not work until documents are ingested.
python ingest_pdfs.py
⚠️ If the Pinecone index is empty, the chatbot will intentionally refuse to answer.
- Stores document embeddings
- Performs semantic similarity search
- Acts as the single source of truth
No documents are stored in Docker or FastAPI.
| Method | Endpoint | Description |
|---|---|---|
| GET | / |
Load chatbot UI |
| POST | /get |
Stream chatbot responses |
Queries are classified to decide whether retrieval is required. This reduces hallucinations, cost, and latency.
This is true RAG, not prompt stuffing.
- Context is retrieved dynamically per query
- Injected automatically as
{context} - LLM is restricted to retrieved information only
Responses are streamed using Server-Sent Events (SSE) for better UX.
- No diagnosis
- No prescriptions
- No guessing without context
- Always includes a medical disclaimer
Docker is optional and used only for runtime. All medical knowledge remains in Pinecone.
The project currently operates using a single Pinecone namespace.
Although multi-namespace support is not available right now, the current design makes it easy to introduce this feature later without significant changes to the codebase.
PINECONE_API_KEY=your_key
PINECONE_INDEX_NAME=your_index
GEMINI_API_KEY=your_key
PORT=5678python pinecone_ingession/ingest_pdfs.py # One-time ingestion
uvicorn app:app --reloadOpen: http://localhost:5678
This project is for educational purposes only and does not replace professional medical advice.