Skip to content

ayushh8/GenAI-ChatBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RAG Document Q&A System

A Retrieval-Augmented Generation (RAG) system that allows you to ask questions about your PDF documents using AI.

Features

  • 📄 PDF Document Processing: Load and process PDF documents from a directory
  • 🤖 AI-Powered Q&A: Ask questions and get intelligent answers based on your documents
  • 🔍 Document Similarity Search: See which parts of documents were used to answer questions
  • 💰 Cost-Effective: Uses free HuggingFace embeddings and Groq LLM
  • 🌐 Web Interface: Beautiful Streamlit web interface

Prerequisites

  • Python 3.8+
  • Groq API key
  • HuggingFace token (optional, for better performance)

Installation

  1. Clone the repository:

    git clone <your-repo-url>
    cd RAG_QnA
  2. Install dependencies:

    pip install -r requirements.txt
  3. Set up environment variables: Create a .env file in the project root with:

    GROQ_API_KEY=your_groq_api_key_here
    OPENAI_API_KEY=your_openai_api_key_here
    HF_TOKEN=your_huggingface_token_here
    

Usage

Option 1: HuggingFace Embeddings (Recommended - Free)

streamlit run app_huggingfaceembedding.py

Option 2: OpenAI Embeddings (Paid)

streamlit run main.py

How to Use

  1. Add PDF documents to the research_papers/ folder
  2. Start the application using one of the commands above
  3. Click "Document Embedding" to process your documents
  4. Ask questions in the text input field
  5. View answers and explore document sources

Project Structure

RAG_QnA/
├── app_huggingfaceembedding.py    # Main app with HuggingFace embeddings
├── main.py                        # Main app with OpenAI embeddings
├── requirements.txt               # Python dependencies
├── .env                          # Environment variables (not in git)
├── .gitignore                    # Git ignore rules
├── README.md                     # This file
└── research_papers/              # PDF documents folder
    ├── Attention.pdf
    └── LLM.pdf

API Keys Setup

Groq API Key

  1. Sign up at Groq.com
  2. Go to Console
  3. Create a new API key
  4. Add to .env file

HuggingFace Token (Optional)

  1. Sign up at HuggingFace.co
  2. Go to Settings > Access Tokens
  3. Create a new token with "Read" permissions
  4. Add to .env file

OpenAI API Key (Optional)

  1. Sign up at OpenAI.com
  2. Go to API Keys
  3. Create a new API key
  4. Add to .env file

Technologies Used

  • Streamlit: Web interface
  • LangChain: RAG framework
  • HuggingFace: Free embeddings
  • Groq: Fast LLM responses
  • FAISS: Vector database
  • PyPDF: PDF processing

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

License

This project is open source and available under the MIT License.

Support

If you encounter any issues, please:

  1. Check the Issues page
  2. Create a new issue with detailed information
  3. Include error messages and steps to reproduce

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages