How aravind00006/hybrid-rag works
HYBRID-RAG answers plain-English questions over SEC 10-K PDFs with retrieved context and page citations. The workflow loads and cleans PDF text, chunks it, indexes chunks for keyword and semantic search, fuses results, then generates a grounded answer. Users can replace the active PDF through either the Streamlit interface or the API. The README also documents RAGAS quality scoring as a separate capability. Edges reflect documented wiring; hybrid internals and evaluation are described in the README, while their implementation details were not sampled.
Main entry points: routes.py HTTP routes · app.py Streamlit UI · main.py FastAPI startup · embedder.py Embed and store
Components 19
User interfaces
- Streamlit UI
app.py - FastAPI startup
api/main.py - HTTP routes
api/routes.py - API contracts
api/schemas.py
Document ingestion
- PDF loader
ingestion/loader.py - Chunk and filter
ingestion/chunker.py - Embed and store
ingestion/embedder.py
Hybrid retrieval
- Chroma vector store
- BM25 search
retrieval/bm25_retriever.py - Semantic search
retrieval/semantic_retriever.py - RRF fusion
retrieval/hybrid.py
Grounded generation
- Grounding prompts
generation/prompts.py - Answer generation
generation/generator.py
Quality evaluation
- RAGAS scoring
evaluation/ragas_eval.py
Other components
- Questioner
- API client
- OpenAI services
- Default 10-K PDF
data/raw/aapl-10k-2024.pdf - Eval samples
Connections 30
- Questioner → Streamlit UI: asks via
- Streamlit UI → PDF loader: loads PDF
- Streamlit UI → Chunk and filter: chunks pages
- Streamlit UI → Embed and store: indexes uploads
- Streamlit UI → BM25 search: builds index
- Streamlit UI → RRF fusion: runs query
- Streamlit UI → Answer generation: generates answer
- API client → HTTP routes: sends requests
- HTTP routes → API contracts: validates payloads
- FastAPI startup → PDF loader: loads default
- FastAPI startup → Chunk and filter: chunks pages
- FastAPI startup → Embed and store: builds or loads
- FastAPI startup → BM25 search: builds index
- Default 10-K PDF → PDF loader: reads
- HTTP routes → PDF loader: loads upload
- HTTP routes → Chunk and filter: chunks upload
- HTTP routes → Embed and store: indexes upload
- HTTP routes → BM25 search: rebuilds index
- Embed and store → OpenAI services: requests embeddings
- Embed and store → Chroma vector store: writes vectors
- FastAPI startup → Chroma vector store: loads persisted index
- Semantic search → Chroma vector store: searches vectors
- RRF fusion → BM25 search: requests rankings
- RRF fusion → Semantic search: requests rankings
- HTTP routes → RRF fusion: runs query
- HTTP routes → Answer generation: generates answer
- Answer generation → Grounding prompts: builds context prompt
- Answer generation → OpenAI services: requests completion
- Eval samples → RAGAS scoring: provides samples
- RAGAS scoring → OpenAI services: uses judge models