How hrishikeshchandi/semantic-drift-rag works
Semantic Drift RAG is a document-grounded question-answering service. Users upload documents, which are loaded, chunked, embedded, indexed for hybrid retrieval, and used to derive corpus drift statistics. For a query, the API checks document scope before invoking a LangGraph retrieval, response, and evaluation loop; out-of-scope queries are refused and near-boundary queries request clarification. The README documents capabilities beyond the sampled implementation, including citations, multi-session use, and multiple ingestion formats; those links are shown where documented rather than inferred from unsampled code.
Main entry points: main.py FastAPI server · vectorstore.py Hybrid vector store · nodes.py RAG operations · files.py File management API
Components 14
API and interface
- Web interface
frontend/script.js - FastAPI server
main.py - File management API
routers/files.py
Document ingestion
- Document processor
document_ingestion/processor.py - Hybrid vector store
vectorstore/vectorstore.py - User index and sessions
Scope and sessions
- Drift detector
drift_detector/detector.py - Session drift state
drift_detector/detector.py
Grounded answering
- RAG graph
graph_builder/builder.py - Pipeline state
state/rag_state.py - RAG operations
nodes/nodes.py - LLM configuration
llm/llm.py
Other components
- User
- Model providers
Connections 20
- User → Web interface: uses
- Web interface → FastAPI server: submits queries
- User → FastAPI server: uploads and queries
README.md - FastAPI server → File management API: mounts routes
main.py - File management API → Document processor: loads and chunks
routers/files.py - File management API → Hybrid vector store: builds index
routers/files.py - Document processor → Hybrid vector store: provides chunks
README.md - Hybrid vector store → User index and sessions: persists index
README.md - FastAPI server → Hybrid vector store: loads retriever
main.py - FastAPI server → Drift detector: analyzes query
main.py - Drift detector → Session drift state: reads and updates
drift_detector/detector.py - Drift detector → User index and sessions: reads corpus stats
drift_detector/detector.py - FastAPI server → RAG graph: runs answering graph
main.py - RAG graph → RAG operations: dispatches steps
graph_builder/builder.py - RAG graph → Pipeline state: invokes with state
graph_builder/builder.py - RAG operations → Pipeline state: updates
nodes/nodes.py - RAG operations → Hybrid vector store: retrieves passages
README.md - RAG operations → LLM configuration: calls models
nodes/nodes.py - LLM configuration → Model providers: configures
llm/llm.py - Hybrid vector store → Model providers: uses embeddings
README.md