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

  1. Introduction — Data-layer positioning vs LangChain, CrewAI, and this site’s RAG course
  2. Installationpip install llama-index, API keys, Settings
  3. Quick StartFunctionAgent, VectorStoreIndex, persistence, multi-turn Context

Data and querying

  1. Loaders and NodesDocument, Node, SimpleDirectoryReader, splitting
  2. IndexesVectorStoreIndex.from_documents and other index types
  3. Query Enginesas_query_engine, synthesis modes, chat engines
  4. Retrieval — Retrievers, top-k, postprocessors, agentic RAG

Orchestration and storage

  1. Workflows — Event-driven @step vs graph-style DAGs
  2. Vector Stores — Chroma, pgvector, and Qdrant integration packages

Practice

  1. Practical Examples — Doc Q&A, RAG agent with tools, multi-turn chat
  2. Resources — Official docs, LlamaHub, related courses

Learning path

StageGoalChapters
Day 1Run RAG and a tiny agentIntro → Install → Quick Start
Days 2–3Own the data layerLoaders → Indexes → Query engines
Week 1Retrieval quality and orchestrationRetrieval → Workflows → Vector stores
Week 2Real documentsExamples → Resources

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)
CourseLinkHow it pairs with LlamaIndex
RAG (concepts)/en/rag/Vocabulary for chunk / embed / recall / generate, then implement here
LangChain/en/langchain/Agent harness, tool loop, LangGraph; you can still index with LlamaIndex
CrewAI/en/crewai/Role-based crews; the knowledge base can still be this course’s Index / QueryEngine

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/, builds VectorStoreIndex.from_documents, and answers with as_query_engine
  • A FunctionAgent with multiply / search tools and multi-turn Context
  • 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

  1. Put your own Markdown / PDFs in data/—an empty folder teaches nothing
  2. Examples use gpt-4o-mini. The framework historically defaulted to gpt-3.5-turbo; follow the current official docs
  3. Call persist after indexing so you do not re-embed on every process start
  4. When answers look wrong, inspect response.source_nodes before tweaking top-k and chunk size

Next steps

评论