Build Your Own Local PDF RAG Chatbot (Tutorial)

5 Nov 2024 · 28 min
28:16

In this tutorial, the creator updates and expands a previously popular YouTube guide on chatting with PDFs using local large language models (LLMs). The video walks through the repository’s directory layout, emphasizing the need to pin specific package versions (including protobuf, ChromaDB, and Ollama-related libraries) to resolve errors that plagued the original tutorial. It demonstrates loading a PDF (the "scammer agent" paper) with Unstructured PDF Loader, then splitting the text into overlapping chunks using LangChain’s RecursiveCharacterTextSplitter (default 1,000‑character chunks with 200‑character overlap). The chunks are embedded with the Nomic Embed model via Ollama and stored in a Chroma collection named "local‑rag". Retrieval is enhanced through a multi‑query retriever that generates two alternative questions per user query, retrieves relevant contexts for all three queries, and merges them. A LangChain chain combines a RAG prompt template, the retriever, and a local Llama 3.2 model to produce answers. Latency observations (≈28–62 seconds per query) are discussed. The tutorial then shows a Streamlit app that mirrors the notebook’s functionality, offering side‑by‑side PDF viewing and chat, model selection, caching, and collection deletion. The video concludes with instructions for running the app, contributing via GitHub, and encouraging community feedback.

Chapters

More from Tony

4:21
youtube.com

What Is LoRA? AI Fine-Tuning Explained With Glasses

1mo ago
3:07
youtube.com

i bought NVIDIA’s DGX Spark (unboxing a desktop AI Supercomputer)

1mo ago
2:59
youtube.com

Rekody: A Private Dictation App That Runs Entirely on Your Mac for Free!

3mo ago
11:49
youtube.com

Own Your LLM: Deploy + Build an App on It (Modal Auto Endpoints)

3mo ago
9:30
youtube.com

How to Setup Claude Code's NEW Remote Control Feature (Step-by-Step)

7mo ago
4:58
youtube.com

Faxes are Still a Thing? Here’s How I Automated Them for $1

7mo ago
15:04
youtube.com

CrewAI Flows Made Super Easy

1y ago
5:15
youtube.com

Summarize Videos and Research Companies with CrewAI + Gemini Models [Quickstart Guide]

1y ago
4:10
youtube.com

NotebookLM Video Overviews in 4 Minutes

1y ago
22:47
youtube.com

How I Made 3 AI Agents Work Together for Smarter Reports!

1y ago
8:36
youtube.com

How to Make Your AI Agents More Reliable with CrewAI Task Guardrails (Step-by-Step Tutorial)

1y ago
See all content