Controllable RAG Agent

Report Abuse

Basic Information

This repository provides an advanced Retrieval-Augmented Generation (RAG) agent implementation designed to solve complex, non-trivial questions from user documents that simple semantic retrieval cannot handle. It demonstrates a deterministic graph that functions as the agent's "brain" and a controllable autonomous pipeline for processing PDFs, generating chapter summaries, creating a quotes database, encoding content into vector stores, and orchestrating multi-step question answering. The project includes a step-by-step notebook, a real-time Streamlit visualization, Docker and non-Docker run instructions, and integration examples using LangChain, FAISS, and various LLM providers. It is intended as a research and demonstration repo for controlled RAG workflows, showing how to anonymize questions, plan and decompose tasks, verify grounding in source data, and evaluate outputs using Ragas metrics.

Links

Categorization

App Details

Features
Sophisticated deterministic graph that controls reasoning and planning. Controllable autonomous agent workflow for document-driven question answering. PDF loading, chapter splitting, text preprocessing, and large-scale summarization per chapter. Creation of a quotes database and encoding of content and summaries into a FAISS vector store for retrieval. Question anonymization and de-anonymization to produce high-level plans and decomposed tasks. Task-level decision logic to choose retrieval or answer generation. Distillation of retrieved content, chain-of-thought style answer generation, hallucination-free verification, adaptive re-planning during execution, and evaluation using Ragas metrics. Includes a tutorial notebook, Streamlit visualization, and Docker support.
Use Cases
The project helps researchers and developers build, experiment with, and validate controlled RAG pipelines that require faithful, source-grounded answers. It provides a reproducible example for processing books and long documents, enabling monitoring of reliance on retrieved context versus pre-trained model knowledge. The agent"s decomposition, anonymization and adaptive planning reduce bias and improve multi-step reasoning for complex queries. Hallucination prevention and verification techniques increase faithfulness, while Ragas evaluation metrics give quantitative ways to measure correctness, relevancy and recall. The included notebook and visualization accelerate learning and debugging of RAG techniques and can serve as a reference implementation for researchers exploring deterministic control of retrieval and generation.

Please fill the required fields*