How giripsr769/hybrid_rag works
This is a PDF-grounded hybrid RAG application: users upload a PDF, then ask questions through Streamlit and receive answers from a FastAPI backend. Ingestion extracts and separately chunks the PDF for FAISS and Neo4j; querying combines vector and graph evidence, uses conversational history to contextualize follow-ups, and checks input and answer grounding. DeepEval is exposed as an evaluation capability. The main orchestration and retrieval/service files were excerpted; some documented capabilities, including the alternate custom evaluator, have limited implementation evidence here.
Main entry points: main.py FastAPI API · rag_service.py RAG Service · vector_indexer.py Vector Indexer · graph_builder.py Graph Builder
Components 18
User Interface
- Streamlit UI
frontend/app.py
API Orchestration
- FastAPI API
backend/main.py - Uploaded PDFs
backend/main.py
PDF Ingestion
- PDF Loader
backend/app/ingestion/pdf_loader.py - Text Chunker
backend/app/ingestion/text_chunker.py - Vector Indexer
backend/app/ingestion/vector_indexer.py - FAISS Index
backend/app/ingestion/vector_indexer.py - Graph Builder
backend/app/ingestion/graph_builder.py - Neo4j Graph
backend/app/ingestion/graph_builder.py
Hybrid Retrieval
- Hybrid Retriever
backend/app/retrieval/hybrid_retriever.py - Vector Retriever
backend/app/retrieval/vector_retriever.py - Graph Retriever
backend/app/retrieval/graph_retriever.py
Answering and Evaluation
- RAG Service
backend/app/services/rag_service.py - Guardrail Service
backend/app/guardrails/guardrail_service.py - RAG Evaluator
backend/app/evaluation/rag_evaluator.py - Custom Evaluator
backend/app/evaluation/custom_rag_evaluator.py
Other components
- User
- OpenAI Models
Connections 25
- User → Streamlit UI: asks or uploads
README.md - Streamlit UI → FastAPI API: calls API
README.md - FastAPI API → Uploaded PDFs: saves upload
backend/main.py - FastAPI API → PDF Loader: loads PDF
backend/main.py - PDF Loader → Text Chunker: provides documents
README.md - FastAPI API → Text Chunker: splits documents
backend/main.py - FastAPI API → Vector Indexer: indexes chunks
backend/main.py - Vector Indexer → FAISS Index: writes index
backend/app/ingestion/vector_indexer.py - FastAPI API → Graph Builder: builds graph
backend/main.py - Graph Builder → Neo4j Graph: writes graph
backend/app/ingestion/graph_builder.py - Vector Indexer → OpenAI Models: embeds chunks
backend/app/ingestion/vector_indexer.py - Graph Builder → OpenAI Models: extracts relations
backend/app/ingestion/graph_builder.py - FastAPI API → RAG Service: routes chat
backend/main.py - RAG Service → Guardrail Service: validates and checks
backend/app/services/rag_service.py - RAG Service → Hybrid Retriever: retrieves evidence
backend/app/services/rag_service.py - Hybrid Retriever → Vector Retriever: retrieves vectors
backend/app/retrieval/hybrid_retriever.py - Hybrid Retriever → Graph Retriever: retrieves relations
backend/app/retrieval/hybrid_retriever.py - Vector Retriever → FAISS Index: searches index
backend/app/retrieval/vector_retriever.py - Graph Retriever → Neo4j Graph: queries graph
backend/app/retrieval/graph_retriever.py - Graph Retriever → OpenAI Models: extracts entities
backend/app/retrieval/graph_retriever.py - RAG Service → OpenAI Models: rewrites and answers
backend/app/services/rag_service.py - Guardrail Service → OpenAI Models: classifies and grounds
backend/app/guardrails/guardrail_service.py - RAG Service → Streamlit UI: returns answer
README.md - FastAPI API → RAG Evaluator: runs evaluation
backend/main.py - RAG Evaluator → OpenAI Models: scores responses
README.md