Skip to content
Judgment Labs
Esc
navigateopen⌘Jpreview
On this page

Dataset

A collection of Example objects stored on the Judgment platform.

Datasets are retrieved via DatasetFactory.get or created via DatasetFactory.create. Once obtained, you can iterate over the examples directly, or add new ones.

const dataset = await client.datasets.get("golden-set");
for (const example of dataset) {
  console.log(example.get("input"));
}

Attributes

PropType
name?string
Typestring
projectId?string
Typestring
projectName?string
Typestring
datasetKind?string
Typestring
examples?Example[]
TypeExample[]

addExamples()

Upload examples to this dataset in batches.

async function addExamples(examples: Example[], batchSize: number = 100): Promise<void>

Parameters

PropType
examplesExample[]

The examples to upload.

TypeExample[]
batchSize?number

Number of examples per batch request. Defaults to 100.

Typenumber
Default100

Returns

Promise<void>


addFromJson()

Load examples from a JSON file and add them to the dataset.

Expects the file to contain a JSON array of objects, each with properties like input, actual_output, etc.

async function addFromJson(filePath: string, batchSize: number = 100): Promise<void>

Parameters

PropType
filePathstring

Path to the JSON file.

Typestring
batchSize?number

Number of examples per batch request. Defaults to 100.

Typenumber
Default100

Returns

Promise<void>


[Symbol.iterator]()

Iterate over examples.

function [Symbol.iterator](): Iterator<Example, any, any>

Returns

Iterator<Example, any, any>

Was this page helpful?