Qlaudia

← All courses

LlamaIndex

  • Artificial Intelligence
  • Technology & Computing

Ingest external data, transform it into embeddings and indexes, and query it at runtime so LLMs can generate accurate, grounded responses. Master each stage of the retrieval-augmented generation pipeline—from data connectors and chunking through vector stores, retrievers, and response synthesis.

Sign in to enroll$1035 lessons

What you'll learn

  • NodeThe atomic unit of data storage in LlamaIndex, representing a single chunk of text extracted from a document that can be embedded and retrieved independently.
  • LLM IntegrationThe configuration and use of a large language model as the generation backbone that produces text output for operations like query answering and summarisation.
  • RetrieverThe component responsible for selecting the most relevant Nodes from an index in response to a query, sitting between the index and response synthesizer in the RAG pipeline.
  • Embedding ModelA neural network that maps text to fixed-length numeric vectors in high-dimensional space so that semantically similar texts are positioned close together.
  • Query EngineLlamaIndex's highest-level interface that combines a Retriever and Response Synthesizer to answer natural-language questions over an indexed corpus automatically.
  • Vector Store IndexAn index that converts text chunks into embedding vectors and stores them in a vector store to enable semantic similarity-based retrieval instead of exact keyword matching.
  • Retrieval-Augmented Generation (RAG)A design pattern that retrieves relevant information from an external knowledge source and injects it into the prompt before the LLM generates its answer, grounding responses in authoritative context.
  • Ingestion PipelineA configurable, reusable sequence of transformation steps that converts raw documents into indexed, searchable representations by passing them through load, transform, and embed-and-store stages.
  • Response SynthesizerThe component responsible for taking a user's query and retrieved nodes, then producing a single coherent natural-language answer using a large language model.
  • DocumentThe fundamental container in LlamaIndex that bundles together raw text content, metadata describing that content, and a unique identifier.
  • Observability and CallbacksMechanisms in LlamaIndex that let you log, trace, and monitor every internal operation through a callback system to debug failures and inspect intermediate results.
  • Text Splitter / Node ParserA pipeline component that divides raw documents into smaller chunks called nodes, balancing context preservation with retrieval precision through configurable chunk size and overlap.
  • Chat EngineA stateful interface for multi-turn dialogue that maintains conversation history so follow-up questions can reference earlier messages.
  • AgentAn autonomous reasoning loop that uses an LLM to decide which tools to call in what order and with what inputs until reaching a satisfactory answer.
  • MetadataKey-value pairs of descriptive information attached to documents or nodes that capture structured facts like authorship, date, source, and category.
  • Service ContextA configuration bundle that groups shared components like the LLM, embedding model, and node parser needed across indexing and querying operations.
  • Index PersistenceThe ability to serialize a LlamaIndex index to durable storage and later deserialize it back into memory without re-processing documents or re-embedding text.
  • Summary IndexAn index type that stores nodes in a flat, ordered sequence without computing embeddings, designed for queries that synthesize information across all or most documents.
  • Vector StoreA specialised database that stores embeddings and answers approximate nearest-neighbour queries efficiently using purpose-built indexing structures like HNSW or IVF.
  • ToolA callable interface with name and description metadata that allows an agent to invoke external capabilities such as query engines, APIs, or retrievers during reasoning.
  • Router Query EngineA meta-level query engine that acts as a dispatcher, selecting and routing queries to the most appropriate sub-engine based on LLM, embedding similarity, or rule-based logic.
  • Knowledge Graph IndexA specialised index type that extracts entities and relationships from documents and stores them as a connected graph structure for multi-hop reasoning during retrieval.
  • Metadata FilteringA retrieval technique that restricts nodes considered during a query by applying logical conditions on their metadata fields before ranking by relevance.
  • Similarity Top-KA retrieval parameter that specifies the maximum number of Nodes the retriever returns by selecting the k highest-scoring candidates based on their similarity to the query.
  • RerankerA post-retrieval component that re-scores and reorders retrieved nodes using a more expensive but accurate scoring model to improve relevance before passing context to an LLM.
  • Sub-Question Query EngineAn advanced query engine that decomposes complex multi-part questions into simpler sub-questions, routes each to relevant data sources, and synthesizes the answers into a single response.
  • Evaluation (Faithfulness)A metric that measures whether claims in a generated answer are factually grounded in and supported by the retrieved context.
  • Evaluation (Relevancy)A metric that assesses whether retrieved nodes and the generated response are actually pertinent to the user's query.
  • Chunk Size and OverlapConfiguration parameters that control how documents are split into smaller text units, with chunk size setting the maximum tokens per chunk and overlap determining tokens repeated at chunk boundaries.
  • Hybrid SearchA retrieval technique that combines dense vector search with sparse keyword-based search like BM25 to handle both semantic similarity and exact-match queries.
  • Prompt TemplateA customizable string scaffold that controls how retrieved context and a user's question are formatted before being submitted to the LLM.
  • Data Connector (Reader)A component that loads raw data from external sources and converts it into Document objects, providing the entry point for every LlamaIndex ingestion pipeline.
  • ReAct AgentAn agent strategy that interleaves explicit reasoning steps with action steps, making the model's chain of thought visible before every tool call and after every observation.
  • Response ModeA setting on the Response Synthesizer that controls the strategy for combining multiple retrieved text nodes into a final answer, making trade-offs between LLM calls, prompt size, latency, and answer quality.
  • Transformation / ComponentA self-contained processing step that accepts a list of nodes as input and returns a modified or augmented list of nodes as output.

