RAG & LLMs / 1. DOCUMENT LOADING
Stage 1: Document Loading
LangChain DocumentLoaders — every source, one interface
EXPLANATION
DocumentLoaders convert raw files into LangChain Document objects. Each Document has: • page_content → the actual text • metadata → source, page number, author, etc. LangChain has 100+ loaders: PDF, CSV, HTML, Notion, Google Drive, YouTube, SQL, and more. They all return the same Document format so the rest of your pipeline doesn't change regardless of source.
DATA FLOW
PDF ──→ PyPDFLoader ──→ [Document(page_content, metadata)]
.txt ──→ TextLoader ──→ [Document(page_content, metadata)]
website ──→ WebBaseLoader ──→ [Document(page_content, metadata)]
.csv ──→ CSVLoader ──→ [Document(page_content, metadata)]
folder ──→ DirectoryLoader ──→ [Document(page_content, metadata)]
↓
Same interface for everything!CODE