How sabertooth-123/rag_yt_chatbot works
yt-chat is a terminal YouTube-video Q&A application designed to ground answers in timestamped transcript passages and refuse when retrieval confidence or citations are insufficient. Its principal workflow runs from a user’s video and question through transcript acquisition, cleaning and chunking, embedding and caching, retrieval, answer generation and citation checks, then displays linked timestamps. Separate evaluation capabilities compare retrievers, measure citation and answer quality, and calibrate refusal thresholds. The graph follows documented workflow and sampled orchestration references; unsampled implementation details are not inferred.
Main entry points: pipeline.py Pipeline orchestration · app.py CLI and chat · factory.py Retriever selection · runner.py Evaluation runner
Components 28
Terminal interface
- CLI and chat
src/ytchat/cli/app.py - Chat commands
src/ytchat/cli/repl.py
Transcript indexing
- Pipeline orchestration
src/ytchat/pipeline.py - Video URL parsing
src/ytchat/ingestion/url.py - Transcript acquisition
src/ytchat/ingestion/transcript.py - Video metadata
src/ytchat/ingestion/metadata.py - Transcript cleaning
src/ytchat/preprocessing/clean.py - Timed chunking
src/ytchat/preprocessing/chunking.py - Embedding providers
src/ytchat/embeddings/factory.py - Transcript and cache
src/ytchat/database/repository.py - Vector index
src/ytchat/database/vectorstore.py
Search and answers
- Retriever selection
src/ytchat/retrieval/factory.py - Dense search
src/ytchat/retrieval/dense.py - Sparse search
src/ytchat/retrieval/sparse.py - Hybrid search
src/ytchat/retrieval/hybrid.py - Optional reranking
src/ytchat/retrieval/rerank.py - Follow-up rewriting
src/ytchat/generation/rewriter.py - Grounded answering
src/ytchat/generation/answerer.py - Citation validation
src/ytchat/generation/citations.py - LLM adapters
src/ytchat/generation/llm.py
Evaluation
- Benchmark datasets
src/ytchat/evaluation/dataset.py - Evaluation runner
src/ytchat/evaluation/runner.py - Retrieval metrics
src/ytchat/evaluation/retrieval_metrics.py - Generation scoring
src/ytchat/evaluation/generation_metrics.py - Evaluation reports
src/ytchat/evaluation/report.py
Other components
- Video and question
- YouTube
- LLM service
Connections 29
- Video and question → CLI and chat: provides video
README.md - CLI and chat → Pipeline orchestration: starts workflow
src/ytchat/cli/app.py - CLI and chat → Chat commands: opens chat
src/ytchat/cli/app.py - Pipeline orchestration → Video URL parsing: parses video
src/ytchat/pipeline.py - Pipeline orchestration → Transcript acquisition: fetches captions
src/ytchat/pipeline.py - Pipeline orchestration → Video metadata: fetches metadata
src/ytchat/pipeline.py - Pipeline orchestration → Transcript cleaning: cleans transcript
src/ytchat/pipeline.py - Pipeline orchestration → Timed chunking: creates chunks
src/ytchat/pipeline.py - Pipeline orchestration → Embedding providers: builds embeddings
src/ytchat/pipeline.py - Pipeline orchestration → Transcript and cache: caches stages
src/ytchat/pipeline.py - Pipeline orchestration → Vector index: builds index
src/ytchat/pipeline.py - Transcript acquisition → YouTube: fetches subtitles
README.md - Chat commands → Pipeline orchestration: queries video
src/ytchat/cli/repl.py - Pipeline orchestration → Retriever selection: selects search
src/ytchat/pipeline.py - Retriever selection → Dense search: creates dense
src/ytchat/retrieval/factory.py - Retriever selection → Sparse search: creates sparse
src/ytchat/retrieval/factory.py - Retriever selection → Hybrid search: creates hybrid
src/ytchat/retrieval/factory.py - Retriever selection → Optional reranking: configures reranking
src/ytchat/retrieval/factory.py - Pipeline orchestration → Follow-up rewriting: rewrites follow-ups
src/ytchat/pipeline.py - Pipeline orchestration → Grounded answering: generates answer
src/ytchat/pipeline.py - Grounded answering → Citation validation: checks citations
src/ytchat/generation/answerer.py - Grounded answering → LLM adapters: requests completion
src/ytchat/generation/answerer.py - LLM adapters → LLM service: sends prompt
src/ytchat/generation/llm.py - CLI and chat → Benchmark datasets: loads benchmarks
src/ytchat/cli/app.py - CLI and chat → Evaluation runner: runs evaluation
src/ytchat/cli/app.py - Evaluation runner → Benchmark datasets: evaluates cases
src/ytchat/evaluation/runner.py - Evaluation runner → Retrieval metrics: scores retrieval
src/ytchat/evaluation/runner.py - Evaluation runner → Generation scoring: scores answers
src/ytchat/evaluation/runner.py - CLI and chat → Evaluation reports: formats results
src/ytchat/cli/app.py