Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧠 QnA with Documents using LLM (RAG Application)

📌 Overview

This project is an AI-powered Question Answering system over documents, built using LangChain, Groq API, and Large Language Models (LLMs).

It allows users to work with PDF, HTML, and text documents and ask natural language questions, which are:

  • Processed using embeddings
  • Matched with relevant document chunks
  • Answered using an LLM with contextual understanding

The system uses Retrieval-Augmented Generation (RAG) along with a Chroma vector database to provide accurate and context-aware responses.


🚀 Features

  • 📄 PDF, HTML & Text Document Processing
  • ❓ Natural Language Question Answering
  • 🧠 RAG-based Retrieval System
  • 🧩 Vector Storage using Chroma DB
  • 🔍 Semantic Search using Embeddings
  • ⚡ Fast LLM Inference using Groq
  • 🔗 LangChain Pipeline (Loader → Splitter → Embeddings → Chroma → Retriever → LLM)

🛠️ Tech Stack

  • Python
  • LangChain
  • Groq API (OpenAI-compatible LLM)
  • Chroma (Vector Database)
  • HuggingFace Embeddings (BAAI/bge-small-en-v1.5)
  • Jupyter Notebook
  • Poetry (Dependency Management)

📂 Project Structure

Basic-Rag-App/
│── data/
│   ├── 5pages.pdf
│   ├── 100-startups.html
│   ├── be-good-and-how.html
│   ├── be-good.txt
│   ├── como_podemos_aprender.txt
│   ├── good.txt
│   ├── state_of_the_union.txt
│   ├── SAMPLE-OF-ENV-FILE.txt
│
│── basic-rag-app.ipynb      # Main notebook (RAG pipeline)
│── basic-schema.ipynb       # Schema / experiments
│── pyproject.toml           # Dependencies (Poetry)
│── poetry.lock
│── .env                     # API keys (ignored)
│── .gitignore

⚙️ Installation & Setup

1️⃣ Clone the Repository

git clone https://github.com/your-username/basic-rag-app.git
cd basic-rag-app

2️⃣ Install Dependencies (Poetry)

poetry install

3️⃣ Activate Environment

poetry shell

4️⃣ Setup Environment Variables

Create a .env file:

Free_API_KEY=your_groq_api_key_here

▶️ Usage

Run the notebook and execute:

query = "What was the role of Mahatma Gandhi?"

response = chain.invoke(query)

print(response.content)

📊 Example Output

📄 Input

"What was the Revolt of 1857?"

✅ Output

The Revolt of 1857 was a major uprising against British rule in India, led by Indian soldiers and rulers, marking one of the earliest large-scale resistance movements.

🧠 How It Works

  1. Load documents (PDF, HTML, Text)
  2. Split documents into chunks
  3. Convert text into embeddings
  4. Store embeddings in Chroma vector database
  5. Retrieve relevant chunks based on query
  6. Generate answer using LLM

Pipeline:

Query → Retriever → Chroma → Context → LLM → Answer

🔒 Security Note

  • .env file is ignored using .gitignore
  • API keys are not exposed

🚀 Future Improvements

  • Add Streamlit / Web UI
  • Multi-document upload support
  • Improve retrieval accuracy
  • Add chat memory
  • Build FastAPI backend

👨‍💻 Author

Ayush Pandey B.Tech CSE | AI Engineer


⭐ If you like this project

Give it a ⭐ on GitHub and share it!

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages