How anikaitar70/rag_reader works
Local Document Intelligence Engine accepts documents through a three-panel web UI, parses and indexes them locally, then answers questions from retrieved evidence with citations or abstains. Its documented capabilities include multiple document formats, structure-aware chunking and metadata, hybrid retrieval with reranking, SSE progress, selection-grounded questions, and optional local fact-only rewriting with entailment validation. Edges reflect the README and SOURCE INDEX relationships; unsampled implementation details and frontend wiring are not inferred beyond documented behavior.
Main entry points: pipeline.py Ask pipeline · page.tsx Web app · main.py FastAPI routes · retrieval.py Hybrid search
Components 25
Web experience
- Web app
frontend/app/page.tsx - Document panel
frontend/components/DocumentSidebar.tsx - Chat panel
frontend/components/ChatPanel.tsx - PDF viewer
frontend/components/PdfViewerInner.tsx - Selection ask
frontend/components/SelectionToolbar.tsx - Evidence panel
frontend/components/EvidencePanel.tsx
Document ingestion
- FastAPI routes
backend/app/main.py - Document parsers
backend/app/parsers.py - Structure chunking
backend/app/chunking.py - Chunk metadata
backend/app/metadata_gen.py - Domain models
backend/app/models.py
Search and retrieval
- Hybrid search
backend/app/retrieval.py - Local embeddings
backend/app/embeddings.py - Query intent
backend/app/intent.py
Evidence and answers
- Ask pipeline
backend/app/pipeline.py - Sentence ranking
backend/core/evidence/sentences.py - Fact extraction
backend/core/evidence/extractor.py - Evidence graph
backend/core/evidence/graph.py - Coverage analysis
backend/core/evidence/coverage.py - Answer formatting
backend/core/evidence/formatter.py - Optional fact rewrite
backend/app/fact_rewrite.py - Entailment validation
backend/core/validation/entailment.py
Local persistence
- Document store
backend/app/store.py
Other components
- Document user
- Local model runtimes
Connections 28
- Document user → Web app: uses
README.md - Web app → FastAPI routes: calls backend
README.md - Web app → Document panel: shows documents
README.md - Web app → Chat panel: shows chat
README.md - Web app → Evidence panel: shows retrieved chunks
README.md - Web app → PDF viewer: shows PDF
README.md - PDF viewer → Selection ask: offers selection ask
README.md - FastAPI routes → Document parsers: parses upload
backend/app/main.py - FastAPI routes → Structure chunking: chunks parsed tree
backend/app/main.py - FastAPI routes → Document store: persists documents
backend/app/main.py - FastAPI routes → Ask pipeline: dispatches ask
backend/app/main.py - Document parsers → Domain models: builds document tree
backend/app/parsers.py - Structure chunking → Domain models: creates chunks
backend/app/chunking.py - Chunk metadata → Domain models: enriches chunks
backend/app/metadata_gen.py - Ask pipeline → Query intent: classifies query
backend/app/pipeline.py - Ask pipeline → Hybrid search: retrieves chunks
backend/app/pipeline.py - Hybrid search → Local embeddings: embeds and reranks
backend/app/retrieval.py - Hybrid search → Document store: loads indexed chunks
backend/app/retrieval.py - Ask pipeline → Sentence ranking: ranks sentences
backend/app/pipeline.py - Ask pipeline → Fact extraction: extracts facts
backend/app/pipeline.py - Ask pipeline → Evidence graph: deduplicates facts
backend/app/pipeline.py - Ask pipeline → Coverage analysis: scores evidence
backend/app/pipeline.py - Ask pipeline → Answer formatting: formats answer
backend/app/pipeline.py - Ask pipeline → Optional fact rewrite: optionally rewrites facts
backend/app/pipeline.py - Ask pipeline → Entailment validation: validates answer
backend/app/pipeline.py - Optional fact rewrite → Local model runtimes: uses optional SLM
backend/app/fact_rewrite.py - Entailment validation → Local model runtimes: optionally uses NLI
backend/core/validation/entailment.py - Local embeddings → Local model runtimes: loads local models
backend/app/embeddings.py