Doc-bot is a chatbot that answers health-related questions using a medical PDF book.
Built with React, FastAPI, Gemini AI, and Pinecone.
Example: “What are the side effects of antidepressants?”
-
Frontend: React app (App.jsx) for chatting.
-
Backend: FastAPI (app.py) searches the book & calls AI.
-
AI Service (Node.js): geminiService.js uses the Gemini API to generate answers based on the retrieved context.
-
Vector Search (Pinecone): Stores embeddings (vector representations) of the medical PDF's text chunks for fast similarity search.
-
RAG Pipeline:
- Document Processing – The PDF is split into small chunks (few hundred words) for better search accuracy.
- Embeddings – Each chunk is converted into a numeric vector using an embedding model.
- Storage – These vectors are stored in Pinecone’s vector database.
- Query – When a user asks a question, it is converted to a vector embedding.
- Retrieval – Pinecone finds the most similar text chunks from the stored vectors.
- Answer Generation – The retrieved chunks are sent to Gemini AI along with the question to create a contextual, accurate answer.
git clone https://github.com/Ayush2911ojha/Doc-bot.git
cd Doc-bot
PINECONE_API_KEY=your_pinecone_api_key
GEMINI_API_KEY=your_gemini_api_key
PORT=4000
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
uvicorn app:app --host 0.0.0.0 --port 8080
npm install express cors dotenv
node geminiService.js
cd frontend
npm install
npm start
Open http://localhost:5173
Ask questions like:
- Hello
- What are the side effects of antidepressants?
-
Ensure that your FastAPI and Node.js servers are running before using the frontend.
-
You may need to adjust CORS settings or environment variables for local development.
-
The backend expects the medical PDF to be chunked, embedded, and indexed in Pinecone during initial setup.