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
Type
stringprojectId?string
Type
stringprojectName?string
Type
stringdatasetKind?string
Type
stringexamples?Example[]
Type
Example[]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.
Type
Example[]batchSize?number
Number of examples per batch request. Defaults to 100.
Type
numberDefault
100Returns
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.
Type
stringbatchSize?number
Number of examples per batch request. Defaults to 100.
Type
numberDefault
100Returns
Promise<void>
[Symbol.iterator]()
Iterate over examples.
function [Symbol.iterator](): Iterator<Example, any, any>
Returns
Iterator<Example, any, any>