How im-shourya/voice-rag works
This is a bilingual voice-enabled RAG application over the MSMARCO-XI corpus. The main user path accepts audio or text, transcribes audio when needed, checks the query, retrieves and diversifies evidence, declines low-confidence requests, generates an extractive or optional LLM answer, then verifies it and returns citations and a trace. The repository also includes five-strategy chunking and hybrid-index support. The map follows documented pipeline relationships; some unsampled UI and optional-provider wiring is shown only where the README establishes it.
Main entry points: orchestrator.py RAG Orchestrator · index_store.py RAG Index · registry.py STT Registry · pipeline.py Chunking Pipeline
Components 23
User Experience
- Web Interface
web/src/app/page.tsx - Voice Recorder
web/src/lib/useRecorder.ts
Request Runtime
- HTTP API
app/main.py - RAG Orchestrator
app/harness/orchestrator.py - Request Contracts
app/schemas.py - STT Registry
app/stt/registry.py - Sarvam STT
app/stt/sarvam.py - ElevenLabs STT
app/stt/elevenlabs.py - Stage Trace
app/harness/trace.py
Evidence Retrieval
- Query Embedder
app/retrieval/embedder.py - Hybrid Retrieval
app/retrieval/hybrid.py - RAG Index
app/retrieval/index_store.py - BM25 Index
app/retrieval/bm25.py - Vector Store
app/retrieval/vector_store.py
Answering and Safety
- Input Guard
app/guardrails/input_guard.py - Intent Classifier
app/generation/intent.py - Extractive Composer
app/generation/extractive.py - Optional LLM
app/generation/llm.py - Answer Verification
app/guardrails/output_guard.py
Corpus Preparation
- Chunking Pipeline
app/chunking/pipeline.py - Chunk Strategies
app/chunking/strategies.py - MSMARCO-XI Corpus
Other components
- Questioner
Connections 21
- Questioner → Web Interface: asks
- Web Interface → HTTP API: submits text
- Voice Recorder → HTTP API: submits audio
- HTTP API → RAG Orchestrator: invokes
app/main.py - RAG Orchestrator → STT Registry: transcribes audio
app/harness/orchestrator.py - STT Registry → Sarvam STT: dispatches
app/stt/registry.py - STT Registry → ElevenLabs STT: fails over
app/stt/registry.py - RAG Orchestrator → Input Guard: checks query
app/harness/orchestrator.py - RAG Orchestrator → Intent Classifier: classifies
app/harness/orchestrator.py - RAG Orchestrator → Query Embedder: embeds query
app/harness/orchestrator.py - RAG Orchestrator → Hybrid Retrieval: retrieves evidence
app/harness/orchestrator.py - Hybrid Retrieval → RAG Index: searches
app/retrieval/hybrid.py - RAG Index → BM25 Index: uses sparse index
app/retrieval/index_store.py - RAG Index → Vector Store: builds vector store
app/retrieval/index_store.py - RAG Orchestrator → Extractive Composer: composes answer
app/harness/orchestrator.py - RAG Orchestrator → Optional LLM: optionally generates
app/harness/orchestrator.py - RAG Orchestrator → Answer Verification: verifies draft
app/harness/orchestrator.py - RAG Orchestrator → Stage Trace: records spans
app/harness/orchestrator.py - MSMARCO-XI Corpus → Chunking Pipeline: provides passages
- Chunking Pipeline → Chunk Strategies: applies strategies
app/chunking/pipeline.py - Chunking Pipeline → RAG Index: prepares chunks