Setting Up Arize SDK for LLM Tracing
What You'll Learn
You'll learn how to install and configure the Arize SDK to automatically instrument your LLM calls and send telemetry data to the Arize platform for monitoring and analysis.
Why This Matters
Now that you understand what Arize AI offers for LLM monitoring, you need to actually connect your application to the platform. The Arize SDK acts as a bridge between your code and the observability platform, automatically capturing traces, metrics, and data from your LLM interactions.
Installation and Basic Setup
First, install the Arize SDK:
pip install arize
Next, initialize the client with your API credentials (found in your Arize dashboard):
from arize.pandas.logger import Client
from arize.utils.types import ModelTypes, Environments
arize_client = Client(
api_key="YOUR_API_KEY",
space_key="YOUR_SPACE_KEY"
)
Configuring for LLM Tracing
The SDK needs to know which model and environment you're monitoring:
model_id = "my-gpt-4-chatbot"
model_version = "v1.2"
environment = Environments.PRODUCTION
# The client is now ready to send LLM telemetry
Think of this setup like connecting a fitness tracker to your phone app—once paired, it automatically syncs all your activity data without manual intervention.
Integration Pattern
After setup, the SDK integrates with your LLM calls to automatically capture inputs, outputs, token usage, latency, and custom metadata. This instrumentation happens in the background, letting you focus on application logic while Arize collects the observability data.
Key Takeaway: Installing and configuring the Arize SDK creates a persistent connection to the Arize platform, enabling automatic capture of LLM telemetry with minimal code changes to your existing application.