OpenInference LlamaIndex Instrumentation
Actively maintained. Last release 10 days ago, commits in 26 of the last 26 weeks. A safe choice.
pip install openinference-instrumentation-llama-indexREADME as published on PyPI with version 4.7.11.
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)