|
|
""" |
|
|
SOTA Multi-Agentic RAG System |
|
|
|
|
|
A production-grade RAG system following FAANG best practices: |
|
|
- Query decomposition and planning |
|
|
- Hybrid retrieval (dense + sparse) |
|
|
- Cross-encoder reranking |
|
|
- Grounded synthesis with citations |
|
|
- Hallucination detection and self-correction |
|
|
- LangGraph orchestration |
|
|
|
|
|
Architecture: |
|
|
User Query |
|
|
| |
|
|
[QueryPlannerAgent] - Decomposes complex queries, identifies intent |
|
|
| |
|
|
[RetrieverAgent] - Hybrid search with query expansion |
|
|
| |
|
|
[RerankerAgent] - Cross-encoder scoring, filters low-quality |
|
|
| |
|
|
[SynthesizerAgent] - Generates grounded answer with citations |
|
|
| |
|
|
[CriticAgent] - Validates for hallucination, checks citations |
|
|
| |
|
|
(Loop back if critic fails) |
|
|
| |
|
|
Final Answer |
|
|
""" |
|
|
|
|
|
from .query_planner import QueryPlannerAgent, QueryPlan, SubQuery |
|
|
from .retriever import RetrieverAgent, RetrievalResult, HybridSearchConfig |
|
|
from .reranker import RerankerAgent, RankedResult, RerankerConfig |
|
|
from .synthesizer import SynthesizerAgent, SynthesisResult, Citation |
|
|
from .critic import CriticAgent, CriticResult, ValidationIssue |
|
|
from .orchestrator import AgenticRAG, RAGConfig, RAGResponse |
|
|
|
|
|
__all__ = [ |
|
|
|
|
|
"QueryPlannerAgent", |
|
|
"QueryPlan", |
|
|
"SubQuery", |
|
|
|
|
|
"RetrieverAgent", |
|
|
"RetrievalResult", |
|
|
"HybridSearchConfig", |
|
|
|
|
|
"RerankerAgent", |
|
|
"RankedResult", |
|
|
"RerankerConfig", |
|
|
|
|
|
"SynthesizerAgent", |
|
|
"SynthesisResult", |
|
|
"Citation", |
|
|
|
|
|
"CriticAgent", |
|
|
"CriticResult", |
|
|
"ValidationIssue", |
|
|
|
|
|
"AgenticRAG", |
|
|
"RAGConfig", |
|
|
"RAGResponse", |
|
|
] |
|
|
|