Preface
- Who this book is for
- What this book covers, and what it deliberately does not
- What you need to install
- Where the code lives
- Requests from the Author
- About the Author
- Book Cover
- Acknowledgements
The Stack We’re Building On
- The whole book, in one dependency list
- What we are deliberately not installing
- A note on
uvandpyproject.toml - The one-time setup
Large Language Model Overview
- Technological Change is Increasing at an Exponential Rate
- What LLMs Are and What They Are Not
- Big Tech Businesses vs. Small Startups Using Large Language Models
- Part I: LangChain 1.0 and LangGraph 1.0
LangChain 1.0 in One Hour
- The chapter directory layout
- Your first chat model call
- Swapping in a hosted model
- Two more Runnable methods
.stream()and.batch() - Prompt templates and the LCEL pipe
- Output parsers and structured output
- Tool binding
- What we covered
Swapping Between Local and Commercial Models
- Switching providers in LangChain
- Switching providers in LlamaIndex
- Wrap up
RAG Patterns with LangChain
- A shared corpus loader
- Pattern 1: naive RAG
- Pattern 2: retrieve wide, rerank narrow
- Pattern 3: hybrid dense + sparse retrieval
- Pattern 4: multi-query rewriting
- Which pattern for which situation
- What we covered
Running Local LLMs Using Ollama
- Simple Use of a Local Model Using LangChain
- Minimal Example Using Ollama for Retrieval Augmented Queries Against Local Documents
- Wrap Up for Running Local LLMs Using Ollama
Extraction of Facts and Relationships from Text Data
- Key Capabilities of LLMs for Fact and Relationship Extraction
- Techniques and Approaches
- Benefits
- Applications
- Example Prompts for Getting Information About a Person from Text and Generating JSON
- From One Record to Many: CSV to JSON
- What we covered
Using LLMs to Summarize Text
- Example Prompt
- Code Example
LangGraph 1.0 Fundamentals
- What LangGraph is, and is not
- Why a graph at all
- Setup
- Example 1: hello graph
- Example 2: state fields with reducers
- Example 3: conditional routing
- Example 4: an LLM in a node
- What we covered
Building a ReAct Agent with LangGraph + Ollama
- The shape of a ReAct loop
- The tools the agent will use
- Version 1:
create_agent - Version 2: the same agent, built explicitly
- When to reach for which version
- Watching each step with
.stream() - Two failure modes worth knowing
- What we covered
Durable, Restart-Safe Agents
- Three flavors of checkpointer
- The shared graph
- Example 1:
MemorySaverandthread_id - Example 2:
SqliteSaver, spread across two processes - Example 3: inspecting checkpoint history
- Two design points worth internalizing
- What we covered
Human-in-the-Loop Patterns
- Example 1: the minimum viable interrupt
- Example 2: a tool-approval gate
- Example 3: pause after a node, edit the checkpoint, resume
- Two mechanisms, when to reach for each
- What we covered
Multi-Agent Supervisor Pattern
- The example
- The specialists
- The supervisor and the graph
- Running it
- Watching the routing
- When multi-agent is worth it
- What we covered
Natural-Language SQLite
- The sample database
- The four SQL tools
- Building the agent
- Running it
- Watching the SQL get written
- Where to take this next
- What we covered
DBpedia and Wikidata as Agent Tools
- The example
- The DBpedia agent
- The Wikidata agent
- DBpedia versus Wikidata
- Where to take this next
- What we covered
A Perplexity-Style Local Search Agent
- The pipeline
- The graph
- Running a complete example
- Watching each stage
- Extending this
- Wrapping up Part I
- Part II: LlamaIndex 0.14 and the Workflows API
LlamaIndex
- What changed since the previous edition
- The four primitives
- Setup
- Your first LlamaIndex program
- Swapping in a hosted model
- Persist an index, reload it later
- Retrievers, without the LLM
- What we covered
Local Documents and Local Embeddings
SimpleDirectoryReaderdeep dive- Building Documents by hand
- Comparing embedding models
- Chunking with the ingestion pipeline
- What we covered
Choosing an Index Type
SummaryIndex: every query touches every NodeSimpleKeywordTableIndex: retrieval by exact keyword matchQueryFusionRetriever: the practical hybrid pattern- Decision tree
- What we covered
RAG with Reranking
- Baseline: no reranker
- Same query, with a reranker
- What the reranker actually costs
- What we covered
The Workflows API
- The four primitives
- Setup
- Hello workflow
- Chaining steps with a custom event
- Branching by event type
- A three-step LLM workflow
- Workflows vs LangGraph
- What we covered
Building an Agent as a Workflow
- The Tools
- Version 1:
FunctionAgent - Version 2: same agent, built explicitly
- When to Reach for Which Framework
- What we covered
Multi-Index Query Pipelines
RouterQueryEngine: pick one indexSubQuestionQueryEngine: decompose and combine- When to reach for which
- What we covered
Structured Extraction
- One-shot extraction
- Batch extraction
- When to reach for this vs a chat model with tools
- What we covered
Serving a Workflow with FastAPI
- The moving parts
- The workflow being served
- Terminal 1: the server
- Terminal 2: the client
- Scaling from here
- What we covered
Using LLMs To Organize Information in Our Google Drives
- Setting Up Requirements
- Write Utility To Fetch All Text Files From Top Level Google Drive Folder
- Generate Vector Indices for Files in Specific Google Drive Directories
- Google Drive Example Wrap Up
Examples Using Hugging Face Open Source Models
- Using LangChain as a Wrapper for a Local Hugging Face Pipeline
- Creating a Custom LlamaIndex Hugging Face LLM Wrapper Class That Runs on Your Laptop
Book Wrap Up
- Where the book falls short
- Thank you