Registry / llm-agents / llama-index

llama-index

JSON →
library0.14.24pypypi✓ verified 25d ago

LlamaIndex is a data framework for LLM applications, providing tools to ingest, structure, and access private or domain-specific data with large language models. It facilitates building RAG (Retrieval Augmented Generation) applications, agents, and more. The current version is 0.14.20, with a rapid release cadence that often includes new integrations and improvements across its modular ecosystem.

pip install llama-index
INSTALL
IMPORT
SIG · LLAMA-INDEX
L
llama-index
llm-agentspythonv0.14.24
Install
21.8s avg
Import
5126ms
Disk
424MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.14.24 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 4.247s · 375.7MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 21.8s · import 3.954s · 439MB
424MB installed
● package 424MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

VectorStoreIndex
from llama_index.core import VectorStoreIndex
SimpleDirectoryReader
from llama_index.core import SimpleDirectoryReader
Settings
from llama_index.core import Settings
from llama_index.core import ServiceContext
`ServiceContext` was deprecated in LlamaIndex 0.10.0 and replaced by the global `Settings` object for configuring LLM, embedding model, and other core components.
OpenAI
from llama_index.llms.openai import OpenAI
from llama_index.llms import OpenAI
As of LlamaIndex 0.10.0, LLM and Embedding models are imported from their specific integration packages (e.g., `llama_index.llms.openai`).
OpenAIEmbedding
from llama_index.embeddings.openai import OpenAIEmbedding
from llama_index.embeddings import OpenAIEmbedding
As of LlamaIndex 0.10.0, LLM and Embedding models are imported from their specific integration packages (e.g., `llama_index.embeddings.openai`).

This quickstart demonstrates how to load a document, create a vector index, and query it using the default OpenAI LLM and embedding models. It highlights the use of the `Settings` object for configuration, which replaced `ServiceContext` in LlamaIndex 0.10.0+.

