OpenInference LlamaIndex Instrumentation
Python auto-instrumentation library for LlamaIndex.
These traces are fully OpenTelemetry compatible and can be sent to an OpenTelemetry collector for viewing, such as Arize Phoenix or Arize AX.
Installation
pip install openinference-instrumentation-llama-index
Compatibility
| llama-index version | openinference-instrumentation-llama-index version |
|---|---|
| >=0.12.3 | >=4.0 |
| >=0.11.0 | >=3.0 |
| >=0.10.43 | >=2.0, <3.0 |
| >=0.10.0, <0.10.43 | >=1.0, <0.2 |
| >=0.9.14, <0.10.0 | 0.1.3 |
Quickstart
Install packages needed for this demonstration.
python -m pip install --upgrade \
openinference-instrumentation-llama-index \
opentelemetry-sdk \
opentelemetry-exporter-otlp \
"opentelemetry-proto>=1.12.0" \
arize-phoenix
Start the Phoenix app in the background as a collector. By default, it listens on http://localhost:6006. You can visit the app via a browser at the same address.
The Phoenix app does not send data over the internet. It only operates locally on your machine.
python -m phoenix.server.main serve
The following Python code sets up the LlamaIndexInstrumentor to trace llama-index and send the traces to Phoenix at the endpoint shown below.
from openinference.instrumentation.llama_index import LlamaIndexInstrumentor
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk import trace as trace_sdk
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
endpoint = "http://127.0.0.1:6006/v1/traces"
tracer_provider = trace_sdk.TracerProvider()
tracer_provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter(endpoint)))
LlamaIndexInstrumentor().instrument(tracer_provider=tracer_provider)
To demonstrate tracing, we'll use LlamaIndex below to query a document.
First, download a text file.
import tempfile
from urllib.request import urlretrieve
from llama_index.core import SimpleDirectoryReader
url = "https://raw.githubusercontent.com/Arize-ai/phoenix-assets/main/data/paul_graham/paul_graham_essay.txt"
with tempfile.NamedTemporaryFile() as tf:
urlretrieve(url, tf.name)
documents = SimpleDirectoryReader(input_files=[tf.name]).load_data()
Next, we'll query using OpenAI. To do that you need to set up your OpenAI API key in an environment variable.
import os
os.environ["OPENAI_API_KEY"] = "<your openai key>"
Now we can query the indexed documents.
from llama_index.core import VectorStoreIndex
query_engine = VectorStoreIndex.from_documents(documents).as_query_engine()
print(query_engine.query("What did the author do growing up?"))
Visit the Phoenix app at http://localhost:6006 to see the traces.
More Info
Release files for openinference-instrumentation-llama-index 4.5.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| openinference_instrumentation_llama_index-4.5.2.tar.gz | 63.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| openinference_instrumentation_llama_index-4.5.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 93.3 kB
Release files / openinference_instrumentation_llama_index-4.5.2.tar.gz
| Download URL | openinference_instrumentation_llama_index-4.5.2.tar.gz |
|---|---|
| Size | 63.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9d6171e905265ef7e9cb6a048f92f176b8a3e85db7ce5f503940020c6005537c
|
|
BLAKE2b-256 checksum How to use checksums |
47f78f72c3c9e0269511e0455ade6f41c3724a53eafeed2de20dae812814c185
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 10, 2026.
Transparency logRelease files / openinference_instrumentation_llama_index-4.5.2-py3-none-any.whl
| Download URL | openinference_instrumentation_llama_index-4.5.2-py3-none-any.whl |
|---|---|
| Size | 29.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5c578319dcf05a2e3bf5862c5a883faed1369c6277c8b02a69e237c05074528d
|
|
BLAKE2b-256 checksum How to use checksums |
ee015c390e3e13a2be3f12f4f8adf2ed4c39f0813cef0b198a32644e46f66641
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 10, 2026.
Transparency log