> ## Documentation Index
> Fetch the complete documentation index at: https://genai.codewithsiva.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# RAG Systems

> Design and build Retrieval-Augmented Generation systems to query custom data

Welcome to the **Retrieval-Augmented Generation (RAG)** module. Learn how to connect LLMs to external, private knowledge sources to ground model answers in facts and prevent hallucinations.

## 💻 Module Practice Notebooks

Master all the concepts from this module with hands-on practice:

* **Practice in VS Code**: Open the notebook in your local editor. Requires a local `.env` file containing your API keys.
* **Practice in Google Colab**: Open the notebook directly in Colab. Setup cells are included to install packages and request API keys.

[💻 VS Code](vscode://file/Users/sivaprasad/Downloads/GenAI%20With%20Python/public/notebooks/rag/rag-practice-vscode.ipynb) | [🚀 Colab](https://colab.research.google.com/github/prasad230776/genai-course/blob/master/public/notebooks/rag/rag-practice-colab.ipynb) | <a href="/public/notebooks/rag/rag-practice-vscode.ipynb" download>📥 Download Notebook</a>

## 🗺️ Module Overview

Build end-to-end question answering systems over proprietary data:

```mermaid theme={null}
graph TD
    A["Document Ingestion<br/>(Parsing, Chunking Strategies)"]
    --> B["Vector Databases<br/>(Embeddings & Similarity)"]
    --> C["Augmented Synthesis<br/>(Generation & Context Evaluation)"]
    --> D["Practical Capstone<br/>(Chat with your PDF App)"]
```

## 📚 Module Curriculum & Roadmap

Explore the sections in this module using the cards below:

<CardGroup cols={2}>
  <Card title="1. Introduction to RAG" icon="handshake" href="/rag/01-introduction">
    Learn why RAG is required, how it differs from model fine-tuning, the 3 pillars of RAG pipelines, and lexical vs. semantic search comparisons.
  </Card>

  <Card title="2. Document Ingestion & Chunking" icon="file-import" href="/rag/02-ingestion">
    Understand document loaders (Text, PDF, HTML), chunk size and overlap constraints, and explore character, recursive, token, and semantic chunking.
  </Card>

  <Card title="3. Vector Databases & Retrieval" icon="database" href="/rag/03-vector-database">
    Evaluate Cosine vs. L2 distance metrics. Setup ChromaDB, generate embeddings, and build a working similarity retrieval search engine.
  </Card>

  <Card title="4. Generation, Advanced RAG & Eval" icon="rocket" href="/rag/04-rag-evaluation">
    Build RAG synthesis chains with LCEL. Compare Naive, Advanced, and Agentic RAG, and analyze context precision, recall, and faithfulness metrics.
  </Card>
</CardGroup>

## 🛠️ Practical Capstone Project

### "Chat with your PDF" Application

Build a Python-based command-line tool (or Streamlit UI) that:

1. Allows a user to upload a custom PDF report.
2. Automatically parses, chunks, embeds, and loads the content into a local vector database.
3. Takes user questions, retrieves the top-k relevant segments, and passes them to the LLM.
4. Returns the model's answer along with the exact source pages/chunks used for verification.
