A Retrieval-Augmented Generation (RAG) application that enables users to interact with YouTube videos through natural language conversations.
The application extracts video transcripts, converts them into vector embeddings, stores them in a vector database, and uses a local Large Language Model (LLM) to answer user questions contextually.
Built using Streamlit, LangChain, ChromaDB, HuggingFace embeddings, and Ollama.
- 🔗 Accepts YouTube video URLs
- 📝 Automatically fetches video transcripts
- ✂️ Splits transcripts into semantic chunks
- 🧠 Generates embeddings using HuggingFace models
- 📦 Stores embeddings in Chroma Vector Database
- 🔍 Performs semantic similarity search
- 🤖 Uses Ollama-powered local LLMs for question answering
- 💬 Supports conversational Retrieval-Augmented Generation (RAG)
- 📎 Displays retrieved source chunks for transparency
- 🎨 Interactive Streamlit-based interface
- Streamlit
- LangChain
- Ollama
- ConversationalRetrievalChain
- HuggingFace Sentence Transformers
- all-MiniLM-L6-v2
- ChromaDB
- YouTube Transcript API
- Pytube
youtube_rag/
│
├── app.py
├── config.py
├── requirements.txt
│
├── data/
│
├── chroma_db/
│
├── src/
│ ├── embeddings.py
│ ├── qa_chain.py
│ ├── retriever.py
│ ├── text_splitter.py
│ ├── transcript_loader.py
│ └── vector_store.py
│
└── utils/
└── helpers.pygit clone <your-repository-url>
cd youtube_ragpy -3.11 -m venv venvActivate the environment:
venv\Scripts\activatepip install -r requirements.txtDownload and install Ollama:
Pull a model:
ollama pull mistralor
ollama pull gemma:2bStart the Streamlit app:
streamlit run app.pyOpen the application in your browser:
http://localhost:8501- User enters a YouTube video URL
- Transcript is fetched using YouTube Transcript API
- Transcript is split into smaller chunks
- Embeddings are generated for each chunk
- Embeddings are stored in ChromaDB
- User asks questions about the video
- Relevant chunks are retrieved using semantic search
- Ollama generates contextual answers using retrieved information
- Summarize the video
- What are the key points discussed?
- Explain the main concept
- What tools were mentioned?
- Give actionable insights from the video
Nimish Pathak