Skip to main content
Opik Documentation

Search documentation

Type to search this documentation.

Create dataset items from spans

POST/v1/private/datasets/{dataset_id}/items/from-spansCreate dataset items from spans

Create dataset items from spans with enriched metadata

Parameters

dataset_idstring · uuidpathrequired

Request body

application/json
objectCreateDatasetItemsFromSpansRequest
enrichment_optionsobjectrequired

Options for enriching span data

Show child attributes
includeCommentsboolean
includeFeedbackScoresboolean
includeMetadataboolean
includeTagsboolean
includeUsageboolean
evaluatorsarray of object

Optional evaluators to apply to the created items

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

field_mappingsobject

Optional mapping of dataset item field name to a path into the span, e.g. 'input.input_text'. Takes precedence over the fields produced by enrichment_options. Ignored for test suite datasets.

span_idsarray of string · uuidrequired

Set of span IDs to add to the dataset

minItems 1 · uniqueItems true

Show child attributes

minItems 1 · uniqueItems true

Example request
{
  "enrichment_options": {
    "includeComments": true,
    "includeFeedbackScores": true,
    "includeMetadata": true,
    "includeTags": true,
    "includeUsage": true
  },
  "evaluators": [
    {
      "config": {},
      "name": "string",
      "type": "code_metric"
    }
  ],
  "execution_policy": {
    "pass_threshold": 0,
    "runs_per_item": 0
  },
  "field_mappings": {
    "additionalProp1": "string"
  },
  "span_ids": [
    "00000000-0000-0000-0000-000000000000"
  ]
}

Responses

204No content
Documentation menu