Skip to main content
Opik Documentation

Search documentation

Type to search this documentation.

Expand dataset with synthetic samples

POST/v1/private/datasets/{id}/expansionsExpand dataset with synthetic samples

Generate synthetic dataset samples using LLM based on existing data patterns

Parameters

idstring · uuidpathrequired

Request body

application/json
objectDatasetExpansion_Write
custom_promptstring

Custom prompt to use for generation instead of auto-generated one

max_completion_tokensinteger · int32

Maximum number of tokens for the LLM response. Required by Anthropic, used as maxOutputTokens for Gemini. If not provided, defaults to 4000 for Anthropic models only.

minimum 100

modelstringrequired

The model to use for synthetic data generation

minLength 1

preserve_fieldsarray of string

Fields to preserve patterns from original data

Show child attributes
sample_countinteger · int32

Number of synthetic samples to generate

maximum 200 · minimum 1

variation_instructionsstring

Additional instructions for data variation

Example request
{
  "custom_prompt": "string",
  "max_completion_tokens": 0,
  "model": "gpt-4",
  "preserve_fields": [
    "input",
    "expected_output"
  ],
  "sample_count": 10,
  "variation_instructions": "Create variations that test edge cases"
}

Responses

200Generated synthetic samplesapplication/json
objectDatasetExpansionResponse
generated_samplesarray of object

List of generated synthetic dataset items

Show child attributes
Show array items
created_atstring · date-time
created_bystring
dataobjectrequired
dataset_idstring · uuid
dataset_item_idstring · uuid

Deprecated. Always equals 'id'. Retained for backward compatibility and will be removed in a future version

descriptionstring

pattern (?s)^\s*(\S.*\S|\S)\s*$

evaluatorsarray of object
Show child attributes
Show array items
configobjectrequired
namestringrequired

minLength 1

typestringrequired

one of "llm_judge", "code_metric"

execution_policyobject
Show child attributes
pass_thresholdinteger · int32

maximum 100 · minimum 1

runs_per_iteminteger · int32

maximum 100 · minimum 1

experiment_itemsarray of object
Show child attributes
Show array items
assertion_resultsarray of object
Show child attributes
Show array items
passedboolean
reasonstring
valuestring
commentsarray of object
Show child attributes
Show array items
created_atstring · date-time
created_bystring
idstring · uuid
last_updated_atstring · date-time
last_updated_bystring
source_queue_idstring · uuid
textstringrequired

minLength 1

created_atstring · date-time
created_bystring
dataset_item_idstring · uuidrequired
descriptionstring
durationnumber · double
execution_policyobjectExecutionPolicy ↑
experiment_idstring · uuidrequired
feedback_scoresarray of object
Show child attributes
Show array items
category_namestring
created_atstring · date-time
created_bystring
last_updated_atstring · date-time
last_updated_bystring
namestringrequired

minLength 1

reasonstring
sourcestringrequired

one of "ui", "sdk", "online_scoring"

source_queue_idstring · uuid
valuenumberrequired

maximum 1000000000 · minimum -1000000000

value_by_authorobject
idstring · uuid
inputobject
Show child attributes
anyOf · 3 options
Option 1object
Option 2array of object
Option 3string
last_updated_atstring · date-time
last_updated_bystring
outputobjectJsonListString ↑
project_idstring · uuid
project_namestring

pattern (?s)^\s*(\S.*\S|\S)\s*$

statusstring

one of "passed", "failed"

total_estimated_costnumber
trace_idstring · uuidrequired
trace_metadataobjectJsonListString ↑
trace_visibility_modestring

one of "default", "hidden"

usageobject
idstring · uuid

Stable item identifier. On write, used as the upsert key. If omitted, a new ID is generated. Remains the same across dataset versions

last_updated_atstring · date-time
last_updated_bystring
run_summaries_by_experimentobject
sourcestringrequired

one of "manual", "trace", "span", "sdk"

span_idstring · uuid
tagsarray of string

uniqueItems true

Show child attributes

uniqueItems true

trace_idstring · uuid
generation_timestring · date-time

Generation timestamp

modelstring

Model used for generation

total_generatedinteger · int32

Total number of samples generated

Example response
{
  "generated_samples": [
    {
      "created_at": "2026-06-09T00:00:00Z",
      "created_by": "string",
      "data": {},
      "dataset_id": "00000000-0000-0000-0000-000000000000",
      "dataset_item_id": "00000000-0000-0000-0000-000000000000",
      "description": "string",
      "evaluators": [
        {
          "config": {},
          "name": "string",
          "type": "code_metric"
        }
      ],
      "execution_policy": {
        "pass_threshold": 0,
        "runs_per_item": 0
      },
      "experiment_items": [
        {
          "assertion_results": [
            {
              "passed": true,
              "reason": "string",
              "value": "string"
            }
          ],
          "comments": [
            {
              "created_at": "2026-06-09T00:00:00Z",
              "created_by": "string",
              "id": "00000000-0000-0000-0000-000000000000",
              "last_updated_at": "2026-06-09T00:00:00Z",
              "last_updated_by": "string",
              "source_queue_id": "00000000-0000-0000-0000-000000000000",
              "text": "string"
            }
          ],
          "created_at": "2026-06-09T00:00:00Z",
          "created_by": "string",
          "dataset_item_id": "00000000-0000-0000-0000-000000000000",
          "description": "string",
          "duration": 0,
          "execution_policy": {
            "pass_threshold": 0,
            "runs_per_item": 0
          },
          "experiment_id": "00000000-0000-0000-0000-000000000000",
          "feedback_scores": [
            {
              "category_name": "string",
              "created_at": "2026-06-09T00:00:00Z",
              "created_by": "string",
              "last_updated_at": "2026-06-09T00:00:00Z",
              "last_updated_by": "string",
              "name": "string",
              "reason": "string",
              "source": "online_scoring",
              "source_queue_id": "00000000-0000-0000-0000-000000000000",
              "value": 0,
              "value_by_author": {
                "additionalProp1": {
                  "author": "string",
                  "category_name": "string",
                  "last_updated_at": "2026-06-09T00:00:00Z",
                  "reason": "string",
                  "source": "online_scoring",
                  "source_queue_id": "string",
                  "span_id": "string",
                  "span_type": "string",
                  "value": 0
                }
              }
            }
          ],
          "id": "00000000-0000-0000-0000-000000000000",
          "input": [
            {}
          ],
          "last_updated_at": "2026-06-09T00:00:00Z",
          "last_updated_by": "string",
          "output": [
            {}
          ],
          "project_id": "00000000-0000-0000-0000-000000000000",
          "project_name": "string",
          "status": "failed",
          "total_estimated_cost": 0,
          "trace_id": "00000000-0000-0000-0000-000000000000",
          "trace_metadata": [
            {}
          ],
          "trace_visibility_mode": "default",
          "usage": {
            "additionalProp1": 0
          }
        }
      ],
      "id": "00000000-0000-0000-0000-000000000000",
      "last_updated_at": "2026-06-09T00:00:00Z",
      "last_updated_by": "string",
      "run_summaries_by_experiment": {
        "additionalProp1": {
          "passed_runs": 0
        }
      },
      "source": "manual"
    }
  ]
}
Documentation menu