cURL
curl --request GET \
--url https://api.tela.com/test-caseimport requests
url = "https://api.tela.com/test-case"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
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 => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.tela.com/test-case"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.tela.com/test-case")
.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::Get.new(url)
response = http.request(request)
puts response.read_body[
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"messages": [
{
"role": "user",
"content": "<string>"
}
],
"variables": {},
"variablesRichContent": {},
"files": [
{
"index": 123,
"name": "<string>",
"mimeType": "<string>",
"vaultUrl": "<string>",
"variableName": "<string>",
"url": "<string>"
}
],
"promptId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"expectedOutput": "<string>",
"answers": {},
"promptApplicationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"deletedAt": "2023-11-07T05:31:56Z",
"metadata": {
"source": "workstation"
},
"generations": [
"<unknown>"
]
}
]Test cases
Retrieve Test Cases
Get test cases for a prompt
GET
/
test-case
cURL
curl --request GET \
--url https://api.tela.com/test-caseimport requests
url = "https://api.tela.com/test-case"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
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 => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.tela.com/test-case"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.tela.com/test-case")
.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::Get.new(url)
response = http.request(request)
puts response.read_body[
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"messages": [
{
"role": "user",
"content": "<string>"
}
],
"variables": {},
"variablesRichContent": {},
"files": [
{
"index": 123,
"name": "<string>",
"mimeType": "<string>",
"vaultUrl": "<string>",
"variableName": "<string>",
"url": "<string>"
}
],
"promptId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"expectedOutput": "<string>",
"answers": {},
"promptApplicationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"deletedAt": "2023-11-07T05:31:56Z",
"metadata": {
"source": "workstation"
},
"generations": [
"<unknown>"
]
}
]Retrieve test cases for a specific prompt. This endpoint returns test cases associated with the given prompt ID, with options to filter by prompt version and include generation data.
Retrieve Test Cases
const API_KEY = process.env.TELA_API_KEY;
const promptId = 'prompt_uuid';
// Optional parameters
const promptVersionIds = ['version_uuid1', 'version_uuid2']; // Optional
const includeGenerations = true; // Optional
// Build URL with query parameters
const url = new URL('https://api.tela.ai/test-case');
url.searchParams.append('promptId', promptId);
// Add optional parameters if provided
if (promptVersionIds.length > 0) {
promptVersionIds.forEach(id => url.searchParams.append('promptVersionIds', id));
}
if (includeGenerations) {
url.searchParams.append('includeGenerations', 'true');
}
const response = await fetch(url, {
method: 'GET',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
import requests
API_KEY = os.getenv('TELA_API_KEY')
prompt_id = 'prompt_uuid'
# Optional parameters
prompt_version_ids = ['version_uuid1', 'version_uuid2'] # Optional
include_generations = True # Optional
params = {
'promptId': prompt_id
}
# Add optional parameters if provided
if prompt_version_ids:
params['promptVersionIds'] = prompt_version_ids
if include_generations:
params['includeGenerations'] = 'true'
response = requests.get(
'https://api.tela.ai/test-case',
headers={
'Authorization': f'Bearer {API_KEY}',
'Content-Type': 'application/json'
},
params=params
)
print(response.json())
const API_KEY = process.env.TELA_API_KEY;
const promptId = 'prompt_uuid';
// Optional parameters
const promptVersionIds = ['version_uuid1', 'version_uuid2']; // Optional
const includeGenerations = true; // Optional
// Build URL with query parameters
const url = new URL('https://api.tela.ai/test-case');
url.searchParams.append('promptId', promptId);
// Add optional parameters if provided
if (promptVersionIds.length > 0) {
promptVersionIds.forEach(id => url.searchParams.append('promptVersionIds', id));
}
if (includeGenerations) {
url.searchParams.append('includeGenerations', 'true');
}
fetch(url, {
method: 'GET',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
}
})
.then(response => response.json())
.then(data => {
console.log(data);
})
.catch(error => {
console.error('Error:', error);
});
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
promptId | string | Yes | The UUID of the prompt to retrieve test cases for |
promptVersionIds | string[] | No | Optional array of prompt version UUIDs to filter test cases by specific versions |
includeGenerations | boolean | No | Whether to include generation data in the response |
Response
The response returns an array of test case objects with the following properties:| Field | Type | Description |
|---|---|---|
id | string | Unique identifier for the test case (UUID) |
title | string | Title of the test case |
messages | array or null | Array of message objects with role and content |
variables | object or null | Key-value pairs of variables used in the test case |
variablesRichContent | object or null | Key-value pairs of rich content variables |
files | array or null | Array of file objects attached to the test case |
promptId | string | UUID of the prompt this test case belongs to |
expectedOutput | string or null | Expected output for evaluation purposes |
answers | object or null | Evaluation answers with good/bad results and evals |
promptApplicationId | string or null | UUID of the prompt application if applicable |
metadata | object or null | Metadata about the test case including source |
createdAt | string | Creation timestamp |
updatedAt | string | Last update timestamp |
deletedAt | string or null | Deletion timestamp if applicable |
generations | array | Array of generations (only included if includeGenerations=true) |
Example Response
[
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"title": "Customer Support Query Test",
"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": null,
"files": null,
"promptId": "550e8400-e29b-41d4-a716-446655440001",
"expectedOutput": "I'll help you track down your order, John. Let me look up order ORD-12345 for you.",
"answers": {
"version1": {
"good": [],
"bad": [],
"evals": []
}
},
"promptApplicationId": null,
"metadata": {
"source": "craft"
},
"createdAt": "2023-01-01T00:00:00.000Z",
"updatedAt": "2023-01-02T00:00:00.000Z",
"deletedAt": null,
"generations": []
}
]
Response
200 - application/json
List of test cases