Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’Š Pharma Chatbot

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.

Pharma Chatbot Screenshot


πŸš€ Features

  • πŸ’¬ 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

πŸ› οΈ Tech Stack


πŸ“ Project Structure

β”œβ”€β”€ 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)

πŸ“¦ Setup & Installation

1. Clone the Repository

git clone https://github.com/yourusername/pharma-chatbot.git
cd pharma-chatbot

2. Set up Environment Variables

Create a .env file and add your Hugging Face API key:

HF_TOKEN=your_huggingface_token_here

3. Install Dependencies

pip install -r requirements.txt

4. Load and Index Your PDFs

python create_memory_for_llm.py

5. Launch the Chatbot

streamlit run medibot.py

πŸ’‘ Example Prompt

"What is the recommended dosage for Paracetamol according to the document?"


⚠️ Security Warning

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.


πŸ“Œ To-Do

  • Add PDF upload support from UI
  • Enable feedback on chatbot answers
  • Store chat history in a database
  • Dockerize the app

🧠 Credits

Built using:


πŸ“œ License

MIT License. See LICENSE file for details.

About

πŸ’Š An intelligent pharmacy-focused chatbot using LangChain, FAISS, and Mistral-7B to answer medical and drug-related questions from custom PDF documents. Built with Streamlit and Hugging Face.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages