LlamaIndex Callbacks Arize Phoenix Integration

raw JSON →
0.7.0 verified Fri May 01 auth: no python

Integration package for connecting LlamaIndex with Arize Phoenix OpenInference tracing. Provides a callback handler that sends trace data to Phoenix for observability and debugging of LLM applications. Current version 0.7.0, requires Python >=3.10 and <3.14. Release cadence is irregular, tied to LlamaIndex ecosystem updates.

pip install llama-index-callbacks-arize-phoenix
error ModuleNotFoundError: No module named 'arize'
cause The `arize-phoenix` package is not installed.
fix
Run pip install arize-phoenix.
error AttributeError: module 'llama_index.callbacks' has no attribute 'arize_phoenix'
cause Using an out-of-date version of the integration (<0.7.0) where the package was named differently, or the package is not installed.
fix
Upgrade to version 0.7.0 with pip install --upgrade llama-index-callbacks-arize-phoenix and use the correct import path.
error TypeError: 'str' object is not callable
cause Trying to use `arixe_phoenix_callback_handler` as a class instead of calling the function.
fix
Use handler = arize_phoenix_callback_handler() (with parentheses).
breaking In version 0.7.0, the main API changed: use `arixe_phoenix_callback_handler()` function instead of instantiating `ArizePhoenixHandler` directly. The old import path `from llama_index.callbacks.arize_phoenix_callback_handler import ArizePhoenixHandler` is removed.
fix Update import to `from llama_index.callbacks.arize_phoenix import arize_phoenix_callback_handler` and call `arize_phoenix_callback_handler()` instead of `ArizePhoenixHandler(...)`.
deprecated Setting `global_handler` via `llama_index.core.global_handler` is deprecated in recent LlamaIndex versions (>=0.10). Use `llama_index.core.settings.Settings.callback_manager.add_handler(handler)` instead.
fix Replace `llama_index.core.global_handler = handler` with `from llama_index.core.settings import Settings; Settings.callback_manager.add_handler(handler)`.
gotcha Forgetting to install `arize-phoenix` separately. The package has a conditional dependency on `arize-phoenix` that is not installed automatically. You must `pip install arize-phoenix`.
fix Run `pip install arize-phoenix` in addition to the integration package.
pip install 'llama-index-callbacks-arize-phoenix>=0.7'

Initialize the Arize Phoenix callback handler, set it as the global LlamaIndex handler, and run a simple query. Requires Phoenix collector running (e.g., `python -m phoenix.server.main serve` or a Phoenix instance).

import os

import llama_index
from llama_index.callbacks.arize_phoenix import arize_phoenix_callback_handler

# Configure Phoenix endpoint (default http://localhost:6006/v1/traces)
os.environ['PHOENIX_COLLECTOR_ENDPOINT'] = os.environ.get('PHOENIX_COLLECTOR_ENDPOINT', 'http://localhost:6006')
os.environ['PHOENIX_OTLP_AUTH_HEADER'] = os.environ.get('PHOENIX_OTLP_AUTH_HEADER', '')

handler = arize_phoenix_callback_handler()
llama_index.core.global_handler = handler

# Now all LlamaIndex operations will be traced
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('What is the capital of France?')
print(response)