LlamaIndex Framework, an open-source framework
LlamaIndex Framework is an open-source framework to build agentic applications.
What it is · Main features · Getting started
What it is
LlamaIndex Framework, by LlamaIndex (the company behind LlamaParse), is an open-source framework to build agentic applications. The README describes LlamaIndex as a "data framework" to help build LLM apps.
Core facts
Read by a script from the official API, not rewritten by a model.
- Repository
- https://github.com/run-llama/llama_index
- License
- MIT
- Languages
- Python
- Maintainer
- run-llama
- Homepage
- https://developers.llamaindex.ai
- Verified
Main features
LlamaIndex offers data connectors to ingest existing data sources and data formats, such as APIs, PDFs, docs and SQL.
LlamaIndex provides ways to structure data (indices, graphs) so that the data can be used with LLMs.
LlamaIndex provides a retrieval/query interface over data. Input an LLM prompt and get back retrieved context and knowledge-augmented output.
Its lower-level APIs allow advanced users to customize and extend modules, including data connectors, indices, retrievers, query engines and reranking modules.
LlamaParse is its own platform, focused on document agents and agentic OCR.
LlamaParse includes Parse (parsing), LlamaAgents (deployed document agents), Extract (structured extraction) and Index (ingest and RAG).
LlamaParse can be used with the LlamaIndex framework or standalone.
Parse provides agentic OCR and document parsing for 130+ formats.
Split splits large documents into subcategories.
Agents builds end-to-end document agents with Workflows and Agent Builder.
Getting started
The Starter option is a Python package that includes core LlamaIndex as well as a selection of integrations.
The Customized option installs core LlamaIndex and adds chosen LlamaIndex integration packages from the integrations page.
There are over 300 LlamaIndex integrations.
Import statements that include core imply that the core package is being used.
A simple vector store index can be built using OpenAI.
A simple vector store index can also be built using non-OpenAI LLMs, for example LLMs hosted through Ollama.
By default, data is stored in-memory.
Data can be persisted to disk.
By default, llama-index-core includes a static folder that contains the nltk and tiktoken cache included with the package installation.
To verify that these files are safe and valid, the project uses the github attest-build-provenance action.
# custom selection of integrations to work with core
pip install llama-index-core
pip install llama-index-llms-openai
pip install llama-index-llms-ollama
pip install llama-index-embeddings-huggingfaceimport os
os.environ["OPENAI_API_KEY"] = "YOUR_OPENAI_API_KEY"
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader
documents = SimpleDirectoryReader("YOUR_DATA_DIRECTORY").load_data()
index = VectorStoreIndex.from_documents(documents)from llama_index.core import Settings, VectorStoreIndex, SimpleDirectoryReader
from llama_index.embeddings.huggingface import HuggingFaceEmbedding
from llama_index.llms.ollama import Ollama
from transformers import AutoTokenizer
# set the LLM
Settings.llm = Ollama(
model="llama-3.1:latest",
request_timeout=360.0,
)
# set tokenizer to match LLM
Settings.tokenizer = AutoTokenizer.from_pretrained(
"meta-llama/Llama-3.1-8B-Instruct"
)
# set the embed model
Settings.embed_model = HuggingFaceEmbedding(
model_name="BAAI/bge-small-en-v1.5"
)
documents = SimpleDirectoryReader("YOUR_DATA_DIRECTORY").load_data()
index = VectorStoreIndex.from_documents(
documents,
)query_engine = index.as_query_engine()
query_engine.query("YOUR_QUESTION")index.storage_context.persist()from llama_index.core import StorageContext, load_index_from_storage
# rebuild storage context
storage_context = StorageContext.from_defaults(persist_dir="./storage")
# load index
index = load_index_from_storage(storage_context)Who it is for
The README is not updated as frequently as the documentation. The project states that its primary focus has shifted towards LlamaParse, liteparse and benchmarking efforts, while the OSS framework remains available as an open toolkit.
Sources
This page is written from the official sources below. Open them to check the original text.
- GitHub READMEhttps://github.com/run-llama/llama_indexFetched
Verified ·
This page is written by AI from the official sources above and checked automatically. This site has not tested it. Found a mistake? Tell us.