Skip to content

Commit f0e1bff

Browse files
committed
feat: add context compression, tool call limit, and iteration cap
1 parent 009210a commit f0e1bff

2 files changed

Lines changed: 21 additions & 11 deletions

File tree

‎Agentic_Rag_For_Dummies.ipynb‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {
6+
"id": "view-in-github",
7+
"colab_type": "text"
8+
},
9+
"source": [
10+
"<a href=\"https://colab.research.google.com/github/GiovanniPasq/agentic-rag-for-dummies/blob/main/Agentic_Rag_For_Dummies.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
11+
]
12+
},
313
{
414
"cell_type": "markdown",
515
"id": "e0fd1790",
@@ -1365,7 +1375,8 @@
13651375
],
13661376
"metadata": {
13671377
"colab": {
1368-
"provenance": []
1378+
"provenance": [],
1379+
"include_colab_link": true
13691380
},
13701381
"kernelspec": {
13711382
"display_name": "venv (3.13.7)",
@@ -1387,4 +1398,4 @@
13871398
},
13881399
"nbformat": 4,
13891400
"nbformat_minor": 5
1390-
}
1401+
}

‎README.md‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<h1 align="center">Agentic RAG for Dummies</h1>
66

77
<p align="center">
8-
<strong>Build a production-ready Agentic RAG system with LangGraph, conversation memory, and human-in-the-loop query clarification</strong>
8+
<strong>Build a modular Agentic RAG system with LangGraph, conversation memory, and human-in-the-loop query clarification</strong>
99
</p>
1010

1111
<p align="center">
@@ -46,14 +46,14 @@
4646

4747
## Overview
4848

49-
This repository demonstrates how to build an **Agentic RAG (Retrieval-Augmented Generation)** system using LangGraph with minimal code. Most RAG tutorials show basic concepts but lack production readiness — this repo bridges that gap by providing **both learning materials and deployable code**.
49+
This repository demonstrates how to build an **Agentic RAG (Retrieval-Augmented Generation)** system using LangGraph with minimal code. Most RAG tutorials show basic concepts but lack guidance on building modular, agent-driven systems — this project bridges that gap by providing **both learning materials and an extensible architecture**.
5050

5151
### What's inside
5252

5353
| Feature | Description |
5454
|---|---|
55-
| 💬 **Conversation Memory** | Maintains context across questions for natural dialogue |
5655
| 🔍 **Hierarchical Indexing** | Search small chunks for precision, retrieve large Parent chunks for context |
56+
| 💬 **Conversation Memory** | Maintains context across questions for natural dialogue |
5757
| 🔄 **Query Clarification** | Rewrites ambiguous queries or pauses to ask the user for details |
5858
| 🤖 **Agent Orchestration** | LangGraph coordinates the full retrieval and reasoning workflow |
5959
| 🔀 **Multi-Agent Map-Reduce** | Decomposes complex queries into parallel sub-queries |
@@ -505,7 +505,7 @@ llm_with_tools = llm.bind_tools([search_child_chunks, retrieve_parent_chunks])
505505

506506
### Step 6: Define System Prompts
507507

508-
Define the system prompts for conversation summarization, query rewriting, RAG agent reasoning, context compression, fallback response, and answer aggregation.
508+
Define the system prompts for conversation summarization, query rewriting, agent orchestration, context compression, fallback response, and answer aggregation.
509509

510510
<details>
511511
<summary>Conversation Summary Prompt</summary>
@@ -1023,8 +1023,7 @@ def collect_answer(state: AgentState):
10231023
- **Parallel execution** via `Send` API spawns independent agent subgraphs for each sub-question simultaneously
10241024
- **Context compression** keeps the agent's working memory lean across long retrieval loops, preventing redundant fetches
10251025
- **Fallback response** ensures graceful degradation — the agent always returns something useful even when the budget runs out
1026-
- **Answer collection & aggregation** extracts clean final answers from tool-calling conversations and merges them into a single coherent response
1027-
1026+
- **Answer collection & aggregation** extracts clean final answers from agents and aggregates them into a single coherent response
10281027
---
10291028

10301029
### Step 10: Build the LangGraph Graphs
@@ -1139,7 +1138,7 @@ demo.launch(theme=gr.themes.Citrus())
11391138

11401139
## Modular Architecture
11411140

1142-
The app (`project/` folder) is organized into modular components — each independently swappable without breaking the system:
1141+
The app (`project/` folder) is organized into modular components — each independently swappable without breaking the system.
11431142

11441143
### 📂 Project Structure
11451144
```
@@ -1199,7 +1198,7 @@ Open the local URL (e.g., `http://127.0.0.1:7860`) to start chatting.
11991198

12001199
### Option 3: Docker Deployment
12011200

1202-
See [`project/README.md`](./project/README.md) for full Docker instructions and system requirements.
1201+
See [`project/README.md`](./project/README.md#Docker-Deployment) for full Docker instructions and system requirements.
12031202

12041203
### Example Conversations
12051204

@@ -1236,4 +1235,4 @@ Agent: [Retrieves and answers with specific information]
12361235
| **Temperature & Consistency** | - Responses inconsistent or overly creative<br>- Responses too rigid or repetitive | - Set temperature to `0` for factual, consistent output<br>- Slightly increase temperature for summarization or analysis tasks |
12371236
| **Embedding Model Quality** | - Poor semantic search<br>- Weak performance on domain-specific or multilingual docs | - Use higher-quality or domain-specific embeddings<br>- Re-index all documents after changing embeddings |
12381237

1239-
> 💡 **For additional troubleshooting tips** see the [README Troubleshooting](./project/README.md#troubleshooting).
1238+
> 💡 **For additional troubleshooting tips** see the [README Troubleshooting](./project/README.md#troubleshooting).

0 commit comments

Comments
 (0)