Update a test metric
Updates the specified metric.
curl --request PATCH \
--url https://api.telnyx.com/v2/ai/tests/test_framework/v1/metrics/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"name": "Escalates on refund denial",
"prompt": "Score the assistant's escalation behaviour between 0.0 and 1.0, considering tone.",
"audio_enabled": true
}
EOFimport requests
url = "https://api.telnyx.com/v2/ai/tests/test_framework/v1/metrics/{id}"
payload = {
"name": "Escalates on refund denial",
"prompt": "Score the assistant's escalation behaviour between 0.0 and 1.0, considering tone.",
"audio_enabled": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Escalates on refund denial',
prompt: 'Score the assistant\'s escalation behaviour between 0.0 and 1.0, considering tone.',
audio_enabled: true
})
};
fetch('https://api.telnyx.com/v2/ai/tests/test_framework/v1/metrics/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.telnyx.com/v2/ai/tests/test_framework/v1/metrics/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Escalates on refund denial',
'prompt' => 'Score the assistant\'s escalation behaviour between 0.0 and 1.0, considering tone.',
'audio_enabled' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.telnyx.com/v2/ai/tests/test_framework/v1/metrics/{id}"
payload := strings.NewReader("{\n \"name\": \"Escalates on refund denial\",\n \"prompt\": \"Score the assistant's escalation behaviour between 0.0 and 1.0, considering tone.\",\n \"audio_enabled\": true\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.telnyx.com/v2/ai/tests/test_framework/v1/metrics/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Escalates on refund denial\",\n \"prompt\": \"Score the assistant's escalation behaviour between 0.0 and 1.0, considering tone.\",\n \"audio_enabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.telnyx.com/v2/ai/tests/test_framework/v1/metrics/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Escalates on refund denial\",\n \"prompt\": \"Score the assistant's escalation behaviour between 0.0 and 1.0, considering tone.\",\n \"audio_enabled\": true\n}"
response = http.request(request)
puts response.read_body{
"id": 266881,
"slug": "ai_interrupting_user",
"project": 16003,
"agent": null,
"agents": [],
"agent_names": [],
"name": "AI interrupting user",
"description": "Tells if the AI (main agent) interrupted user (testing agent) during the interaction.",
"function_name": "get_main_agent_interruption",
"type": "custom_code",
"eval_type": "numeric",
"enum_values": [],
"audio_enabled": false,
"observability_enabled": true,
"simulation_enabled": true,
"sampling_enabled": false,
"sample_rate": null,
"prompt": "",
"display_order": 1,
"evaluation_trigger": "always",
"trigger_type": "llm_judge",
"evaluation_trigger_prompt": "",
"evaluation_trigger_custom_code": "",
"priority_assignment_prompt": "",
"configuration": {},
"overall_score": 0,
"total_score": 0,
"kb_file_ids": [],
"knowledge_base_files": [],
"metric_cost": 0,
"alert_type": "disabled",
"significant_change_alert_status": "disabled",
"significant_change_alert_direction": "",
"window_size": 50,
"std_multiplier": 2,
"ewma_alpha": 0.1,
"add_to_new_agents": true,
"alert_filters": {},
"uses_llm_judge": false,
"user_defined": false
}{
"errors": [
{
"code": "10015",
"title": "Bad Request",
"detail": "The AI Tests service rejected the request."
}
]
}{
"errors": [
{
"code": "10003",
"title": "Unauthorized",
"detail": "The API key is missing or invalid."
}
]
}{
"errors": [
{
"code": "10005",
"title": "Not Found",
"detail": "The requested resource or URL could not be found."
}
]
}{
"errors": [
{
"code": "10018",
"title": "Unprocessable Entity",
"detail": "Validation failed for the request payload."
}
]
}{
"errors": [
{
"code": "10029",
"title": "Too Many Requests",
"detail": "Too many requests; retry later."
}
]
}{
"errors": [
{
"code": "10063",
"title": "Service Unavailable",
"detail": "The test framework service is temporarily unavailable."
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Numeric ID of the metric.
Body
How the metric is evaluated: custom_code or llm_judge.
What the metric scores: numeric, continuous_qualitative, or binary_workflow_adherence.
Judge prompt used by llm_judge metrics.
Response
Updated test metric.
How the metric is evaluated: custom_code or llm_judge.
What the metric scores: numeric, continuous_qualitative, or binary_workflow_adherence.
Stable identifier of a built-in metric.
Test agent IDs the metric is attached to.
Built-in evaluation function used by custom_code metrics.
Allowed values for qualitative enum metrics.
Judge prompt used by llm_judge metrics.
Sliding window size the alert status is computed over.
Standard-deviation multiplier for significant-change alerts.
Smoothing factor for the alert trend.
Whether the metric is attached to newly created test agents by default.
Was this page helpful?
curl --request PATCH \
--url https://api.telnyx.com/v2/ai/tests/test_framework/v1/metrics/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"name": "Escalates on refund denial",
"prompt": "Score the assistant's escalation behaviour between 0.0 and 1.0, considering tone.",
"audio_enabled": true
}
EOFimport requests
url = "https://api.telnyx.com/v2/ai/tests/test_framework/v1/metrics/{id}"
payload = {
"name": "Escalates on refund denial",
"prompt": "Score the assistant's escalation behaviour between 0.0 and 1.0, considering tone.",
"audio_enabled": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Escalates on refund denial',
prompt: 'Score the assistant\'s escalation behaviour between 0.0 and 1.0, considering tone.',
audio_enabled: true
})
};
fetch('https://api.telnyx.com/v2/ai/tests/test_framework/v1/metrics/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.telnyx.com/v2/ai/tests/test_framework/v1/metrics/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Escalates on refund denial',
'prompt' => 'Score the assistant\'s escalation behaviour between 0.0 and 1.0, considering tone.',
'audio_enabled' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.telnyx.com/v2/ai/tests/test_framework/v1/metrics/{id}"
payload := strings.NewReader("{\n \"name\": \"Escalates on refund denial\",\n \"prompt\": \"Score the assistant's escalation behaviour between 0.0 and 1.0, considering tone.\",\n \"audio_enabled\": true\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.telnyx.com/v2/ai/tests/test_framework/v1/metrics/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Escalates on refund denial\",\n \"prompt\": \"Score the assistant's escalation behaviour between 0.0 and 1.0, considering tone.\",\n \"audio_enabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.telnyx.com/v2/ai/tests/test_framework/v1/metrics/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Escalates on refund denial\",\n \"prompt\": \"Score the assistant's escalation behaviour between 0.0 and 1.0, considering tone.\",\n \"audio_enabled\": true\n}"
response = http.request(request)
puts response.read_body{
"id": 266881,
"slug": "ai_interrupting_user",
"project": 16003,
"agent": null,
"agents": [],
"agent_names": [],
"name": "AI interrupting user",
"description": "Tells if the AI (main agent) interrupted user (testing agent) during the interaction.",
"function_name": "get_main_agent_interruption",
"type": "custom_code",
"eval_type": "numeric",
"enum_values": [],
"audio_enabled": false,
"observability_enabled": true,
"simulation_enabled": true,
"sampling_enabled": false,
"sample_rate": null,
"prompt": "",
"display_order": 1,
"evaluation_trigger": "always",
"trigger_type": "llm_judge",
"evaluation_trigger_prompt": "",
"evaluation_trigger_custom_code": "",
"priority_assignment_prompt": "",
"configuration": {},
"overall_score": 0,
"total_score": 0,
"kb_file_ids": [],
"knowledge_base_files": [],
"metric_cost": 0,
"alert_type": "disabled",
"significant_change_alert_status": "disabled",
"significant_change_alert_direction": "",
"window_size": 50,
"std_multiplier": 2,
"ewma_alpha": 0.1,
"add_to_new_agents": true,
"alert_filters": {},
"uses_llm_judge": false,
"user_defined": false
}{
"errors": [
{
"code": "10015",
"title": "Bad Request",
"detail": "The AI Tests service rejected the request."
}
]
}{
"errors": [
{
"code": "10003",
"title": "Unauthorized",
"detail": "The API key is missing or invalid."
}
]
}{
"errors": [
{
"code": "10005",
"title": "Not Found",
"detail": "The requested resource or URL could not be found."
}
]
}{
"errors": [
{
"code": "10018",
"title": "Unprocessable Entity",
"detail": "Validation failed for the request payload."
}
]
}{
"errors": [
{
"code": "10029",
"title": "Too Many Requests",
"detail": "Too many requests; retry later."
}
]
}{
"errors": [
{
"code": "10063",
"title": "Service Unavailable",
"detail": "The test framework service is temporarily unavailable."
}
]
}