Skip to main content
POST
/
v1
/
datasets
/
{dataset_id}
/
experiments
Create experiment on a dataset
curl --request POST \
  --url https://api.example.com/v1/datasets/{dataset_id}/experiments \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "description": "<string>",
  "metadata": {},
  "version_id": "<string>",
  "splits": [
    "<string>"
  ],
  "repetitions": 1
}
'
import requests

url = "https://api.example.com/v1/datasets/{dataset_id}/experiments"

payload = {
"name": "<string>",
"description": "<string>",
"metadata": {},
"version_id": "<string>",
"splits": ["<string>"],
"repetitions": 1
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
metadata: {},
version_id: '<string>',
splits: ['<string>'],
repetitions: 1
})
};

fetch('https://api.example.com/v1/datasets/{dataset_id}/experiments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/datasets/{dataset_id}/experiments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'metadata' => [

],
'version_id' => '<string>',
'splits' => [
'<string>'
],
'repetitions' => 1
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.example.com/v1/datasets/{dataset_id}/experiments"

payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"metadata\": {},\n \"version_id\": \"<string>\",\n \"splits\": [\n \"<string>\"\n ],\n \"repetitions\": 1\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.example.com/v1/datasets/{dataset_id}/experiments")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"metadata\": {},\n \"version_id\": \"<string>\",\n \"splits\": [\n \"<string>\"\n ],\n \"repetitions\": 1\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/datasets/{dataset_id}/experiments")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"metadata\": {},\n \"version_id\": \"<string>\",\n \"splits\": [\n \"<string>\"\n ],\n \"repetitions\": 1\n}"

response = http.request(request)
puts response.read_body
{
  "data": {
    "id": "<string>",
    "dataset_id": "<string>",
    "dataset_version_id": "<string>",
    "name": "<string>",
    "description": "<string>",
    "repetitions": 123,
    "metadata": {},
    "project_name": "<string>",
    "created_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z",
    "example_count": 123,
    "successful_run_count": 123,
    "failed_run_count": 123,
    "missing_run_count": 123
  }
}
"<string>"
"<string>"
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}

Path Parameters

dataset_id
string
required

Body

application/json

Details of the experiment to be created

name
string | null

Name of the experiment (if omitted, a random name will be generated)

description
string | null

An optional description of the experiment

metadata
Metadata · object | null

Metadata for the experiment

version_id
string | null

ID of the dataset version over which the experiment will be run (if omitted, the latest version will be used)

splits
string[] | null

List of dataset split identifiers (GlobalIDs or names) to filter by

repetitions
integer
default:1

Number of times the experiment should be repeated for each example

Response

Experiment retrieved successfully

data
Experiment · object
required