cURL
curl --request POST \
--url https://api.tela.com/test-case \
--header 'Content-Type: application/json' \
--data '
{
"variablesRichContent": {},
"promptId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"messages": [
{
"content": "<string>"
}
],
"title": "<string>",
"expectedOutput": "<string>",
"promptApplicationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"variables": {},
"files": [
{
"index": 123,
"name": "<string>",
"mimeType": "<string>",
"vaultUrl": "<string>",
"variableName": "<string>",
"url": "<string>"
}
],
"metadata": {}
}
'import requests
url = "https://api.tela.com/test-case"
payload = {
"variablesRichContent": {},
"promptId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"messages": [{ "content": "<string>" }],
"title": "<string>",
"expectedOutput": "<string>",
"promptApplicationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"variables": {},
"files": [
{
"index": 123,
"name": "<string>",
"mimeType": "<string>",
"vaultUrl": "<string>",
"variableName": "<string>",
"url": "<string>"
}
],
"metadata": {}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
variablesRichContent: {},
promptId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
messages: [{content: '<string>'}],
title: '<string>',
expectedOutput: '<string>',
promptApplicationId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
variables: {},
files: [
{
index: 123,
name: '<string>',
mimeType: '<string>',
vaultUrl: '<string>',
variableName: '<string>',
url: '<string>'
}
],
metadata: {}
})
};
fetch('https://api.tela.com/test-case', 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.tela.com/test-case",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'variablesRichContent' => [
],
'promptId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'messages' => [
[
'content' => '<string>'
]
],
'title' => '<string>',
'expectedOutput' => '<string>',
'promptApplicationId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'variables' => [
],
'files' => [
[
'index' => 123,
'name' => '<string>',
'mimeType' => '<string>',
'vaultUrl' => '<string>',
'variableName' => '<string>',
'url' => '<string>'
]
],
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"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.tela.com/test-case"
payload := strings.NewReader("{\n \"variablesRichContent\": {},\n \"promptId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"title\": \"<string>\",\n \"expectedOutput\": \"<string>\",\n \"promptApplicationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"variables\": {},\n \"files\": [\n {\n \"index\": 123,\n \"name\": \"<string>\",\n \"mimeType\": \"<string>\",\n \"vaultUrl\": \"<string>\",\n \"variableName\": \"<string>\",\n \"url\": \"<string>\"\n }\n ],\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
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.post("https://api.tela.com/test-case")
.header("Content-Type", "application/json")
.body("{\n \"variablesRichContent\": {},\n \"promptId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"title\": \"<string>\",\n \"expectedOutput\": \"<string>\",\n \"promptApplicationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"variables\": {},\n \"files\": [\n {\n \"index\": 123,\n \"name\": \"<string>\",\n \"mimeType\": \"<string>\",\n \"vaultUrl\": \"<string>\",\n \"variableName\": \"<string>\",\n \"url\": \"<string>\"\n }\n ],\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tela.com/test-case")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"variablesRichContent\": {},\n \"promptId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"title\": \"<string>\",\n \"expectedOutput\": \"<string>\",\n \"promptApplicationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"variables\": {},\n \"files\": [\n {\n \"index\": 123,\n \"name\": \"<string>\",\n \"mimeType\": \"<string>\",\n \"vaultUrl\": \"<string>\",\n \"variableName\": \"<string>\",\n \"url\": \"<string>\"\n }\n ],\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_bodyTest Case
Create Test Cases
Create one or more test cases
POST
/
test-case
cURL
curl --request POST \
--url https://api.tela.com/test-case \
--header 'Content-Type: application/json' \
--data '
{
"variablesRichContent": {},
"promptId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"messages": [
{
"content": "<string>"
}
],
"title": "<string>",
"expectedOutput": "<string>",
"promptApplicationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"variables": {},
"files": [
{
"index": 123,
"name": "<string>",
"mimeType": "<string>",
"vaultUrl": "<string>",
"variableName": "<string>",
"url": "<string>"
}
],
"metadata": {}
}
'import requests
url = "https://api.tela.com/test-case"
payload = {
"variablesRichContent": {},
"promptId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"messages": [{ "content": "<string>" }],
"title": "<string>",
"expectedOutput": "<string>",
"promptApplicationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"variables": {},
"files": [
{
"index": 123,
"name": "<string>",
"mimeType": "<string>",
"vaultUrl": "<string>",
"variableName": "<string>",
"url": "<string>"
}
],
"metadata": {}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
variablesRichContent: {},
promptId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
messages: [{content: '<string>'}],
title: '<string>',
expectedOutput: '<string>',
promptApplicationId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
variables: {},
files: [
{
index: 123,
name: '<string>',
mimeType: '<string>',
vaultUrl: '<string>',
variableName: '<string>',
url: '<string>'
}
],
metadata: {}
})
};
fetch('https://api.tela.com/test-case', 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.tela.com/test-case",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'variablesRichContent' => [
],
'promptId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'messages' => [
[
'content' => '<string>'
]
],
'title' => '<string>',
'expectedOutput' => '<string>',
'promptApplicationId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'variables' => [
],
'files' => [
[
'index' => 123,
'name' => '<string>',
'mimeType' => '<string>',
'vaultUrl' => '<string>',
'variableName' => '<string>',
'url' => '<string>'
]
],
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"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.tela.com/test-case"
payload := strings.NewReader("{\n \"variablesRichContent\": {},\n \"promptId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"title\": \"<string>\",\n \"expectedOutput\": \"<string>\",\n \"promptApplicationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"variables\": {},\n \"files\": [\n {\n \"index\": 123,\n \"name\": \"<string>\",\n \"mimeType\": \"<string>\",\n \"vaultUrl\": \"<string>\",\n \"variableName\": \"<string>\",\n \"url\": \"<string>\"\n }\n ],\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
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.post("https://api.tela.com/test-case")
.header("Content-Type", "application/json")
.body("{\n \"variablesRichContent\": {},\n \"promptId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"title\": \"<string>\",\n \"expectedOutput\": \"<string>\",\n \"promptApplicationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"variables\": {},\n \"files\": [\n {\n \"index\": 123,\n \"name\": \"<string>\",\n \"mimeType\": \"<string>\",\n \"vaultUrl\": \"<string>\",\n \"variableName\": \"<string>\",\n \"url\": \"<string>\"\n }\n ],\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tela.com/test-case")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"variablesRichContent\": {},\n \"promptId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"title\": \"<string>\",\n \"expectedOutput\": \"<string>\",\n \"promptApplicationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"variables\": {},\n \"files\": [\n {\n \"index\": 123,\n \"name\": \"<string>\",\n \"mimeType\": \"<string>\",\n \"vaultUrl\": \"<string>\",\n \"variableName\": \"<string>\",\n \"url\": \"<string>\"\n }\n ],\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_bodyCreate one or more test cases for a prompt. Test cases can be used to validate prompt performance and ensure consistent output across different scenarios.
Create a Test Case
const API_KEY = process.env.TELA_API_KEY;
// Single test case
const testCase = {
title: "Customer Support Query Test",
promptId: "prompt_uuid",
messages: [
{
role: "system",
content: "You are a helpful customer support assistant."
},
{
role: "user",
content: "My order hasn't arrived yet."
}
],
variables: {
"customer_name": "John Doe",
"order_id": "ORD-12345"
},
variablesRichContent: {},
expectedOutput: "I'll help you track down your order, John. Let me look up order ORD-12345 for you.",
metadata: {
source: "craft"
}
};
const response = await fetch('https://api.tela.ai/test-case', {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(testCase)
});
const data = await response.json();
console.log(data);
import requests
API_KEY = os.getenv('TELA_API_KEY')
# Single test case
test_case = {
"title": "Customer Support Query Test",
"promptId": "prompt_uuid",
"messages": [
{
"role": "system",
"content": "You are a helpful customer support assistant."
},
{
"role": "user",
"content": "My order hasn't arrived yet."
}
],
"variables": {
"customer_name": "John Doe",
"order_id": "ORD-12345"
},
"variablesRichContent": {},
"expectedOutput": "I'll help you track down your order, John. Let me look up order ORD-12345 for you.",
"metadata": {
"source": "craft"
}
}
response = requests.post(
'https://api.tela.ai/test-case',
headers={
'Authorization': f'Bearer {API_KEY}',
'Content-Type': 'application/json'
},
json=test_case
)
print(response.json())
const API_KEY = process.env.TELA_API_KEY;
// Single test case
const testCase = {
title: "Customer Support Query Test",
promptId: "prompt_uuid",
messages: [
{
role: "system",
content: "You are a helpful customer support assistant."
},
{
role: "user",
content: "My order hasn't arrived yet."
}
],
variables: {
"customer_name": "John Doe",
"order_id": "ORD-12345"
},
variablesRichContent: {},
expectedOutput: "I'll help you track down your order, John. Let me look up order ORD-12345 for you.",
metadata: {
source: "craft"
}
};
fetch('https://api.tela.ai/test-case', {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(testCase)
})
.then(response => response.json())
.then(data => {
console.log(data);
})
.catch(error => {
console.error('Error:', error);
});
Create Multiple Test Cases
const API_KEY = process.env.TELA_API_KEY;
// Multiple test cases
const testCases = [
{
title: "Customer Support Query - Order Status",
promptId: "prompt_uuid",
messages: [
{
role: "system",
content: "You are a helpful customer support assistant."
},
{
role: "user",
content: "My order hasn't arrived yet."
}
],
variables: {
"customer_name": "John Doe",
"order_id": "ORD-12345"
},
variablesRichContent: {},
expectedOutput: "I'll help you track down your order, John. Let me look up order ORD-12345 for you.",
metadata: {
source: "craft"
}
},
{
title: "Customer Support Query - Return Policy",
promptId: "prompt_uuid",
messages: [
{
role: "system",
content: "You are a helpful customer support assistant."
},
{
role: "user",
content: "What's your return policy?"
}
],
variables: {
"customer_name": "Jane Smith"
},
variablesRichContent: {},
expectedOutput: "Our return policy allows returns within 30 days of purchase with a receipt.",
metadata: {
source: "craft"
}
}
];
const response = await fetch('https://api.tela.ai/test-case', {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(testCases)
});
const data = await response.json();
console.log(data);
import requests
API_KEY = os.getenv('TELA_API_KEY')
# Multiple test cases
test_cases = [
{
"title": "Customer Support Query - Order Status",
"promptId": "prompt_uuid",
"messages": [
{
"role": "system",
"content": "You are a helpful customer support assistant."
},
{
"role": "user",
"content": "My order hasn't arrived yet."
}
],
"variables": {
"customer_name": "John Doe",
"order_id": "ORD-12345"
},
"variablesRichContent": {},
"expectedOutput": "I'll help you track down your order, John. Let me look up order ORD-12345 for you.",
"metadata": {
"source": "craft"
}
},
{
"title": "Customer Support Query - Return Policy",
"promptId": "prompt_uuid",
"messages": [
{
"role": "system",
"content": "You are a helpful customer support assistant."
},
{
"role": "user",
"content": "What's your return policy?"
}
],
"variables": {
"customer_name": "Jane Smith"
},
"variablesRichContent": {},
"expectedOutput": "Our return policy allows returns within 30 days of purchase with a receipt.",
"metadata": {
"source": "craft"
}
}
]
response = requests.post(
'https://api.tela.ai/test-case',
headers={
'Authorization': f'Bearer {API_KEY}',
'Content-Type': 'application/json'
},
json=test_cases
)
print(response.json())
const API_KEY = process.env.TELA_API_KEY;
// Multiple test cases
const testCases = [
{
title: "Customer Support Query - Order Status",
promptId: "prompt_uuid",
messages: [
{
role: "system",
content: "You are a helpful customer support assistant."
},
{
role: "user",
content: "My order hasn't arrived yet."
}
],
variables: {
"customer_name": "John Doe",
"order_id": "ORD-12345"
},
variablesRichContent: {},
expectedOutput: "I'll help you track down your order, John. Let me look up order ORD-12345 for you.",
metadata: {
source: "craft"
}
},
{
title: "Customer Support Query - Return Policy",
promptId: "prompt_uuid",
messages: [
{
role: "system",
content: "You are a helpful customer support assistant."
},
{
role: "user",
content: "What's your return policy?"
}
],
variables: {
"customer_name": "Jane Smith"
},
variablesRichContent: {},
expectedOutput: "Our return policy allows returns within 30 days of purchase with a receipt.",
metadata: {
source: "craft"
}
}
];
fetch('https://api.tela.ai/test-case', {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(testCases)
})
.then(response => response.json())
.then(data => {
console.log(data);
})
.catch(error => {
console.error('Error:', error);
});
Request Body
The request body can be either a single test case object or an array of test case objects.Test Case Object
| Field | Type | Required | Description |
|---|---|---|---|
promptId | string | Yes | UUID of the prompt to create test cases for |
title | string | No | Title of the test case |
messages | array | Yes | Array of message objects with role and content |
variables | object | No | Key-value pairs of variables used in the test case |
variablesRichContent | object | Yes | Key-value pairs of rich content variables |
files | array | No | Array of file objects to attach to the test case |
expectedOutput | string | No | Expected output for evaluation purposes |
promptApplicationId | string | No | UUID of the prompt application if applicable |
metadata | object | No | Metadata about the test case including source |
Message Object
| Field | Type | Required | Description |
|---|---|---|---|
role | string | Yes | Role of the message sender (user, system, assistant, function, developer) |
content | string | Yes | Content of the message |
File Object
| Field | Type | Required | Description |
|---|---|---|---|
index | number | Yes | Index of the file in the array |
name | string | Yes | Name of the file |
mimeType | string | Yes | MIME type of the file |
vaultUrl | string | Yes | URL to the file in the vault |
variableName | string | Yes | Variable name associated with the file |
url | string | Yes | Public URL to the file |
Response
The response will contain the created test case(s) with all fields including the generated IDs and timestamps.Body
application/json
- object
- object[]
Key-value pairs of rich content variables
Show child attributes
Show child attributes
UUID of the prompt to create test cases for
Array of message objects with role and content
Show child attributes
Show child attributes
Title of the test case
Expected output for evaluation purposes
UUID of the prompt application if applicable
Key-value pairs of variables used in the test case
Show child attributes
Show child attributes
Array of file objects to attach to the test case
Show child attributes
Show child attributes
Metadata about the test case
Show child attributes
Show child attributes
Response
200
Test case(s) created successfully
⌘I