RAG
Retrieval-Augmented Generation
RAG (Retrieval-Augmented Generation) enhances agents with external knowledge.
graph LR
subgraph "RAG Pipeline"
Q[❓ Question] --> R[🔍 Retrieve]
R --> D[📄 Documents]
D --> A[🤖 Agent]
A --> O[💬 Answer]
end
classDef input fill:#6366F1,stroke:#7C90A0,color:#fff
classDef process fill:#F59E0B,stroke:#7C90A0,color:#fff
classDef output fill:#10B981,stroke:#7C90A0,color:#fff
class Q input
class R,D,A process
class O outputQuick Start
- Set Up RAG
rust use praisonai::{Agent, KnowledgeConfig}; let config = KnowledgeConfig::new() .source("docs/") .chunk_size(1000) .retrieval_k(5); let agent = Agent::new() .name("RAG Bot") .knowledge(config) .build()?; agent.chat("Answer based on documents").await?;
RAG Components
| Component | Description | Status |
|---|---|---|
| Loader | Load documents | ✅ documented |
| Chunker | Split into chunks | ✅ documented |
| Embedder | Create vectors | ✅ documented |
| Retriever | Find relevant chunks | ✅ documented |
| Reranker | Improve relevance | ✅ documented |
Query pipeline (RAG::query) | End-to-end retrieval + generation | ⚠️ not implemented — returns Err |