Overview
LlamaIndex is an open-source Python framework for building LLM applications on top of your own data. It gives you data connectors to ingest sources like PDFs, docs, APIs, and SQL, ways to structure that data into indices, and a retrieval and query interface so an LLM can answer questions using your private context (the pattern usually called RAG).
It is aimed at developers who need a language model to reason over documents and data it was never trained on. There is a high-level API that lets you ingest and query data in about five lines of code, plus lower-level APIs to customize data connectors, retrievers, query engines, and reranking when you outgrow the defaults.
As an agent framework, LlamaIndex pairs retrieval with agent and workflow tooling, and connects to over 300 integration packages on LlamaHub for your preferred LLM, embedding, and vector store providers. It also fits alongside other tools such as LangChain, Flask, or Docker.
What it does
- Data connectors to ingest existing sources and formats including APIs, PDFs, docs, and SQL
- Indexing structures (indices, graphs) that make your data usable by LLMs
- Retrieval and query interface that returns context plus a knowledge-augmented answer (RAG)
- Over 300 integration packages on LlamaHub for LLM, embedding, and vector store providers
- High-level API for a five-line quickstart, with lower-level APIs to customize each module
- Agent and workflow tooling, plus the optional LlamaParse platform for document parsing and extraction
Getting started
LlamaIndex installs from PyPI. The starter package bundles core plus common integrations; you can also install core alone and add only the integrations you need.
Install the starter package
The llama-index package includes core LlamaIndex plus a selection of integrations, which is the quickest way to start.
pip install llama-indexIndex your documents and query them
Put your files in a data folder, then load, index, and query in a few lines. By default this uses OpenAI, so set your OPENAI_API_KEY environment variable first.
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader
documents = SimpleDirectoryReader("data").load_data()
index = VectorStoreIndex.from_documents(documents)
query_engine = index.as_query_engine()
response = query_engine.query("Your question here")
print(response)Customize with your own integrations
For more control, install core and add only the integration packages your app needs. Import paths without `core` indicate an integration package.
pip install llama-index-core
pip install llama-index-llms-openai
pip install llama-index-llms-ollama
pip install llama-index-embeddings-huggingfaceCommands and code are distilled from the project's own documentation — always check the official repo for the latest.
When to use it
- Build a question-answering or chat assistant that responds using your own PDFs, docs, or wiki
- Add retrieval-augmented generation (RAG) so an LLM answers from private, up-to-date context
- Ingest data from APIs, SQL, or files and make it queryable through a language model
- Build document agents and workflows that parse, extract, and reason over large document sets
How LlamaIndex compares
LlamaIndex alongside other open-source app frameworks tools AI/TLDR tracks, ranked by GitHub stars.
| Tool | Stars | What it does |
|---|---|---|
| LangChain | ★ 140k | A widely used Python and JavaScript framework for building LLM applications by composing models, prompts, tools, retrievers, and memory into chains. |
| LlamaIndex | ★ 50.2k | Connect language models to your own data with retrieval and agents |
| Haystack | ★ 25.6k | An orchestration framework from deepset for building modular LLM pipelines and agents for search, RAG, and question answering. |
| Jina | ★ 21.9k | Jina-serve is a Python framework for building, scaling, and deploying AI services and multi-step pipelines that communicate over gRPC, HTTP, and WebSockets. |
| Prompt Flow | ★ 11.2k | Microsoft's toolkit for building LLM apps as executable flows that link prompts, Python code, and tools, with tracing, batch evaluation, and deployment. |