Skip to content

Latest commit

 

History

61 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ready-Tensor-Publication-Explorer — RAG Chatbot 📘🤖

Motivational GIF


📝 Project Summary

This project is a Retrieval-Augmented Generation (RAG) assistant designed to answer questions based on a specific publication. It uses embeddings, vector search, and a large language model (LLM) to provide precise, publication-grounded responses.


🔎 Project Overview

The RAG assistant processes the publication into document chunks, stores them in a vector database, and uses similarity search to retrieve the most relevant sections when a user asks a question. These chunks are then passed to the LLM, which generates context-aware answers.

  • Ensures responses are accurate and grounded in the provided publication.
  • Refuses to hallucinate or provide out-of-scope information.
  • Runs locally via Python and command-line interface (CLI).
  • Supports future extension to a web interface.

📖 Project Description

This project implements a Retrieval-Augmented Generation (RAG) pipeline tailored for answering questions from a specific publication. Unlike general-purpose chatbots, this assistant is restricted to the knowledge contained within the provided document, ensuring precise and trustworthy responses.

Key aspects of the system include:

  • Document Ingestion: Splits the publication into manageable text chunks and stores them in a vector database.
  • Vector Search: Uses similarity-based retrieval to find the most relevant document sections for each query.
  • LLM Integration: Leverages a large language model to generate coherent answers grounded in the retrieved content.
  • Guardrails: Prevents hallucination, out-of-scope answers, or unsafe instructions.
  • Local Deployment: Designed to run locally using Python, ensuring accessibility without cloud dependency.

⚙️ Tech Stack /Technologies Used

  • LangChain: For building the RAG pipeline (retriever + LLM + chain).
  • Groq / Gemini API: For the chat LLM (configurable via .env).
  • HuggingFace Embeddings (all-MiniLM-L6-v2): For generating vector representations of document chunks.
  • Chroma: For persistent local vector storage and similarity search.
  • RecursiveCharacterTextSplitter: For splitting long documents into retrievable chunks.
  • Pydantic Settings: For managing configuration (chunk_size, top_k, provider, etc.).
  • dotenv: For loading environment variables (API keys, configs).
  • Gradio: For the web-based UI chatbot.
  • Python's input(): For a lightweight Command Line Interface (CLI).

⛶ Screenshot

Click here to view the full screenshot📸 Chatbot demo answering questions

Chatbot demo answering questions

▶️ Video demo

📺Watch Demo Video


Repository Structure

RAG_Chatbot_Project/
 ├─ data/
 │   ├─ project_1_publication.json
 │   └─ raw/                # put source PDFs, txt, md, json
 ├─ VectorStore/             # persisted Chroma or FAISS db
 ├─ assets/                 # logos, images
 ├─ src/
 │   ├─ __init__.py
 │   ├─ config.py           # central settings (chunk, k, provider, model)
 │   ├─ loaders.py          # handles pdf, md, txt, json
 │   ├─ splitter.py         # text split logic
 │   ├─ embeddings.py       # embedder factory (HF/Gemini/OpenAI)
 │   ├─ vectordb.py         # Chroma / FAISS wrapper
 │   ├─ retriever.py
 │   ├─ prompts.py          # keep all prompt templates
 │   ├─ llm.py
 │   ├─ rag_chain.py
 │   └─ ui/                 # user interfaces
 │       ├─ cli.py
 │       └─ gradio_app.py
 ├─ ingest.py
 ├─ app.py                  # thin launcher for Gradio UI
 ├─ .gitignore              
 ├─ .env_example
 ├─ README.md
 ├─ LICENSE
 └─ requirements.txt        # dependencies

🚀 Getting Started

Welcome! This guide will help you set up and run your project with ease.

📋 Prerequisites

Before you begin, make sure you have the following:

  • ✅ Python 3.11+
  • 🔑 Groq API Key (required)
  • 🔑 Google API Key (optional)

🛠️Setup and Installation Guide

Step 0: Clone the Repository

git clone https://github.com/AbdiD21/Ready-Tensor-Publication-Explorer-RAG-Chatbot.git
cd Ready-Tensor-Publication-Explorer-RAG-Chatbot

Step 1: Create and Activate a Virtual Environment

Open your command line interface (Command Prompt on Windows or Terminal on macOS/Linux), navigate to the root directory and run the following commands:

# Windows
python -m venv venv
venv\Scripts\activate

# macOS / Linux
python3 -m venv venv
source venv/bin/activate

Once activated, your command line prompt should look like:

(venv) C:\Users\HP\Desktop\RAG_Chatbot_Project>   # Windows
(venv) ~/Desktop/RAG_Chatbot_Project$             # macOS / Linux

Step 2: Install Dependencies

pip install -r requirements.txt

Step 3: Configuration

Create a .env file in the root directory with the following variables to securely store your API key: This helps keep sensitive information out of your codebase.

GROQ_API_KEY=your_groq_api_key_here
OPENAI_API_KEY=your_openai_api_key_here  # Optional

💡Replace your_groq_api_key_here and your_openai_api_key_here with your actual API keys. These keys are used to authenticate requests to Groq and OpenAI services.

🚫 Step 4: Ignore the .env File

🔹 Add .env to .gitignore

Open (or create) a .gitignore file in the root directory and add:

.env

✅ This tells Git to ignore the .env file so it won’t be tracked or pushed to GitHub.

Step 5: Ingest Documents

python ingest.py --data data/raw --persist_dir database

Step 6: Run the Chatbot

# CLI version
python src/ui/cli.py

# Gradio web UI
python app.py

📜 License

Licensed under the MIT license.


📚 References

  1. Ready TensorAgentic AI Developer Certification
  2. LangChain DocumentationBuilding RAG pipelines
  3. HuggingFace Embeddingsall-MiniLM-L6-v2
  4. Chroma Vector Databasehttps://www.trychroma.com/
  5. Groq LLaMA / Gemini API – LLM provider used for chatbot responses.
  6. Ready Tensor PublicationsThe dataset/publications used in this project

📬 Contact

📧 abdid.yadata@gmail.com

About

AI-powered chatbot using Retrieval-Augmented Generation (RAG) to explore Ready Tensor publications. Built with LangChain, ChromaDB, Groq LLaMA 3, and Gradio for interactive question answering over structured JSON documents.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages