Production-style RAG system for YouTube transcript summarization and question answering.
- Fetches English transcripts from YouTube
- Summarizes the video content
- Supports question answering over the transcript
- Provides a local web interface with Gradio
- Exposes a FastAPI backend for programmatic access
- Uses centralized runtime configuration through
.env - Emits structured logs for pipeline steps, latency, warnings, and errors
gradiofor the web UIfastapianduvicornfor the API backendyoutube-transcript-apifor retrieving video transcriptslangchainfor prompt and chain orchestrationlangchain-ollamafor the LLM integrationlangchain-huggingfaceandsentence-transformersfor embeddingsfaiss-cpufor vector search over transcript chunks
Install dependencies:
uv syncThe default LLM backend uses Ollama with phi3:mini:
ollama pull phi3:miniCreate a local .env file from the example:
cp .env.example .envMain runtime parameters:
YT_LLM_MODEL=phi3:mini
YT_LLM_TEMPERATURE=0.5
YT_LLM_TIMEOUT_SECONDS=60
YT_LLM_RETRY_ATTEMPTS=2
YT_EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2
YT_CHUNK_SIZE=1000
YT_CHUNK_OVERLAP=200
YT_RETRIEVAL_TOP_K=7
YT_DATA_DIR=data
YT_LOG_LEVEL=INFO
YT_LOG_JSON=true
YT_API_PORT=8000
YT_GRADIO_PORT=7865Start the FastAPI backend first:
uv run yt-summarizer-apiThen run the Gradio frontend:
uv run yt-summarizer-uiThe UI launches locally on port 7865 by default and calls the API backend.
uv run yt-summarizer-apiThe API launches locally on port 8000.
Useful URLs:
http://localhost:8000/health
http://localhost:8000/docs
Example request:
curl -X POST http://localhost:8000/ingest_video \
-H "Content-Type: application/json" \
-d '{"video_url": "https://www.youtube.com/watch?v=VIDEO_ID"}'Then query the online endpoints using the returned video_id:
curl -X POST http://localhost:8000/summarize \
-H "Content-Type: application/json" \
-d '{"video_id": "VIDEO_ID"}'curl -X POST http://localhost:8000/ask \
-H "Content-Type: application/json" \
-d '{"video_id": "VIDEO_ID", "question": "What is the main topic?"}'uv run src/main.py