Custom Properties and User Segmentation
You'll learn how to attach custom metadata to your LLM requests in Arize and Helicone, enabling powerful filtering and user-level analysis across your production traffic.
Why Custom Properties Matter
Imagine running a customer support chatbot serving thousands of users. Without segmentation, you see aggregated metrics—but you can't answer critical questions like "Are premium users getting better responses?" or "Which department generates the most errors?" Custom properties solve this by tagging each request with context.
Adding Metadata in Arize
In Arize, you can attach custom tags when logging traces. These become filterable dimensions in your dashboard:
# Assuming Arize SDK already set up (from lesson 1274)
from arize.pandas.logger import Client
arize_client.log(
model_id="support-bot",
model_version="v2",
prediction_id="req_12345",
prediction_label=response,
actual_label=None,
tags={
"user_id": "user_789",
"user_tier": "premium",
"department": "sales",
"region": "us-west"
}
)
Adding Metadata in Helicone
Helicone accepts custom properties via request headers:
import openai
openai.api_base = "https://oai.hconeai.com/v1"
response = openai.ChatCompletion.create(
model="gpt-4",
messages=[...],
headers={
"Helicone-Property-UserId": "user_789",
"Helicone-Property-UserTier": "premium",
"Helicone-Property-Department": "sales"
}
)
Now you can filter analytics by any property, compare cohorts, and identify which user segments experience issues or drive costs.
Key Takeaway: Custom properties transform generic logs into segmented insights, letting you filter by user ID, subscription tier, feature flags, or any business dimension—essential for debugging user-specific issues and optimizing different customer segments independently.