import os from llama_index.core import VectorStoreIndex, SimpleDirectoryReader, Settings from llama_index.llms.openai import OpenAI from llama_index.embeddings.openai import OpenAIEmbedding # Ensure you have OPENAI_API_KEY set in your environment variables # For quick testing, a dummy key is used, but a real key is needed for actual API calls. os.environ["OPENAI_API_KEY"] = os.environ.get("OPENAI_API_KEY", "sk-DUMMY") # Create a dummy data directory and file for the example if not os.path.exists("data"): os.makedirs("data") with open("data/sample_doc.txt", "w") as f: f.write("LlamaIndex is a data framework for building LLM applications.") f.write("It helps connect custom data sources to large language models.") try: # Configure the global Settings object (replaces ServiceContext) Settings.llm = OpenAI(model="gpt-3.5-turbo") Settings.embed_model = OpenAIEmbedding(model="text-embedding-ada-002") Settings.chunk_size = 1024 # 1. Load documents from a directory documents = SimpleDirectoryReader("data").load_data() # 2. Create an index from the documents index = VectorStoreIndex.from_documents(documents) # 3. Create a query engine and query the index query_engine = index.as_query_engine() response = query_engine.query("What is LlamaIndex?") print(f"Query: What is LlamaIndex?") print(f"Response: {response.response}") except Exception as e: print(f"An error occurred: {e}") print("Please ensure you have `OPENAI_API_KEY` set and `llama-index-llms-openai` and `llama-index-embeddings-openai` installed.") finally: # Clean up dummy file and directory if os.path.exists("data/sample_doc.txt"): os.remove("data/sample_doc.txt") if os.path.exists("data"): os.rmdir("data")
Debug
Known issues
breakingLlamaIndex underwent a major architectural refactor in version 0.10.0. The `ServiceContext` class was deprecated and replaced by the global `Settings` object for configuring LLMs, embedding models, and other components. Many core classes moved or were renamed.
fix
Migrate your code to use `llama_index.core.Settings` for configuration. For example, instead of `ServiceContext.from_defaults(llm=..., embed_model=...)`, use `Settings.llm = ...` and `Settings.embed_model = ...`. Refer to the official migration guide for 0.10.0.
affects: >=0.10.0
breakingThe library transitioned to a modular package structure in 0.10.0. While `llama-index` is a metapackage, specific LLM, embedding, vector store, and other integrations are now separate packages (e.g., `llama-index-llms-openai`, `llama-index-embeddings-openai`).
fix
Explicitly install the required integration packages using `pip install` (e.g., `pip install llama-index-llms-openai`). Imports also changed to reflect this modularity (e.g., `from llama_index.llms.openai import OpenAI`).
affects: >=0.10.0
breakingSupport for Python 3.9 was deprecated and removed. The library, starting from at least 0.14.16, utilizes Python 3.10+ type union syntax (e.g., `Type | None`) which causes `TypeError` on Python 3.9 and older versions.
fix
Upgrade your Python environment to Python 3.10 or higher. The library officially requires `>=3.10` and `<4.0`.
affects: >=0.14.16
gotchaLlamaIndex often requires API keys or credentials for external services (e.g., OpenAI, Anthropic, various vector databases). It does not manage these directly.
fix
Ensure relevant API keys (e.g., `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`) are set as environment variables or passed directly to the client constructors where applicable.
affects: *
gotchaDue to rapid development and frequent releases, minor versions can sometimes introduce breaking changes or significant refactors without a new major version number. Always check release notes for your specific version.
fix
Pin your `llama-index` dependencies to specific versions, or thoroughly test your application when updating. Review the GitHub release notes before upgrading.
affects: *
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'llama_index.readers.base'
LlamaIndex underwent a major refactoring in version 0.10.0, moving many core modules and classes into a `llama_index.core` namespace or dedicated sub-packages, causing older import paths to break.
fix
Update your import statements to use `llama_index.core` for core components or install/import from the specific namespaced package (e.g., `llama-index-readers-file`, `llama-index-llms-openai`). For `readers`, you might need `from llama_index.readers.file import SimpleDirectoryReader` or `from llama_index.core.readers import SimpleDirectoryReader` depending on the specific reader and installation.
ImportError: cannot import name 'Document' from 'llama_index' (unknown location)
Following a major refactor in LlamaIndex (post 0.10.0), many core classes like `Document`, `VectorStoreIndex`, and `SimpleDirectoryReader` were moved into the `llama_index.core` module.
fix
Change the import statement to `from llama_index.core import Document` (or `VectorStoreIndex`, `SimpleDirectoryReader`, etc.)
ValueError: Could not load OpenAI model. If you intended to use OpenAI, please check your OPENAI_API_KEY.
LlamaIndex defaults to using OpenAI models and expects the `OPENAI_API_KEY` environment variable to be set, even if you intend to use a different LLM or embedding model, unless explicitly configured otherwise.
fix
Set the `OPENAI_API_KEY` environment variable, or explicitly configure `Settings.llm` and `Settings.embed_model` to use a non-OpenAI provider before any LlamaIndex operations, for example: `os.environ["OPENAI_API_KEY"] = "sk-..."` or `Settings.llm = CustomLLM()` and `Settings.embed_model = CustomEmbedding()`.
Cannot find LLM, please set `Settings.llm = ...` on the top of your code.
The LlamaIndex framework requires an LLM (Large Language Model) to be configured globally via the `Settings` object before performing operations that depend on an LLM, such as generating responses or building indexes.
fix
Set the global LLM in the `Settings` object, for example: `from llama_index.llms.openai import OpenAI
from llama_index.core import Settings
Settings.llm = OpenAI(model='gpt-3.5-turbo')`.
Upgrade
Version history
0.14.24latest on PyPI · released Aug 19, 2026
Audit
Dependencies
openairequiredCommonly used LLM provider. Must be installed separately (e.g., via `llama-index-llms-openai`).
pydanticrequiredUsed heavily for data validation and configuration. The minimum required version might increase with future LlamaIndex updates.
Agent activity
48 hits · last 30 days
node
46
OpenAI (training)
1
Resources
llama-index — pip install llama-index · libregistry