GET
/
test-case
curl --request GET \
  --url https://api.tela.com/test-case
[
  {
    "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",
    "metadata": {
      "source": "workstation"
    },
    "createdAt": "2023-11-07T05:31:56Z",
    "updatedAt": "2023-11-07T05:31:56Z",
    "deletedAt": "2023-11-07T05:31:56Z",
    "generations": [
      "<any>"
    ]
  }
]

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);

Parameters

NameTypeRequiredDescription
promptIdstringYesThe UUID of the prompt to retrieve test cases for
promptVersionIdsstring[]NoOptional array of prompt version UUIDs to filter test cases by specific versions
includeGenerationsbooleanNoWhether to include generation data in the response

Response

The response returns an array of test case objects with the following properties:

FieldTypeDescription
idstringUnique identifier for the test case (UUID)
titlestringTitle of the test case
messagesarray or nullArray of message objects with role and content
variablesobject or nullKey-value pairs of variables used in the test case
variablesRichContentobject or nullKey-value pairs of rich content variables
filesarray or nullArray of file objects attached to the test case
promptIdstringUUID of the prompt this test case belongs to
expectedOutputstring or nullExpected output for evaluation purposes
answersobject or nullEvaluation answers with good/bad results and evals
promptApplicationIdstring or nullUUID of the prompt application if applicable
metadataobject or nullMetadata about the test case including source
createdAtstringCreation timestamp
updatedAtstringLast update timestamp
deletedAtstring or nullDeletion timestamp if applicable
generationsarrayArray 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": []
  }
]

Query Parameters

promptId
string
required
promptVersionIds
string[]
includeGenerations
boolean

Response

200 - application/json

List of test cases

The response is of type object[].