Part II: LlamaIndex 0.14 and the Workflows API

Part II covers the other major open source LLM framework covered in this book: LlamaIndex, built around the llama-index-core package, together with its Workflows API. LlamaIndex occupies overlapping-but-distinct territory with LangChain. It has always been strongest at retrieval, indexing, and document-centric applications, and its API is shaped accordingly. There is nothing to unlearn from Part I: prompts are still prompts, embeddings are still embeddings, and RAG is still RAG. What changes is the vocabulary and the choreography. As in Part I, every example runs locally against Ollama and a small local embedding model, with no LlamaCloud, LlamaParse, or llama-cloud-services account anywhere in sight.

The mental model is four concepts: Documents get chunked into Nodes, Nodes get organized into an Index, and an Index exposes a QueryEngine (or a lower-level Retriever) for answering questions. The opening chapter is a one-hour tour that introduces all four; everything after it is a variation on the theme.

From there we go deep on the pieces that make retrieval good rather than merely working: loading your own documents and choosing a local embedding model, the different index types and when to reach for each, and reranking to push the best passages to the top of the context window. Then we introduce the Workflows API (LlamaIndex’s event-driven answer to LangGraph) and use it to build a real agent, route queries across multiple indices, extract structured data into Pydantic objects, and finally serve a workflow over plain FastAPI: one process, no cloud, no message queue.

Part II then finishes with a few applied and integration chapters: organizing a Google Drive with local LLMs, running Hugging Face models locally, and modern replacements for a couple of older helper libraries. The book closes with four appendices on cross-cutting concerns that apply equally to both frameworks: choosing a model size, doing evaluation without LangSmith, doing observability without LangSmith, and putting a small LLM app on a $5/month VPS.