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.
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
name
:string
projectId
:string
projectName
:string
datasetKind
:string
examples
:Example[]
addExamples()
Upload examples to this dataset in batches.
async function addExamples(examples: Example[], batchSize: number = 100): Promise<void>Parameters
examples
required:Example[]
The examples to upload.
batchSize
:number
Number of examples per batch request. Defaults to 100.
100
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
filePath
required:string
Path to the JSON file.
batchSize
:number
Number of examples per batch request. Defaults to 100.
100
Returns
Promise<void>
[Symbol.iterator]()
Iterate over examples.
function [Symbol.iterator](): Iterator<Example, any, any>Returns
Iterator<Example, any, any>
Last updated on