lmnr datasets command is used to manage datasets in Laminar.
Usage
Creating a new dataset and iterating on it
1
Prepare input files
Prepare input files for the dataset. Supported formats are:
.json, .jsonl, .csv.
Every datapoint must at least have a data field. Save this file as data.json (or data.jsonl or data.csv).For JSON, the file must contain one array of datapoints.For JSONL, the file must contain one datapoint per line.For CSV, the file must contain a header row and one datapoint per row.Examples:2
Set the project API key
.env file in the same directory where you run the CLI.--project-api-key flag to the global datasets command, e.g.- JavaScript/TypeScript
- Python
3
Create a new dataset
Create a new dataset from the input file. This command will create a new dataset with the name
my-cli-dataset and save the datapoints to the file my-cli-dataset.json.The datapoints are saved to a new file in order to:- Store datasets in the Laminar format. In particular, datapoint id is crucial for versioning (Learn more).
- Not overwrite existing files.
- JavaScript/TypeScript
- Python
4
Work on the dataset locally
Make any changes required to the dataset by editing the file
my-cli-dataset.json.Make sure to not edit the id field of the datapoints.If you delete a datapoint, this will not affect the dataset in Laminar.
This is because the push operation only pushes new datapoint (versions) to the dataset.
5
Push the changes to Laminar
Push the changes to Laminar.This will push the changes to the dataset in Laminar.
- JavaScript/TypeScript
- Python
6
Pull the changes from Laminar
If you need to update the local dataset with the latest changes from Laminar, you can pull the changes.This will pull the changes from the dataset in Laminar to the local file
- JavaScript/TypeScript
- Python
my-cli-dataset.json.Working on an existing dataset
1
Set the project API key
.env file in the same directory where you run the CLI.--project-api-key flag to the global datasets command, e.g.- JavaScript/TypeScript
- Python
2
Select the dataset to work on
List all datasets and select the one you want to work on.
- JavaScript/TypeScript
- Python
3
Pull the data from Laminar
Pull the data from Laminar to a local file.This will pull the changes from the dataset in Laminar to the local file
- JavaScript/TypeScript
- Python
my-dataset.json.4
Work on the dataset locally
Make any changes required to the dataset by editing the file
my-dataset.json.Make sure to not edit the id field of the datapoints.If you delete a datapoint, this will not affect the dataset in Laminar.
This is because the push operation only pushes new datapoint (versions) to the dataset.
5
Push the changes to Laminar
Push the changes to Laminar.This will push the changes to the dataset in Laminar.
- JavaScript/TypeScript
- Python
Setting the CLI to call a local Laminar instance
Globaldatasets command has optional arguments:
--base-url: The base URL of the Laminar instance. Do NOT include port here. Default ishttps://api.lmnr.ai.--port: The HTTP port of the Laminar instance. Default is 443. For local self-hosted Laminar, use 8000.--project-api-key: The API key of the project. If not provided, reads fromLMNR_PROJECT_API_KEYenvironment variable.
Reference
- JavaScript/TypeScript
- Python
General options
These are useful if you want to call a local Laminar instance.Commands
List all datasets
List all datasets.- JavaScript/TypeScript
- Python
Create a new dataset
Create a dataset from input files.- JavaScript/TypeScript
- Python
Push datapoints to a dataset
Push datapoints to an existing dataset from a file or files.- JavaScript/TypeScript
- Python
Pull datapoints from a dataset
Pull datapoints from a dataset to a file or print them to the console.- JavaScript/TypeScript
- Python
