An intelligent, context-aware chatbot built to answer questions about pharmacy-related topics using documents, vector search (FAISS), and LLMs from HuggingFace. Built with LangChain, Streamlit, and Mistral 7B.
- 💬 Conversational interface with memory and retrieval
- 🔍 FAISS vector search over custom PDF documents
- 🧠 Mistral 7B LLM via Hugging Face Inference Endpoint
- 📄 Custom prompts to keep answers grounded in context
- ⚡ Built-in caching for performance
├── data/ # PDF documents
├── vectorstore/db_faiss/ # FAISS vector store (auto-generated)
├── create_memory_for_llm.py # Loads PDFs and creates FAISS index
├── connect_memory_with_llm.py # Retrieval + QA chain logic
├── medibot.py # Streamlit UI and main app
├── requirements.txt # Python dependencies
└── .env # Environment variables (HF_TOKEN)
git clone https://github.com/yourusername/pharma-chatbot.git
cd pharma-chatbotCreate a .env file and add your Hugging Face API key:
HF_TOKEN=your_huggingface_token_here
pip install -r requirements.txtpython create_memory_for_llm.pystreamlit run medibot.py"What is the recommended dosage for Paracetamol according to the document?"
This project uses allow_dangerous_deserialization=True when loading the FAISS index. Only use this with trusted files as it may execute arbitrary code during deserialization.
- Add PDF upload support from UI
- Enable feedback on chatbot answers
- Store chat history in a database
- Dockerize the app
Built using:
MIT License. See LICENSE file for details.