About this course

LlamaIndex Overview

What Problem Does LlamaIndex Solve?

Large language models (LLMs) like GPT-4 or LLaMA are trained on a fixed snapshot of data. Once training is complete, the model has no awareness of anything outside that snapshot — not your company's internal documents, not a live database, not a PDF uploaded this morning. If you ask such a model about your private data, it simply cannot answer accurately; it will either refuse or hallucinate.

LlamaIndex is an open-source Python framework built to close this gap. It gives you a structured, composable pipeline for ingesting external data, indexing it in a way an LLM can reason over, and querying it at runtime so the model can generate grounded, accurate responses. Think of LlamaIndex as the connective tissue between your data and the LLM brain.


The Core Mental Model

The fundamental workflow in LlamaIndex follows three stages:

  1. Load — bring raw data in from any source (files, APIs, databases).
  2. Index — transform and store the data in a structure optimised for retrieval.
  3. Query — accept a natural-language question, retrieve relevant context, and pass it to the LLM for a final answer.
1. LOAD Documents & Data 2. INDEX Chunks + Embeddings 3. QUERY Retrieve + Generate

The three-stage LlamaIndex pipeline: raw data is loaded, transformed into an index, then queried at runtime to ground LLM responses.


Key Components

Data Connectors (Readers)

LlamaIndex ships with a large library of data connectors (also called readers) that can pull content from PDFs, Word documents, Notion pages, Slack channels, SQL databases, REST APIs, and many more sources. Each reader converts a raw source into a Document object — a standardised container that holds the text content alongside metadata such as the source URL or file name.

Node Parsing and Chunking

A raw document is usually too large to feed directly into an LLM's context window. LlamaIndex breaks documents into smaller units called Nodes. A node typically represents a chunk of text (e.g., a few paragraphs) plus a reference back to the parent document. The chunking strategy — chunk size, overlap, and splitting logic — can be configured or customised.

Embeddings

Once data is chunked into nodes, LlamaIndex converts each node into a vector embedding — a numerical representation that captures semantic meaning. The embedding model can be an OpenAI model, a Hugging Face model, or any other compatible encoder. These vectors are what make semantic search possible: similar concepts end up close together in the embedding space.

Mathematically, given a text chunk tt, an embedding model ff produces a vector v=f(t)∈Rd\mathbf{v} = f(t) \in \mathbb{R}^d. Retrieval then finds the nodes whose vectors have the highest cosine similarity to the query vector:

similarity(q,v)=q⋅v∥q∥∥v∥\text{similarity}(\mathbf{q}, \mathbf{v}) = \frac{\mathbf{q} \cdot \mathbf{v}}{\|\mathbf{q}\| \|\mathbf{v}\|}

Indexes

An index is the data structure that organises nodes for fast, relevant retrieval. The most common type is the VectorStoreIndex, which stores embeddings in a vector store (in-memory by default, or backed by external stores like Pinecone or Chroma) and retrieves top-kk nearest neighbours at query time. Other index types include list indexes, tree indexes, and keyword table indexes, each suited to different retrieval patterns.

Retrievers

A retriever is the component responsible for fetching the most relevant nodes from an index given a query. The default retriever uses the vector similarity search described above, but LlamaIndex supports more advanced strategies such as hybrid search (combining dense and sparse retrieval) and recursive retrieval across multiple indexes.

Response Synthesisers and Query Engines

Once relevant nodes are retrieved, a response synthesiser assembles a prompt that includes the retrieved context and the original question, then calls the LLM to generate an answer. A query engine is a higher-level object that combines a retriever and a response synthesiser into a single interface — you call query_engine.query("your question") and get back a grounded answer in one step.

Agents and Tools

For more dynamic tasks, LlamaIndex supports agents — LLM-powered reasoning loops that can decide which tools to call and in what order. A query engine can be wrapped as a tool and handed to an agent. This enables multi-step reasoning, such as querying multiple data sources, performing calculations, and synthesising a final answer.


How the Pieces Fit Together

Raw Data PDF, DB, API… Data Connector → Documents Node Parser → Nodes (chunks) Index Embeddings stored Retriever Top-k nodes LLM Generate answer User Query Natural language

Full LlamaIndex architecture: the top row is the ingestion pipeline; the bottom row is the query pipeline. Both share the index as their meeting point.


Why This Architecture Matters

This pattern — retrieve relevant context, then generate — is known as Retrieval-Augmented Generation (RAG). RAG is important because:

  • The LLM only needs to reason over a small, relevant subset of the data, which fits within its context window.
  • Answers are grounded in actual source material, reducing hallucinations.
  • The knowledge base can be updated without retraining the model.

LlamaIndex is one of the most fully featured frameworks for building RAG systems in Python, offering fine-grained control over every stage of the pipeline.


What You Will Learn in This Course

This course walks through each component in depth:

  • Data loading and Documents — how to ingest data from diverse sources.
  • Node parsing — chunking strategies and their trade-offs.
  • Embeddings and Vector Stores — how semantic similarity search works.
  • Index types — VectorStoreIndex and alternatives.
  • Retrievers — configuration and advanced strategies.
  • Query Engines and Response Synthesis — from query to answer.
  • Agents and Tools — multi-step, dynamic reasoning.
  • Evaluation — measuring the quality of a RAG pipeline.

Each topic builds on the previous one. By the end, you will be able to design and deploy a fully functional RAG application over your own data using LlamaIndex.

LlamaIndex — Qlaudia