Skip to content

Repository files navigation

📘 Retrieval-Augmented Generation (RAG) Chatbot

A modular Retrieval-Augmented Generation (RAG) system built with LangChain, HuggingFace, and FAISS.
This chatbot ingests documents, stores them in a vector database, retrieves the most relevant chunks, and generates context-aware answers.


🚀 Features

  • Document ingestion pipeline (load, split, embed, store)
  • FAISS vector store for efficient similarity search
  • Retriever module to fetch relevant chunks
  • Generator module powered by HuggingFace models (e.g., flan-t5-base)
  • Interactive CLI chatbot with persistent FAISS index
  • Modular design for easy extension and scaling

🗂️ Project Structure

rag-chatbot/
│
├── ingestion/
│   ├── loader.py          # Load documents
│   ├── splitter.py        # Split into chunks
│   ├── embedder.py        # Embedding manager
│   └── vector_store.py    # FAISS vector store wrapper
│
├── rag/
│   ├── retriever.py       # Retrieve chunks & build prompt
│   └── generator.py       # Generate answers with HuggingFace
│
├── data/                  # Sample documents
├── main.py                # Entry point (chatbot loop)
├── requirements.txt       # Dependencies
├── test_rag.py            # Quick validation script
└── README.md              # Project overview

⚙️ Installation

Clone the repo and install dependencies:

git clone https://github.com/<your-username>/rag-chatbot.git
cd rag-chatbot
pip install -r requirements.txt

▶️ Usage

  1. Place your documents in the data/ folder.
  2. Run the chatbot:
    python main.py
  3. Ask questions interactively:
    Hi how may I help you? : What is retrieval-augmented generation?
    

Type <quit> to exit.


🧪 Example

Query:

What is FAISS used for?

Response:

FAISS (Facebook AI Similarity Search) is a library for efficient similarity search and clustering of dense vectors. In this RAG pipeline, it stores embeddings of document chunks and retrieves the most relevant ones for a given query.

📊 Demo

  • Add a short terminal screenshot or GIF here
  • (Optional) Record a 1–2 min demo video and link it

🔮 Future Improvements

  • Web UI with Gradio/Streamlit
  • Support for larger context models
  • Evaluation metrics for retrieval quality
  • Dockerized deployment

🛠️ Tech Stack

  • LangChain – orchestration
  • HuggingFace Transformers – embeddings & generation
  • FAISS – vector similarity search
  • Python 3.13

✅ Validation

To prove this works, run:

python test_rag.py

This script will:

  • Ingest sample data
  • Run a few queries
  • Print responses

👤 Author

Built by Amin — passionate about AI, NLP, and building intelligent systems.
Connect with me on LinkedIn or check out my other projects on GitHub.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages