Improve evaluator scenarios
Starts an interactive session that improves selected evaluator scenarios from a natural-language instruction. Returns a progress ID to poll with the improve-scenarios-progress endpoint.
POST
/
ai
/
tests
/
test_framework
/
v1
/
scenarios
/
scenario-agent
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.ai.tests.testFramework.v1.scenarios.scenarioAgent({
scenarios: 'scenarios',
user_message: 'user_message',
});
console.log(response.progress_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
)
response = client.ai.tests.test_framework.v1.scenarios.scenario_agent(
scenarios="scenarios",
user_message="user_message",
)
print(response.progress_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"),
)
response, err := client.AI.Tests.TestFramework.V1.Scenarios.ScenarioAgent(
context.TODO(),
telnyx.AITestTestFrameworkV1ScenarioScenarioAgentParams{
Scenarios: "scenarios",
UserMessage: "user_message",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.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.ScenarioScenarioAgentParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
ScenarioScenarioAgentParams params = ScenarioScenarioAgentParams.builder()
.scenarios("scenarios")
.userMessage("user_message")
.build();
var response = client.ai().tests().testFramework().v1().scenarios().scenarioAgent(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.ai.tests.test_framework.v1.scenarios.scenario_agent(scenarios: "scenarios", user_message: "user_message")
puts(response)<?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 {
$response = $client->ai->tests->testFramework->v1->scenarios->scenarioAgent(
scenarios: 'scenarios',
user_message: 'user_message',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx ai:tests:test-framework:v1:scenarios scenario-agent \
--api-key 'My API Key' \
--user-message user_message \
--scenarios scenarioscurl --request POST \
--url https://api.telnyx.com/v2/ai/tests/test_framework/v1/scenarios/scenario-agent \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"user_message": "Make the callers ask about damaged packaging too.",
"scenarios": "all",
"agent_id": 1259,
"apply_changes": true
}
'{
"progress_id": "c8f5d2b3-4e5f-6a7b-9c0d-1f2a3b4c5d6e",
"session_id": 417
}{
"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
What the assistant should improve about the selected scenarios.
Scenario IDs to improve, or the literal string 'all'.
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 response = await client.ai.tests.testFramework.v1.scenarios.scenarioAgent({
scenarios: 'scenarios',
user_message: 'user_message',
});
console.log(response.progress_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
)
response = client.ai.tests.test_framework.v1.scenarios.scenario_agent(
scenarios="scenarios",
user_message="user_message",
)
print(response.progress_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"),
)
response, err := client.AI.Tests.TestFramework.V1.Scenarios.ScenarioAgent(
context.TODO(),
telnyx.AITestTestFrameworkV1ScenarioScenarioAgentParams{
Scenarios: "scenarios",
UserMessage: "user_message",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.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.ScenarioScenarioAgentParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
ScenarioScenarioAgentParams params = ScenarioScenarioAgentParams.builder()
.scenarios("scenarios")
.userMessage("user_message")
.build();
var response = client.ai().tests().testFramework().v1().scenarios().scenarioAgent(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.ai.tests.test_framework.v1.scenarios.scenario_agent(scenarios: "scenarios", user_message: "user_message")
puts(response)<?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 {
$response = $client->ai->tests->testFramework->v1->scenarios->scenarioAgent(
scenarios: 'scenarios',
user_message: 'user_message',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx ai:tests:test-framework:v1:scenarios scenario-agent \
--api-key 'My API Key' \
--user-message user_message \
--scenarios scenarioscurl --request POST \
--url https://api.telnyx.com/v2/ai/tests/test_framework/v1/scenarios/scenario-agent \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"user_message": "Make the callers ask about damaged packaging too.",
"scenarios": "all",
"agent_id": 1259,
"apply_changes": true
}
'{
"progress_id": "c8f5d2b3-4e5f-6a7b-9c0d-1f2a3b4c5d6e",
"session_id": 417
}{
"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."
}
]
}