LlamaIndex Tutorial
Welcome to the LlamaIndex tutorial. It follows the official Python docs and run-llama/llama_index, and focuses on RAG and document agents over your data: loaders, indexes, querying, FunctionAgent, and event-driven Workflows.
LlamaIndex’s framing is context augmentation: private PDFs, wikis, SQL, and APIs become context the LLM can use at inference time. The most common shape is RAG; the same index can also be an agent tool.
Table of Contents
Basics
- Introduction — Data-layer positioning vs LangChain, CrewAI, and this site’s RAG course
- Installation —
pip install llama-index, API keys,Settings - Quick Start —
FunctionAgent,VectorStoreIndex, persistence, multi-turnContext
Data and querying
- Loaders and Nodes —
Document,Node,SimpleDirectoryReader, splitting - Indexes —
VectorStoreIndex.from_documentsand other index types - Query Engines —
as_query_engine, synthesis modes, chat engines - Retrieval — Retrievers, top-k, postprocessors, agentic RAG
Orchestration and storage
- Workflows — Event-driven
@stepvs graph-style DAGs - Vector Stores — Chroma, pgvector, and Qdrant integration packages
Practice
- Practical Examples — Doc Q&A, RAG agent with tools, multi-turn chat
- Resources — Official docs, LlamaHub, related courses
Learning path
Prerequisites
- Python 3.10+ (functions, type hints, a little
asyncio) - Familiarity with chat APIs and “chunk, embed, retrieve, generate”
- At least one provider API key (examples use OpenAI; local models: Ollama)
Related courses on this site
One-line choice: documents and retrieval first → LlamaIndex; standard ReAct agents and middleware → LangChain; “researcher + writer + reviewer” crews → CrewAI. They compose; they are not mutually exclusive.
What you will be able to build
- A script that loads
data/, buildsVectorStoreIndex.from_documents, and answers withas_query_engine - A
FunctionAgentwith multiply / search tools and multi-turnContext - Disk
persist, or a swap to Chroma / pgvector / Qdrant integration packages - Enough Workflows vocabulary to read official
@step+ Event graphs without treating a query engine as a DAG
LlamaIndex.TS exists separately; this course is Python-only. TypeScript readers should use the TS entry linked from the framework docs.
Study tips
- Put your own Markdown / PDFs in
data/—an empty folder teaches nothing - Examples use
gpt-4o-mini. The framework historically defaulted togpt-3.5-turbo; follow the current official docs - Call
persistafter indexing so you do not re-embed on every process start - When answers look wrong, inspect
response.source_nodesbefore tweaking top-k and chunk size