-p-500.png)
Introduction
Integration
Threshold Management
Report
Setting
Evidently Integration Guide for TRACE
This guide walks you through how to configure Evidently, run evaluation tests, and submit results to the TRACE Metrics API for automated Responsible AI scoring and compliance mapping.
Step 1: Configure Evidently Metrics
Below is an example of configuring and calculating evaluation metrics using Evidently.
from evidently.report import Report
from evidently.metric_preset import DataDriftPreset, TargetDriftPreset
from evidently.metrics import ColumnDriftMetric, ColumnSummaryMetric
import pandas as pd
# Example data
reference_data = pd.read_csv("reference.csv")
current_data = pd.read_csv("current.csv")
# Define Evidently report with selected metrics
report = Report(metrics=[
DataDriftPreset(),
TargetDriftPreset(),
ColumnDriftMetric(column_name="answer_relevancy"),
ColumnSummaryMetric(column_name="hallucination_score")
])
# Run report
report.run(reference_data=reference_data, current_data=current_data)
# Export results
results = report.as_dict()
print(results)
Step 2: Prepare TRACE Payload
Use the following format to create your submission JSON:
{
"metric_metadata": {
"application_name": "chat-application",
"version": "1.0.0",
"provider": "evidently",
"use_case": "transportation"
},
"metric_data": {
"evidently": {
"DataDriftMetric": 0.15,
"TargetDriftMetric": 0.05
}
}
Step 3: Get Your API Key
To submit to TRACE, you need a subscription key.
Read: How to Get and Use Your TRACE API Key
Once you’ve generated it, use it in the header for all API requests.
Step 4: Submit to TRACE API
cURL Example:
curl -X POST https://api.cognitiveview.com/metrics \
-H "Content-Type: application/json" \
-H "Ocp-Apim-Subscription-Key: Bearer YOUR_API_KEY" \
-d @trace_payload.json
Python Example:
import requests
url = "https://api.cognitiveview.com/metrics"
headers = {
"Content-Type": "application/json",
"Ocp-Apim-Subscription-Key": "YOUR_API_KEY"
}
payload = { ... } # Your JSON from above
response = requests.post(url, headers=headers, json=payload)
print("Status Code:", response.status_code)
print("Response:", response.json())
What TRACE Returns
On success, TRACE responds with a JSON containing a report_id, like:
{
"message": "Evaluation in progress.",
"report_id": "gW3eQpV63sRTrQey9uJPNp"
}
This ID is used to retrieve your full evaluation.