Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python RAG Groq Streamlit

🌐 Website Q&A with Groq (RAG Project)

A beginner-friendly Retrieval-Augmented Generation (RAG) project that allows users to chat with any website using Groq API and Llama 3 models.

This project demonstrates how modern AI applications like ChatGPT-style “chat with website” systems work under the hood.


🚀 Features

  • 🌐 Scrapes any website from a URL
  • 🧹 Cleans and extracts readable text
  • ✂️ Splits content into chunks
  • 🔍 Stores embeddings in a vector database (ChromaDB)
  • 🤖 Retrieves relevant context using similarity search
  • 🧠 Uses Groq LLM (Llama 3) for answering questions
  • 💬 Simple Streamlit UI

🏗️ Architecture

User enters URL
        │
        ▼
Web Scraping (BeautifulSoup)
        │
        ▼
Text Cleaning
        │
        ▼
Chunking
        │
        ▼
Embedding Generation (Sentence Transformers)
        │
        ▼
Vector DB (ChromaDB)
        │
        ▼
User Question
        │
        ▼
Similarity Search (Retrieval)
        │
        ▼
Context + Question → Groq LLM
        │
        ▼
Generated Answer

📂 Project Structure

website-qa/
│
├── app.py              # Streamlit UI
├── scraper.py          # Website scraping logic
├── rag.py              # Chunking, embeddings, retrieval, LLM logic
├── .env.example        # Environment variables template
├── .gitignore
├── requirements.txt
├── chroma_db/         # Vector database storage (ignored in git)
└── README.md

🛠️ Tech Stack

Component Technology
LLM Groq API
Model Llama 3 (70B / 8B)
Embeddings SentenceTransformers
Vector DB ChromaDB
Web Scraping BeautifulSoup
UI Streamlit
Language Python

📦 Installation

1. Clone the Repository

git clone https://github.com/your-username/website-qa.git
cd website-qa

2. Create Virtual Environment

Windows

python -m venv venv
venv\Scripts\activate   # Windows
source venv/bin/activate # Mac/Linux

3. Install Dependencies

pip install -r requirements.txt

🔑 Environment Setup

Create a .env file in the project root:

GROQ_API_KEY=your_groq_api_key

Get your API key from the Groq Console.


▶️ Running the Project

Start the application:

streamlit run app.py

💡 How It Works

Enter a website URL System scrapes and cleans text Text is split into chunks Chunks are converted into embeddings Stored in ChromaDB User asks a question System retrieves relevant chunks Groq LLM generates final answer


🧠 Key Concepts Learned

1. Web Scraping

Extracting raw HTML content from websites.

2. Text Chunking

Breaking large text into LLM-friendly segments.

3. Embeddings

Converting text into numerical vectors.

4. Vector Search

Finding similar content using cosine similarity.

5. RAG (Retrieval Augmented Generation)

Combining retrieval + LLM generation.


🚀 Future Improvements

  • 🌍 Multi-page crawling
  • 📚 Website sitemap support
  • 🔍 Hybrid search (BM25 + vectors)
  • 🧠 Better embeddings (BGE / E5 models)
  • 💬 Chat memory
  • 📎 Source citations in answers
  • ⚡ Async scraping for speed
  • 🧾 PDF + Website combined QA system

⚠️ Limitations

Some websites block scraping (403 / bot protection) No JavaScript rendering (no Playwright yet) Basic chunking strategy


📚 Learning Outcomes

After building this project, you understand:

How ChatGPT-style website Q&A systems work RAG architecture end-to-end Vector databases and embeddings LLM integration using Groq API Real-world GenAI app design patterns


🤝 Contributing

Feel free to fork this project and improve it with:

Better retrieval strategies UI enhancements Multi-source ingestion Chat memory


⭐ Acknowledgements

Groq for fast LLM inference (https://groq.com) Meta Llama models ChromaDB for vector storage SentenceTransformers for embeddings


Author

Built as a learning project while exploring Retrieval-Augmented Generation (RAG) and Generative AI application development.

About

A GenAI-powered Website Q&A system built using RAG (Retrieval-Augmented Generation). Users can input any URL and ask questions about its content. The system uses web scraping, embeddings, vector search (ChromaDB), and Groq Llama 3 models to generate context-aware answers.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages