from functools import lru_cache from getpass import getpass import llama_index.core import os from gaia_solving_agent import PHOENIX_API_KEY # Phoenix can display in real time the traces automatically # collected from your LlamaIndex application. # Run all of your LlamaIndex applications as usual and traces # will be collected and displayed in Phoenix. # setup Arize Phoenix for logging/observability @lru_cache def set_telemetry(api_key=PHOENIX_API_KEY) -> None: if api_key is None or "x" in api_key: api_key = getpass("🔑 Enter your Phoenix API key: ") os.environ["OTEL_EXPORTER_OTLP_HEADERS"] = f"api_key={api_key}" llama_index.core.set_global_handler( "arize_phoenix", endpoint="https://llamatrace.com/v1/traces", )