Skip to main content
POST
/
v4
/
application-test-case-outputs
/
batch
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
)
page = client.application_test_case_outputs.batch(
    items=[{
        "account_id": "account_id",
        "application_variant_id": "application_variant_id",
        "evaluation_dataset_version_num": 0,
        "output": {
            "generation_output": "generation_output"
        },
        "test_case_id": "test_case_id",
    }],
)
page = page.items[0]
print(page)
package main

import (
"context"
"fmt"

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

func main() {
client := sgp.NewClient(
option.WithAPIKey("My API Key"),
)
page, err := client.ApplicationTestCaseOutputs.Batch(context.TODO(), sgp.ApplicationTestCaseOutputBatchParams{
Items: []sgp.ApplicationTestCaseOutputBatchParamsItem{{
AccountID: sgp.F("account_id"),
ApplicationVariantID: sgp.F("application_variant_id"),
EvaluationDatasetVersionNum: sgp.F(int64(0)),
Output: sgp.F[sgp.ApplicationTestCaseOutputBatchParamsItemsOutputUnion](shared.ResultSchemaGenerationParam{
GenerationOutput: sgp.F("generation_output"),
}),
TestCaseID: sgp.F("test_case_id"),
}},
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
curl --request POST \
--url https://api.egp.scale.com/v4/application-test-case-outputs/batch \
--header 'Content-Type: application/json' \
--data '
[
{
"application_variant_id": "<string>",
"test_case_id": "<string>",
"output": {
"generation_output": "<string>",
"generation_extra_info": {
"chunks": [
{
"text": "<string>",
"metadata": {}
}
],
"schema_type": "CHUNKS"
}
},
"account_id": "<string>",
"evaluation_dataset_version_num": 123,
"trace_spans": [
{
"node_id": "<string>",
"start_timestamp": "2023-11-07T05:31:56Z",
"operation_input": {},
"operation_output": {},
"operation_type": "CUSTOM",
"operation_status": "SUCCESS",
"end_timestamp": "2023-11-07T05:31:56Z",
"operation_metadata": {},
"duration_ms": 0,
"account_id": "<string>",
"operation_expected": {}
}
],
"metrics": {},
"ignore_missing": true
}
]
'
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify([
{
application_variant_id: '<string>',
test_case_id: '<string>',
output: {
generation_output: '<string>',
generation_extra_info: {chunks: [{text: '<string>', metadata: {}}], schema_type: 'CHUNKS'}
},
account_id: '<string>',
evaluation_dataset_version_num: 123,
trace_spans: [
{
node_id: '<string>',
start_timestamp: '2023-11-07T05:31:56Z',
operation_input: {},
operation_output: {},
operation_type: 'CUSTOM',
operation_status: 'SUCCESS',
end_timestamp: '2023-11-07T05:31:56Z',
operation_metadata: {},
duration_ms: 0,
account_id: '<string>',
operation_expected: {}
}
],
metrics: {},
ignore_missing: true
}
])
};

fetch('https://api.egp.scale.com/v4/application-test-case-outputs/batch', 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/application-test-case-outputs/batch",
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([
[
'application_variant_id' => '<string>',
'test_case_id' => '<string>',
'output' => [
'generation_output' => '<string>',
'generation_extra_info' => [
'chunks' => [
[
'text' => '<string>',
'metadata' => [

]
]
],
'schema_type' => 'CHUNKS'
]
],
'account_id' => '<string>',
'evaluation_dataset_version_num' => 123,
'trace_spans' => [
[
'node_id' => '<string>',
'start_timestamp' => '2023-11-07T05:31:56Z',
'operation_input' => [

],
'operation_output' => [

],
'operation_type' => 'CUSTOM',
'operation_status' => 'SUCCESS',
'end_timestamp' => '2023-11-07T05:31:56Z',
'operation_metadata' => [

],
'duration_ms' => 0,
'account_id' => '<string>',
'operation_expected' => [

]
]
],
'metrics' => [

],
'ignore_missing' => true
]
]),
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/application-test-case-outputs/batch")
.header("Content-Type", "application/json")
.body("[\n {\n \"application_variant_id\": \"<string>\",\n \"test_case_id\": \"<string>\",\n \"output\": {\n \"generation_output\": \"<string>\",\n \"generation_extra_info\": {\n \"chunks\": [\n {\n \"text\": \"<string>\",\n \"metadata\": {}\n }\n ],\n \"schema_type\": \"CHUNKS\"\n }\n },\n \"account_id\": \"<string>\",\n \"evaluation_dataset_version_num\": 123,\n \"trace_spans\": [\n {\n \"node_id\": \"<string>\",\n \"start_timestamp\": \"2023-11-07T05:31:56Z\",\n \"operation_input\": {},\n \"operation_output\": {},\n \"operation_type\": \"CUSTOM\",\n \"operation_status\": \"SUCCESS\",\n \"end_timestamp\": \"2023-11-07T05:31:56Z\",\n \"operation_metadata\": {},\n \"duration_ms\": 0,\n \"account_id\": \"<string>\",\n \"operation_expected\": {}\n }\n ],\n \"metrics\": {},\n \"ignore_missing\": true\n }\n]")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.egp.scale.com/v4/application-test-case-outputs/batch")

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 {\n \"application_variant_id\": \"<string>\",\n \"test_case_id\": \"<string>\",\n \"output\": {\n \"generation_output\": \"<string>\",\n \"generation_extra_info\": {\n \"chunks\": [\n {\n \"text\": \"<string>\",\n \"metadata\": {}\n }\n ],\n \"schema_type\": \"CHUNKS\"\n }\n },\n \"account_id\": \"<string>\",\n \"evaluation_dataset_version_num\": 123,\n \"trace_spans\": [\n {\n \"node_id\": \"<string>\",\n \"start_timestamp\": \"2023-11-07T05:31:56Z\",\n \"operation_input\": {},\n \"operation_output\": {},\n \"operation_type\": \"CUSTOM\",\n \"operation_status\": \"SUCCESS\",\n \"end_timestamp\": \"2023-11-07T05:31:56Z\",\n \"operation_metadata\": {},\n \"duration_ms\": 0,\n \"account_id\": \"<string>\",\n \"operation_expected\": {}\n }\n ],\n \"metrics\": {},\n \"ignore_missing\": true\n }\n]"

response = http.request(request)
puts response.read_body
[
  {
    "application_variant_id": "<string>",
    "evaluation_dataset_id": "<string>",
    "test_case_id": "<string>",
    "output": {
      "generation_output": "<string>",
      "generation_extra_info": {
        "chunks": [
          {
            "text": "<string>",
            "metadata": {}
          }
        ],
        "schema_type": "CHUNKS"
      }
    },
    "id": "<string>",
    "created_at": "2023-11-07T05:31:56Z",
    "account_id": "<string>",
    "schema_type": "GENERATION",
    "application_interaction_id": "<string>",
    "application_test_case_output_group_id": "<string>",
    "metrics": {}
  }
]
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}

Body

application/json
application_variant_id
string
required
test_case_id
string
required
output
ResultSchemaGeneration · object
required
account_id
string
required
evaluation_dataset_version_num
integer
required
trace_spans
EvaluationTraceSpanRequest · object[]

List of trace spans associated with the application's execution. These spans provide insight into the individual steps taken by nodes involved in generating the output.

metrics
Metrics · object
ignore_missing
boolean

If set to true, the output batch will be saved even if there are missing outputs for some test cases.

Response

Successful Response

application_variant_id
string
required
evaluation_dataset_id
string
required
test_case_id
string
required
output
ResultSchemaGeneration · object
required
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.

account_id
string
required

The ID of the account that owns the given entity.

schema_type
string
default:GENERATION
Allowed value: "GENERATION"
application_interaction_id
string
application_test_case_output_group_id
string
metrics
Metrics · object