Create an evaluator scenario
Creates an evaluator scenario in your organization.
POST
/
ai
/
tests
/
test_framework
/
v1
/
scenarios
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const EvaluatorScenarioDetail = await client.ai.tests.testFramework.v1.scenarios.create({
name: 'name',
personality: 0,
});
console.log(EvaluatorScenarioDetail.id);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
evaluator_scenario_detail = client.ai.tests.test_framework.v1.scenarios.create(
name="name",
personality=0,
)
print(evaluator_scenario_detail.id)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
scenario, err := client.AI.Tests.TestFramework.V1.Scenarios.New(
context.TODO(),
telnyx.AITestTestFrameworkV1ScenarioNewParams{
Name: "name",
Personality: 1,
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", scenario.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.ai.tests.testFramework.v1.scenarios.ScenarioCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
ScenarioCreateParams params = ScenarioCreateParams.builder()
.name("name")
.personality(0)
.build();
var response = client.ai().tests().testFramework().v1().scenarios().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
evaluator_scenario_detail = telnyx.ai.tests.test_framework.v1.scenarios.create(name: "name", personality: 0)
puts(evaluator_scenario_detail)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$evaluator_scenario_detail = $client->ai->tests->testFramework->v1->scenarios->create(
name: 'name',
personality: 0,
);
var_dump($evaluator_scenario_detail);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx ai:tests:test-framework:v1:scenarios create \
--api-key 'My API Key' \
--name name \
--personality 0curl --request POST \
--url https://api.telnyx.com/v2/ai/tests/test_framework/v1/scenarios \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Refund escalation flow",
"agent": 1259,
"personality": 4643,
"instructions": "Call the support line and demand a refund for a damaged product.",
"expected_outcome_prompt": "The assistant explains the refund policy and offers escalation.",
"metrics": [
266881
],
"tags": [
"support"
],
"first_message": "Hi, I want a refund."
}
'{
"id": 9512,
"name": "Refund escalation flow",
"agent": 1259,
"project": null,
"personality": 4643,
"personality_name": "Interruptive (High)",
"tags": [
"support",
"regression"
],
"tool_ids": [],
"runs": [],
"metrics": [
266881,
266882
],
"metric_names": [
"AI interrupting user",
"Average Pitch (in Hz)"
],
"phone_number": "+13125550188",
"outbound_phone_number_data": null,
"first_message": "Hi, I want a refund.",
"inbound_phone_number": null,
"inbound_phone_number_data": null,
"instructions": "Call the support line and demand a refund for a damaged product.",
"simulation_description": "Simulates an impatient customer demanding a refund.",
"information_fields": null,
"expected_outcome_prompt": "The assistant explains the refund policy and offers escalation.",
"scenario_language": "en",
"scenario_type": "workflow",
"suite_type": "predefined",
"is_predefined": false,
"test_profile": null,
"test_profile_data": null,
"dynamic_variable_values": null,
"folder_path": null,
"max_duration": null
}{
"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.
Body
application/json
Response
Evaluator scenario created.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Was this page helpful?
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const EvaluatorScenarioDetail = await client.ai.tests.testFramework.v1.scenarios.create({
name: 'name',
personality: 0,
});
console.log(EvaluatorScenarioDetail.id);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
evaluator_scenario_detail = client.ai.tests.test_framework.v1.scenarios.create(
name="name",
personality=0,
)
print(evaluator_scenario_detail.id)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
scenario, err := client.AI.Tests.TestFramework.V1.Scenarios.New(
context.TODO(),
telnyx.AITestTestFrameworkV1ScenarioNewParams{
Name: "name",
Personality: 1,
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", scenario.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.ai.tests.testFramework.v1.scenarios.ScenarioCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
ScenarioCreateParams params = ScenarioCreateParams.builder()
.name("name")
.personality(0)
.build();
var response = client.ai().tests().testFramework().v1().scenarios().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
evaluator_scenario_detail = telnyx.ai.tests.test_framework.v1.scenarios.create(name: "name", personality: 0)
puts(evaluator_scenario_detail)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$evaluator_scenario_detail = $client->ai->tests->testFramework->v1->scenarios->create(
name: 'name',
personality: 0,
);
var_dump($evaluator_scenario_detail);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx ai:tests:test-framework:v1:scenarios create \
--api-key 'My API Key' \
--name name \
--personality 0curl --request POST \
--url https://api.telnyx.com/v2/ai/tests/test_framework/v1/scenarios \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Refund escalation flow",
"agent": 1259,
"personality": 4643,
"instructions": "Call the support line and demand a refund for a damaged product.",
"expected_outcome_prompt": "The assistant explains the refund policy and offers escalation.",
"metrics": [
266881
],
"tags": [
"support"
],
"first_message": "Hi, I want a refund."
}
'{
"id": 9512,
"name": "Refund escalation flow",
"agent": 1259,
"project": null,
"personality": 4643,
"personality_name": "Interruptive (High)",
"tags": [
"support",
"regression"
],
"tool_ids": [],
"runs": [],
"metrics": [
266881,
266882
],
"metric_names": [
"AI interrupting user",
"Average Pitch (in Hz)"
],
"phone_number": "+13125550188",
"outbound_phone_number_data": null,
"first_message": "Hi, I want a refund.",
"inbound_phone_number": null,
"inbound_phone_number_data": null,
"instructions": "Call the support line and demand a refund for a damaged product.",
"simulation_description": "Simulates an impatient customer demanding a refund.",
"information_fields": null,
"expected_outcome_prompt": "The assistant explains the refund policy and offers escalation.",
"scenario_language": "en",
"scenario_type": "workflow",
"suite_type": "predefined",
"is_predefined": false,
"test_profile": null,
"test_profile_data": null,
"dynamic_variable_values": null,
"folder_path": null,
"max_duration": null
}{
"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."
}
]
}