How anirudh2627/youtube-rag works
YouTube RAG Assistant ingests video transcripts into timestamped chunks, indexes them for lexical and semantic search, and answers questions with reranked evidence and clickable citations. Users enter through the Streamlit UI or FastAPI; video processing and chat are coordinated by services, while retrieval and generation form the query path. Evaluation is a separate capability. Most pipeline links follow the README; source excerpts confirm service wiring and several implementation calls, but not every internal stage.
Main entry points: rag_engine.py RAG engine · pipeline.py Retrieval pipeline · container.py Service container · routes_chat.py FastAPI routes
Components 24
Application
- Streamlit UI
frontend/streamlit_app.py - FastAPI routes
app/api/routes_chat.py - Video routes
app/api/routes_videos.py - Service container
app/services/container.py
Ingestion and Indexing
- Video processing
app/services/video_service.py - Transcript providers
app/ingestion/youtube_transcript.py - Transcript cleaning
app/ingestion/cleaning.py - Timestamp chunking
app/ingestion/chunking.py - Embeddings
app/embeddings/st_embedder.py - Vector store
app/vectorstore/chroma_store.py
Retrieval
- BM25 index
app/retrieval/bm25.py - Retrieval pipeline
app/retrieval/pipeline.py - RRF fusion
app/retrieval/hybrid.py - Cross-encoder reranker
app/retrieval/reranker.py
Answering
- Query rewriter
app/generation/rewriter.py - Conversation memory
app/memory/conversation.py - RAG engine
app/generation/rag_engine.py - Grounded prompts
app/generation/prompts.py - LLM provider
app/generation/openai_compat.py - Citation rendering
app/generation/rag_engine.py
Evaluation
- Evaluation runner
app/evaluation/runner.py - Evaluation metrics
app/evaluation/metrics.py - LLM judges
app/evaluation/judges.py
Other components
- User
Connections 29
- User → Streamlit UI: asks through
README.md - Streamlit UI → FastAPI routes: calls API
README.md - FastAPI routes → Service container: gets services
app/api/routes_chat.py - Video routes → Service container: gets services
app/api/routes_videos.py - Video routes → Video processing: processes video
app/api/routes_videos.py - Service container → Video processing: constructs
app/services/container.py - Video processing → Transcript providers: fetches transcript
app/services/video_service.py - Transcript providers → Transcript cleaning: provides segments
README.md - Transcript cleaning → Timestamp chunking: cleans segments
README.md - Timestamp chunking → Embeddings: creates vectors
README.md - Embeddings → Vector store: indexes vectors
README.md - Timestamp chunking → BM25 index: indexes text
README.md - FastAPI routes → RAG engine: answers query
README.md - Service container → Retrieval pipeline: constructs
app/services/container.py - RAG engine → Query rewriter: rewrites query
app/generation/rag_engine.py - RAG engine → Retrieval pipeline: retrieves evidence
app/generation/rag_engine.py - Retrieval pipeline → Embeddings: embeds query
app/retrieval/pipeline.py - Retrieval pipeline → Vector store: queries vectors
app/retrieval/pipeline.py - Retrieval pipeline → BM25 index: searches terms
app/retrieval/pipeline.py - Retrieval pipeline → RRF fusion: fuses rankings
app/retrieval/pipeline.py - Retrieval pipeline → Cross-encoder reranker: reranks candidates
app/retrieval/pipeline.py - Service container → RAG engine: constructs
app/services/container.py - Service container → Conversation memory: constructs
app/services/container.py - RAG engine → Conversation memory: loads history
app/generation/rag_engine.py - RAG engine → Grounded prompts: builds context
app/generation/rag_engine.py - RAG engine → LLM provider: generates answer
README.md - RAG engine → Citation rendering: renders citations
app/generation/rag_engine.py - Evaluation runner → Evaluation metrics: computes metrics
app/evaluation/runner.py - Evaluation runner → LLM judges: runs judges
app/evaluation/runner.py