Skip to main content
Version: 4.7.34

Test results - Submit

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

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

Arguments

pipelineSlug: string

testCases: TestCase[]

View the types list in the Test Results → Get page for the full property breakdown of a TestCase object.

outputs: object[]

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.

context?: { "name": String, "metadata": MetadataValueObject }

Context object where you can specify the name of the test result and any metadata you want to attach to it.

Return value

resultInfo: { resultId: string }

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.

Types

🛠️ MetadataValueObject

type: string

{ [key: string]: any }