RAG
Retrieval Augmented Generation using Doc Agent¶
This guide walks you through setting up a simple Retrieval-Augmented Generation (RAG) flow using Waldiez, with a User and a Doc Agent. The Doc Agent is capable of ingesting external documents and answering questions using context retrieved from them.
🧠 Goal¶
Set up a workflow where the User prompts the Doc Agent to ingest a document and extract relevant information (using GPT-4o and Chroma vector store).
🧱 Agent Setup¶
🧑💼 User Agent¶
- Drag and drop the User agent from the sidebar.
- This is the human-like agent that initiates the query.
📄 Doc Agent¶
- Drag and drop the Docs Agent to the canvas.
- Rename it to
Doc Agent
. - Model:
gpt-4o
- Enable RAG settings in the “Documents” tab:
Document Config:
- Collection Name:
financial_report
- Reset Collection: ✅ (enabled)
- Enable Query Citations: ✅
- Database Path:
chroma
(this is relative to the working directory)
🔗 Connection Setup¶
Create a connection from User to Doc Agent:
- Message Type:
Text
Message:
▶️ Running the Flow¶
- Click the play button in the top right to run the flow.
- The
Doc Agent
will ingest the document and respond based on retrieved content.
💬 Output Example¶
🗂 Files¶
- Waldiez flow: RAG with Doc Agent.waldiez
- Generated notebook: RAG with Doc Agent.ipynb
- Document used: Toast_financial_report.pdf