This repository contains a Retrieval-Augmented Generation (RAG) chatbot built using Python, LangChain, FAISS, and a free Hugging Face model. It can ingest PDFs, extract relevant information, and generate responses without relying on OpenAI's paid API.
- PDF Processing: Extracts and splits text into manageable chunks.
- Vector Search with FAISS: Stores and retrieves relevant text using embeddings.
- Free Hugging Face Model: Uses
mistralai/Mistral-7B-v0.1
for response generation. - End-to-End RAG Pipeline: Retrieves contextually relevant answers based on queries.
- Completely Free API Usage!
git clone https://github.com/your-username/chatbot_project.git
cd chatbot_project
pip install -r requirements.txt
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "mistralai/Mistral-7B-v0.1"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
python test.py
- Extracts text from the PDF.
- Splits text into overlapping chunks.
- Uses FAISS for efficient vector search.
- Stores chunk embeddings for fast retrieval.
- Retrieves relevant document sections.
- Uses a free Hugging Face model to generate answers.
- Feel free to fork this repo and contribute!
- If you find issues, open a GitHub issue.
- Connect on LinkedIn: Tarek Ashraf
Happy coding! 🎯