Download src/rag/agentic/__init__.py from MHamdan/SPARKNET: direct link, hf CLI and curl.
- Browser
- Download file 1.68 kB
-
https://huggingface.co/spaces/MHamdan/SPARKNET/resolve/main/src/rag/agentic/__init__.py
- Command line
-
hf download hf://spaces/MHamdan/SPARKNET/src/rag/agentic/__init__.py
-
curl -L -o __init__.py https://huggingface.co/spaces/MHamdan/SPARKNET/resolve/main/src/rag/agentic/__init__.py
1.68 kB
| """ | |
| 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__ = [ | |
| # Query Planner | |
| "QueryPlannerAgent", | |
| "QueryPlan", | |
| "SubQuery", | |
| # Retriever | |
| "RetrieverAgent", | |
| "RetrievalResult", | |
| "HybridSearchConfig", | |
| # Reranker | |
| "RerankerAgent", | |
| "RankedResult", | |
| "RerankerConfig", | |
| # Synthesizer | |
| "SynthesizerAgent", | |
| "SynthesisResult", | |
| "Citation", | |
| # Critic | |
| "CriticAgent", | |
| "CriticResult", | |
| "ValidationIssue", | |
| # Orchestrator | |
| "AgenticRAG", | |
| "RAGConfig", | |
| "RAGResponse", | |
| ] | |