Test results - Get
- TypeScript
- Python
Retrieves the information for a TestResult
with the getTestResult()
function.
Retrieves the information for a TestResult
with the get_test_result()
function.
Arguments
Return value
Our API returns a complex, deeply-expanded object that contains result, pipeline, run, evaluation, and evaluator information.
Types
🛠️ ExpandedTestResult
The ExpandedTestResult
type outlines the structure of a test result in TypeScript. Below are the properties of the ExpandedTestResult
type.
Contains all properties from TestResult
(below)
pipeline
This property contains the ExpandedPipeline
object associated with the test result. See the ExpandedPipeline
type below.
runs
This property contains an array of ExpandedTestRun
objects associated with the test result. See the ExpandedTestRun
type below.
🛠️ ExpandedTestRun
Contains all properties from TestRun
(below)
full?
An instance of the FullRun
type. This is optional and may be null
.
steps?
An array of ResolvedStepRun
items. This array represents the steps involved in the test run, and is optional.
case?
An instance of the TestCase
type. This represents the test case associated with the run, and is optional.
evaluations?
An array of TestEvaluation
items. These are the evaluations for the test run, and this property is optional.
🛠️ FullRun
The FullRun
type details a comprehensive set of data about a complete pipeline execution in TypeScript. Below are the fields of the FullRun
type.
pipelineRunId
The unique identifier for the pipeline run.
pipelineId
The identifier for the pipeline that this run belongs to.
organizationId
The identifier for the organization under which the run is conducted.
startTime
The timestamp when the run started.
endTime
The timestamp when the run ended.
cost?
The cost associated with the run, if applicable. This field is optional.
elapsed?
The total time taken for the run, in milliseconds. This field is optional.
feedback?
A numeric value representing feedback, if applicable. This field is optional.
lastInvocation?
The timestamp of the last invocation during the run, if applicable. This field is optional.
inputs?
An object representing the inputs for the run, with string keys and values of any type. This field is optional.
outputs?
An object representing the outputs from the run, with string keys and values of any type. This field is optional.
renderHTMLKey?
A key for rendering the run results in HTML format, if applicable. This field is optional.
metadata?
An object containing metadata for the run, with string keys and MetadataValueObject
values. This field is optional.
🛠️ ResolvedStepRun
The ResolvedStepRun
interface encapsulates details about a particular step in a test run process. Here are the properties that constitute the ResolvedStepRun
interface:
id?
An optional unique identifier for the step run. If present, it's a string.
organizationId?
An optional identifier for the organization within which the step run is performed. This can also be null
.
providerName?
An optional name of the provider executing the step.
invocation?
An optional invocation identifier or details related to the step execution.
modelParams?
An optional object containing model parameters; each key maps to a relevant value.
inputs?
An optional object holding input parameters for the step; each key maps to an input value.
outputs?
An optional object containing the outputs from the step; each key maps to an output value.
startTime?
An optional timestamp marking the start of the step run. It can be null
if not started yet.
endTime?
An optional timestamp marking the end of the step run. It can be null
if not finished yet.
pipelineRunId?
An optional identifier for the pipeline run to which this step is associated.
🛠️ TestCase
id
The unique identifier for the test case.
createdAt
The date and time at which the test case was created.
archivedAt?
The date and time when the test case was archived. This property can be null
if the test case has not been archived.
updatedAt
The date and time when the test case was last updated.
expectedOutputs?
An object representing the expected outputs for the test case. This property can be null
if there are no expected outputs.
inputs
An object containing the input data for the test case, where keys are strings and values are of any type.
name
The name given to the test case.
pipelineId
The identifier for the pipeline associated with the test case.
🛠️ TestEvaluation
The TestEvaluation
interface represents the structure of an evaluation record for a test run. Below are its properties with their respective types and descriptions:
id
The unique identifier of the test evaluation.
createdAt
The timestamp when the test evaluation was created.
updatedAt
The timestamp when the test evaluation was last updated.
isPending
A boolean indicating whether the evaluation is still pending.
debug?
An optional property that, if present, contains an object with debug information. This property can be null
.
evaluatorId
The identifier of the evaluator used for this test evaluation.
runId
The identifier of the test run that this evaluation belongs to.
evalLabel?
An optional label for the evaluation. This property can be null
.
evalValue?
An optional numeric value associated with the evaluation. This property can be null
.
manualCreatedByEmail?
The email address of the person who manually created this evaluation, if applicable. This property can be null
.
billingGpt4InputTokens
The number of input tokens billed for GPT-4 for this evaluation.
billingGpt4OutputTokens
The number of output tokens billed for GPT-4 for this evaluation.
billingGpt35InputTokens
The number of input tokens billed for GPT-3.5 for this evaluation.
billingGpt35OutputTokens
The number of output tokens billed for GPT-3.5 for this evaluation.
🛠️ TestResult
id
The unique identifier for the test result as a UUID string.
createdAt
The timestamp indicating when the test result was created, formatted as an ISO 8601 string.
updatedAt
The timestamp indicating when the test result was last updated, formatted as an ISO 8601 string.
pipelineId
The unique identifier for the pipeline associated with the test result as a UUID string.
branch?
The name of the Git branch that the test result was created from. This field can be null if not applicable.
commit?
The Git commit hash that the test result was created from. This field can be null if not applicable.
metadata?
A collection of metadata associated with the test result, where each key is a string and the value is of type MetadataValueObject
. This field can be null if no metadata is provided.
name?
The name given to the test result. This field can be null if not named.
🛠️ MetadataValueObject
The MetadataValueObject
type is designed to represent a metadata value within a test result in TypeScript. Below is the structure of the MetadataValueObject
type.
type
The type of metadata value, expressed as a string.
{ [key: string]: any }
An indexer indicating that the object can have any number of properties with string keys and values of any type.
🛠️ ExpandedPipeline
The ExpandedPipeline
type outlines the structure of a pipeline in TypeScript. Below are the properties of the ExpandedPipeline
type.
Contains all properties from Pipeline
(below)
evaluators
This property contains an array of TestEvaluator
objects associated with the pipeline. See the TestEvaluator
type below.
🛠️ Pipeline
The Pipeline
type represents the structure of a pipeline in TypeScript. Below are the properties that define a Pipeline
.
id
The unique identifier for the pipeline as a string.
createdAt
The timestamp when the pipeline was created as a string.
updatedAt
The timestamp when the pipeline was last updated as a string.
archivedAt?
The timestamp when the pipeline was archived as a string. This can be null
if the pipeline has not been archived.
labels
An array of strings representing the labels attached to the pipeline.
displayName?
The display name of the pipeline. This can be null
.
slug
The slug of the pipeline, used in URLs and as an identifier in the user interface.
organizationId
The identifier for the organization that owns the pipeline as a string.
branch?
The branch that the pipeline is associated with. This can be null
.
🛠️ TestRun
The TestRun
type defines the structure of a test run in TypeScript. The following are the attributes of the TestRun
type.
id
The unique identifier for the test run as a string.
createdAt
The timestamp of when the test run was created as an ISO 8601 string.
updatedAt
The timestamp of when the test run was last updated as an ISO 8601 string.
caseId
The identifier of the test case related to the test run.
resultId
The identifier of the test result related to the test run.
🛠️ TestEvaluator
The TestEvaluator
type describes the structure of a test evaluator in TypeScript. Below are the properties of the TestEvaluator
type.
id
The unique identifier for the test evaluator as a string.
createdAt
The timestamp when the test evaluator was created as an ISO 8601 string.
updatedAt
The timestamp when the test evaluator was last updated as an ISO 8601 string.
archivedAt?
The timestamp when the test evaluator was archived as an ISO 8601 string. This can be null
if the test evaluator has not been archived.
icon?
An optional string representing the icon for the test evaluator. This is nullable.
name
The name of the test evaluator.
options
An optional array containing options for the test evaluator. This can be null
if there are no options.
aiModel?
An optional identifier of the AI model used by the test evaluator. This is nullable.
pipelineId
The identifier for the pipeline that the test evaluator is associated with.
processorId?
An optional identifier for the processor used by the test evaluator. This is nullable.
heuristicFn?
An optional heuristic function associated with the test evaluator. This is nullable.
aiPromptFormat?
An optional format of AI prompts used by the test evaluator. This is nullable.
humanPrompt?
An optional prompt used for human evaluation within the test evaluator. This is nullable.
who
A string that describes who is performing the evaluation.
valueType
A string that indicates the type of value the test evaluator returns or uses.
🛠️ MetadataValueObject
The MetadataValueObject
type is designed to represent a metadata value within a test result in TypeScript. Below is the structure of the MetadataValueObject
type.
type
The type of metadata value, expressed as a string.
{ [key: string]: any }
An indexer indicating that the object can have any number of properties with string keys and values of any type.
Example
typescript
import {init ,getTestResult } from "@gentrace/core";consttestResult = awaitgetTestResult ("FACB6642-4725-4FAE-9323-634E72533C89");console .log ("Test result ID:",testResult .id );console .log ("Test result pipeline:",testResult .pipeline );console .log ("Test result runs:",testResult .runs );console .log ("Test result first run, first evaluation:",testResult ?.runs ?.[0]?.evaluations ?.[0]);console .log ("Test result first evaluator:",testResult .pipeline ?.evaluators ?.[0]);
python
import osimport gentracegentrace.init(api_key=os.getenv("GENTRACE_API_KEY"))test_result = gentrace.get_test_result("ede8271a-699f-4db7-a198-2c51a99e2dab")test_result_id = test_result.get('id')test_result_pipeline = test_result.get('pipeline')test_result_runs = test_result.get('runs')test_result_first_run_first_evaluation = test_result.get('runs', [{}])[0].get('evaluations', [])[0]test_result_first_evaluator = test_result.get('pipeline', {}).get('evaluators', [])[0]print("Test result ID:", test_result_id)print("Test result pipeline:", test_result_pipeline)print("Test result runs:", test_result_runs)print("Test result first run, first evaluation:", test_result_first_run_first_evaluation)print("Test result first evaluator:", test_result_first_evaluator)