import SGPClient from 'sgp';
const client = new SGPClient({
apiKey: process.env['SGP_API_KEY'], // This is the default and can be omitted
});
const testCases = await client.evaluationDatasets.testCases.batch('evaluation_dataset_id', [
{ test_case_data: { artifact_ids_filter: ['string'], input: 'input' } },
]);
console.log(testCases);
[
{
"evaluation_dataset_id": "<string>",
"schema_type": "GENERATION",
"test_case_data": {
"input": "<string>",
"expected_output": "<string>",
"expected_extra_info": {
"schema_type": "CHUNKS",
"chunks": [
{
"text": "<string>",
"metadata": {}
}
]
},
"artifact_ids_filter": [
"<string>"
]
},
"chat_history": {},
"autogenerated": true,
"test_case_metadata": {},
"invalidated_at": "2023-11-07T05:31:56Z",
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"account_id": "<string>",
"created_by_user_id": "<string>",
"archived_at": "2023-11-07T05:31:56Z"
}
]
Creates a batch of test cases
This API can be used to create multiple test cases so users do not have to the incur the cost of repeated network calls. To use this API, pass in a list of test cases in the request body.
import SGPClient from 'sgp';
const client = new SGPClient({
apiKey: process.env['SGP_API_KEY'], // This is the default and can be omitted
});
const testCases = await client.evaluationDatasets.testCases.batch('evaluation_dataset_id', [
{ test_case_data: { artifact_ids_filter: ['string'], input: 'input' } },
]);
console.log(testCases);
[
{
"evaluation_dataset_id": "<string>",
"schema_type": "GENERATION",
"test_case_data": {
"input": "<string>",
"expected_output": "<string>",
"expected_extra_info": {
"schema_type": "CHUNKS",
"chunks": [
{
"text": "<string>",
"metadata": {}
}
]
},
"artifact_ids_filter": [
"<string>"
]
},
"chat_history": {},
"autogenerated": true,
"test_case_metadata": {},
"invalidated_at": "2023-11-07T05:31:56Z",
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"account_id": "<string>",
"created_by_user_id": "<string>",
"archived_at": "2023-11-07T05:31:56Z"
}
]
The body is of type TestCaseVersionRequest · object[]
.
Successful Response