Skip to main content
Version: 2.0.0

Test results - Submit

The submitTestResult() function submits a test result for grading by the configured evaluators.

Arguments

pipelineSlug

The slug of the pipeline for which test results are being submitted. This string uniquely identifies the pipeline within the system.

testCases

An array of TestCase objects. Each TestCase object contains the details of a test case, including inputs, expected outputs, and other metadata related to the test case. View the types list in the "Get" section for the full property breakdown of a TestCase object.

outputs

An array of objects where each object represents the output of a test case through the pipeline. The outputs should be in the same order as the test cases provided.

Return value

resultInfo

This endpoint returns a simple object with the test result ID as a UUID string. Here's an example response structure.

json
{
"resultId": "FACB6642-4725-4FAE-9323-634E72533C89"
}

You can then use this ID to retrieve the test result using the getTestResult() function or check the status with the getTestResultStatus() function.

Example

typescript
import { init, getTestCases, submitTestResult } from "@gentrace/core";
import { createAiOutput } from "../pipelines"; // TODO: replace with your own pipeline
 
const MY_PIPELINE_SLUG = "my-pipeline";
 
const testCases = await getTestCases(MY_PIPELINE_SLUG);
 
const outputs = testCases.map((testCase) => {
return {
output: createAiOutput(testCase.inputs),
}
});
 
const resultInfo = await submitTestResult(MY_PIPELINE_SLUG, testCases, outputs);
 
console.log("Test result ID:", resultInfo.resultId);