Dynamic RAG
Dynamic RAG
A sophisticated Retrieval-Augmented Generation system with multi-agent architecture for intelligent question-answering over custom knowledge bases.
Features
- Multi-Agent Architecture — Specialized agents working together:
- QA Agent — Main agent for answering questions using the knowledge base
- Personal Agent — For personal/general questions not requiring RAG
- Validation Agent — Classifies queries as on-context, personal, bad, or unknown
- Prompt Agent — Generates diverse query perspectives for comprehensive retrieval
- Reranking Agent — Reorders retrieved chunks for better relevance
- Hybrid Search — Combines FAISS vector similarity with keyword matching
- Streaming Responses — Token-by-token streaming of LLM outputs
- Multi-language Support — Uses multilingual embeddings via Cohere
- Document Processing — PDF parsing with OCR support via Mistral
Technical Highlights
- LangChain + LangGraph for orchestrating the RAG pipeline
- FAISS vector store for similarity search
- Cohere embeddings for multilingual support
- SQLite for session persistence and analytics
- Configurable agents via JSON configuration files
Tech Stack
| Component | Technology |
|---|---|
| Web Framework | FastAPI + Uvicorn |
| AI Integration | Together AI, LangChain, LangGraph |
| Vector Store | FAISS |
| Embeddings | Cohere |
| Database | SQLite + SQLAlchemy 2.0 |
Architecture
ValidationAgent → classifies query type
↓
PromptAgent → generates specialized prompts
↓
QA Agent → retrieves chunks, reranks, generates answer
↓
StreamingResponse