RagaAI Catalyst Tracing Guide for Azure OpenAI Users
Learn how to set up tracing for Azure OpenAI models in RagaAI. Ensure detailed monitoring and evaluation.
Prerequisites
Quick Setup Guide
1. Install RagaAI Catalyst
pip install ragaai-catalyst2. Set Up Tracing with Azure OpenAI
from ragaai_catalyst import RagaAICatalyst, Tracer, init_tracing
from llama_index.llms.azure_openai import AzureOpenAI
# Initialize RagaAI Catalyst
catalyst = RagaAICatalyst(
access_key="your_access_key",
secret_key="your_secret_key",
)
# Create a tracer
tracer = Tracer(
project_name="YourProjectName", # Create this project in the RagaAI UI first
dataset_name="YourDatasetName",
tracer_type="agentic_tracing", # Use appropriate tracer type ("agentic/llamaindex" for llamaindex examples)
)
# Initialize tracing
init_tracing(catalyst=catalyst, tracer=tracer)
# Create your Azure OpenAI instance
azure_llm = AzureOpenAI(
azure_endpoint="https://your-resource-name.openai.azure.com/",
model="your-deployment-name", # e.g., "gpt-4o-mini"
api_key="your-azure-openai-api-key",
api_version="2024-05-01-preview", # Use appropriate API version
engine="your-deployment-name" # Same as your deployment name
)
# Optional: Set model cost information for billing analysis
tracer.set_model_cost({
"model_name": "gpt-4o-mini",
"input_cost_per_million_token": 10_000_000,
"output_cost_per_million_token": 20_000_000
})Tracing Methods
Using Decorators: Use decorators to trace specific functions in your application.
Supported Trace Attributes
Accessing Trace Results
Last updated
Was this helpful?

