DocForge is a multi-agent RAG system built with LangGraph where four specialized agents route, retrieve, synthesize, and validate answers from your documents. Unlike basic RAG pipelines, every response is fact-checked against source documents — hallucinations are caught and corrected automatically with retry logic. Features Redis caching, adaptive retrieval, and dual LLM support.
DocForge is a sophisticated Multi-Agent Retrieval-Augmented Generation (RAG) system designed for capturing and analyzing technical documentation to provide accurate answers through an intelligent, streamlined process. Built on LangGraph, DocForge brings together advanced features such as intelligent query routing, adaptive document retrieval, and built-in fact-checking to ensure reliable information extraction.
The architecture of DocForge supports a comprehensive workflow:
User Query
|
v
+-----------------+
| Redis Cache | <-- Check cache first
+--------+--------+
| (cache miss)
v
+-----------------+
| Routing Agent | <-- Classify complexity, optimize search query
+--------+--------+
|
v
+-----------------+
| Retrieval Agent | <-- Fetch 3-10 docs from Pinecone
+--------+--------+ (50% more on retry, relaxed threshold)
|
v
+-----------------+
| Analysis Agent | <-- Synthesize cited answer (chain-of-thought)
+--------+--------+
|
v
Confidence Check:
|
+-- High confidence --> Skip validation --> Return & Cache
|
+-- Otherwise:
|
v
+-----------------+
|Validation Agent | <-- Fact-check every claim
+--------+--------+
|
v
Decision:
+-- Valid --> Return & Cache
+-- Invalid (< 3) --> Retry from Retrieval (adaptive)
+-- Invalid (>= 3) --> Return corrected answer & Cache
from backend.agents.graph import run_graph
result = run_graph("What is LangGraph?")
print(result["fact_checked_answer"])
print(f"Validation: {result['validation_passed']}")
print(f"Documents used: {len(result['retrieved_chunks'])}")
print(f"Query type: {result['query_type']}")
print(f"Latency: {result['latency_ms']:.0f}ms")
print(f"Tokens used: {result['total_tokens_used']}")
from backend.ingestion.pipeline import ingest_documents
stats = ingest_documents("./documents/", chunk_size=1000, chunk_overlap=200)
print(f"Loaded: {stats['documents_loaded']} documents")
print(f"Created: {stats['chunks_created']} chunks")
print(f"Uploaded: {stats['chunks_uploaded']} vectors")
curl -X POST http://localhost:8000/api/v1/query \
-H "Content-Type: application/json" \
-d '{"query": "What is LangGraph?"}'
DocForge merges cutting-edge technology with intuitive design, making it a vital resource for professionals needing fast and accurate retrieval of information from complex technical documentation.
No comments yet.
Sign in to be the first to comment.