# LlamaIndex

> Connect language models to your own data with retrieval and agents

- Category: App Orchestration / App Frameworks
- Language: Python
- Licence: MIT
- Repository: https://github.com/run-llama/llama_index
- Website: https://developers.llamaindex.ai
- Canonical page: https://ai-tldr.dev/tools/llamaindex/

## In short

LlamaIndex is an open-source Python framework for building LLM applications on top of your own data. It sits in the App Frameworks category of the App Orchestration tools and is open-source, written in Python and licensed MIT. To get started: install the starter package.

## 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.

1. Install the starter package

   The llama-index package includes core LlamaIndex plus a selection of integrations, which is the quickest way to start.

```bash
pip install llama-index
```

2. Index 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.

```python
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)
```

3. 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.

```bash
pip install llama-index-core
pip install llama-index-llms-openai
pip install llama-index-llms-ollama
pip install llama-index-embeddings-huggingface
```

## 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
