How iamhharish/llm-rag-system works
This is a command-line hybrid RAG question-answering system. A user’s question enters pipeline.py, which retrieves and reranks local document passages, searches the web, checks whether the combined context is relevant, and generates an answer using mark-sensitive instructions. It then adds source attribution and logs the interaction. The README also describes document uploads, academic formatting, and an ask-back response when evidence is insufficient. The sampled code supports TXT, PDF, and DOCX loading; external model and search behavior is represented at a high level.
Main entry points: pipeline.py RAG pipeline · retriever.py Vector retrieval · online_retrieval.py Web retrieval · data_loader.py Document loader
Components 16
Question orchestration
- RAG pipeline
pipeline.py - Context relevance
pipeline.py
Offline documents
- Document folder
- Document loader
data_loader.py - Text chunking
chunking.py - Embedding model
- Vector retrieval
retriever.py - FAISS index
retriever.py
Online retrieval
- Web retrieval
online_retrieval.py - Search service
- Web pages
Answers and history
- Academic answer policy
pipeline.py - Language model
- Source attribution
pipeline.py - Interaction log
pipeline.py
Other components
- Questioner
Connections 22
- Questioner → RAG pipeline: asks
- RAG pipeline → Document folder: reads files
- RAG pipeline → Document loader: loads documents
- Document loader → RAG pipeline: returns text
- RAG pipeline → Text chunking: creates chunks
- RAG pipeline → Embedding model: encodes chunks
- RAG pipeline → Vector retrieval: builds index
- Vector retrieval → FAISS index: writes vectors
- RAG pipeline → Vector retrieval: retrieves chunks
- Vector retrieval → Embedding model: encodes query
- Vector retrieval → FAISS index: searches vectors
- Vector retrieval → RAG pipeline: returns reranked chunks
- RAG pipeline → Web retrieval: requests web data
- Web retrieval → Search service: searches web
- Web retrieval → Web pages: fetches pages
- Web retrieval → RAG pipeline: returns passages
- RAG pipeline → Context relevance: checks context
- RAG pipeline → Academic answer policy: selects answer style
- RAG pipeline → Language model: generates answer
- RAG pipeline → Source attribution: assigns source
- RAG pipeline → Interaction log: logs interaction
- RAG pipeline → Questioner: returns answer