Skip to main content
POST
/
v4
/
evaluation-datasets
/
{evaluation_dataset_id}
/
test-cases
Python
import os
from scale_gp import SGPClient

client = SGPClient(
    api_key=os.environ.get("SGP_API_KEY"),  # This is the default and can be omitted
)
test_case = client.evaluation_datasets.test_cases.create(
    evaluation_dataset_id="evaluation_dataset_id",
    test_case_data={
        "artifact_ids_filter": ["string"],
        "input": "input",
    },
)
print(test_case)
package main

import (
"context"
"fmt"

"github.com/stainless-sdks/sgp-go"
"github.com/stainless-sdks/sgp-go/option"
)

func main() {
client := sgp.NewClient(
option.WithAPIKey("My API Key"),
)
testCase, err := client.EvaluationDatasets.TestCases.New(
context.TODO(),
"evaluation_dataset_id",
sgp.EvaluationDatasetTestCaseNewParams{
TestCaseData: sgp.F[sgp.EvaluationDatasetTestCaseNewParamsTestCaseDataUnion](sgp.ArtifactSchemaGenerationParam{
ArtifactIDsFilter: sgp.F([]string{"string"}),
Input: sgp.F("input"),
}),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", testCase)
}
curl --request POST \
--url https://api.egp.scale.com/v4/evaluation-datasets/{evaluation_dataset_id}/test-cases \
--header 'Content-Type: application/json' \
--data '
{
"test_case_data": {
"input": "<string>",
"artifact_ids_filter": [
"<string>"
],
"expected_output": "<string>",
"expected_extra_info": {
"chunks": [
{
"text": "<string>",
"metadata": {}
}
],
"schema_type": "CHUNKS"
}
},
"chat_history": {},
"test_case_metadata": {},
"account_id": "<string>"
}
'
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
test_case_data: {
input: '<string>',
artifact_ids_filter: ['<string>'],
expected_output: '<string>',
expected_extra_info: {chunks: [{text: '<string>', metadata: {}}], schema_type: 'CHUNKS'}
},
chat_history: {},
test_case_metadata: {},
account_id: '<string>'
})
};

fetch('https://api.egp.scale.com/v4/evaluation-datasets/{evaluation_dataset_id}/test-cases', 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.egp.scale.com/v4/evaluation-datasets/{evaluation_dataset_id}/test-cases",
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([
'test_case_data' => [
'input' => '<string>',
'artifact_ids_filter' => [
'<string>'
],
'expected_output' => '<string>',
'expected_extra_info' => [
'chunks' => [
[
'text' => '<string>',
'metadata' => [

]
]
],
'schema_type' => 'CHUNKS'
]
],
'chat_history' => [

],
'test_case_metadata' => [

],
'account_id' => '<string>'
]),
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;
}
HttpResponse<String> response = Unirest.post("https://api.egp.scale.com/v4/evaluation-datasets/{evaluation_dataset_id}/test-cases")
.header("Content-Type", "application/json")
.body("{\n \"test_case_data\": {\n \"input\": \"<string>\",\n \"artifact_ids_filter\": [\n \"<string>\"\n ],\n \"expected_output\": \"<string>\",\n \"expected_extra_info\": {\n \"chunks\": [\n {\n \"text\": \"<string>\",\n \"metadata\": {}\n }\n ],\n \"schema_type\": \"CHUNKS\"\n }\n },\n \"chat_history\": {},\n \"test_case_metadata\": {},\n \"account_id\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.egp.scale.com/v4/evaluation-datasets/{evaluation_dataset_id}/test-cases")

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 \"test_case_data\": {\n \"input\": \"<string>\",\n \"artifact_ids_filter\": [\n \"<string>\"\n ],\n \"expected_output\": \"<string>\",\n \"expected_extra_info\": {\n \"chunks\": [\n {\n \"text\": \"<string>\",\n \"metadata\": {}\n }\n ],\n \"schema_type\": \"CHUNKS\"\n }\n },\n \"chat_history\": {},\n \"test_case_metadata\": {},\n \"account_id\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "evaluation_dataset_id": "<string>",
  "test_case_data": {
    "input": "<string>",
    "artifact_ids_filter": [
      "<string>"
    ],
    "expected_output": "<string>",
    "expected_extra_info": {
      "chunks": [
        {
          "text": "<string>",
          "metadata": {}
        }
      ],
      "schema_type": "CHUNKS"
    }
  },
  "autogenerated": true,
  "id": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z",
  "account_id": "<string>",
  "created_by_user_id": "<string>",
  "schema_type": "GENERATION",
  "chat_history": {},
  "test_case_metadata": {},
  "invalidated_at": "2023-11-07T05:31:56Z",
  "archived_at": "2023-11-07T05:31:56Z"
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}

Path Parameters

evaluation_dataset_id
string
required

Body

application/json
test_case_data
ArtifactSchemaGeneration · object
required
chat_history
Chat History · object
test_case_metadata
Test Case Metadata · object
account_id
string

Response

Successful Response

evaluation_dataset_id
string
required

The ID of the associated evaluation dataset.

test_case_data
ArtifactSchemaGeneration · object
required
autogenerated
boolean
required

Boolean to track whether or not the test case is autogenerated

id
string
required

The unique identifier of the entity.

created_at
string<date-time>
required

The date and time when the entity was created in ISO format.

updated_at
string<date-time>
required

The date and time when the entity was last updated in ISO format.

account_id
string
required

The ID of the account that owns the given entity.

created_by_user_id
string
required

The user who originally created the entity.

created_by_identity_type
enum<string>
required

The type of identity that created the entity.

Available options:
user,
service_account
schema_type
string
default:GENERATION
Allowed value: "GENERATION"
chat_history
Chat History · object

Used for tracking previous chat interactions for multi-chat test cases

test_case_metadata
Test Case Metadata · object

Metadata for the test case

invalidated_at
string<date-time>

The date and time when the entity was overwritten or deleted in ISO format.

archived_at
string<date-time>

The date and time when the entity was archived in ISO format.