Export prompt and response data

How to export prompt and response data

Open this Colab for an interactive tutorial on exporting annotations.

Export JSON annotations

# Set the export params to include/exclude certain fields. Make sure each of these fields are correctly grabbed 
export_params= {
  "attachments": True,
  "metadata_fields": True,
  "data_row_details": True,
  "project_details": True,
  "label_details": True,
  "performance_details": True
}

# You can set the range for last_activity_at and label_created_at. 
# For context, last_activity_at captures the creation and modification of labels, metadata, status, comments and reviews.
# Note: This is an AND logic between the filters, so usually using one filter is sufficient.

filters= {
  "last_activity_at": ["2000-01-01 00:00:00", "2050-01-01 00:00:00"],
}

export_task = project.export_v2(params=export_params, filters=filters)
export_task.wait_till_done()

if export_task.errors:
  print(export_task.errors)

export_json = export_task.result
print("results: ", export_json)
labels = project.export_labels(download=True)

# Optionally, provide a date range as an optional parameter
# This will export only labels created between the supplied dates
# Date range can be formatted as "YYYY-MM-DD" or "YYYY-MM-DD hh:mm:ss"
labels = project.export_labels(download=True, start="2022-09-28", end="2022-10-04")

Prompt export format

Humans generate prompts

{
  "feature_id": "cldne96y301wy13yd0wp5z87y",
  "feature_schema_id": "cljg9my6h01000741aemmcln8",
  "name": "sample_name",
  "text_answer": {
    "content": "sample text"
  }
}
{
    "featureId": "cknp3dugp00073g68fkudn092",
    "schemaId": "cljg9my6h01000741aemmcln8",
    "title": "sample_name",
    "value": "sample_name",
    "answer": "sample text"
}

Response export formats

Response - Radio

{
  "feature_id": "cldne96y201wq13ydu0qcc2up",
  "feature_schema_id": "cljggfygv0chn070w1v131s3v",
  "name": "sample_radio_name",
  "radio_answer": {
    "feature_id": "cldne96y201wr13yd23kr1pcr",
    "feature_schema_id": "cljgggcs200083b6lqbpml10p",
    "name": "first_radio_answer",
    "classifications": []
  }
}
{
  "featureId": "cknp3d0hw00013g68wkjemi6o",
  "schemaId": "cknp3ctst06nq0ycte8icc2l3",
  "scope":"global",
  "title": "sample_radio_name",
  "value": "sample_radio_name",
  "answer": {
    "featureId": "cknp3d0hw00003g685c0nj5c1",
    "schemaId": "cknp3cttx06oe0yct3f0d6pmz",
    "title": "first_radio_answer",
    "value": "first_radio_answer"
  }
}

Response - Checklist

{
  "feature_id": "cldne96y201wu13ydohrclpra",
  "feature_schema_id": "cljgegd1p07m4073cfmfy5xkx",
  "name": "checklist_question",
  "checklist_answers": [
    {
      "feature_id": "cldne96y301wv13ydatuxugbt",
      "name": "first_checklist_answer",
      "classifications": []
    },
    {
      "feature_id": "cldne96y301ww13yds4zkk49u",
      "name": "second_checklist_answer",
      "classifications": []
    },
    {
      "feature_id": "cldne96y301wx13ydvb5x2w6o",
      "name": "third_checklist_answer",
      "classifications": []
    }
  ]
}
{
  "featureId": "cl89b1d3g00013b6k8388lpol",
  "schemaId": "cl89b186w0xg107xkga0fdf4j",
  "scope": "global",
  "title": "checklist_question",
  "value": "checklist_question",
  "answers": [
    {
      "featureId": "cl89b1dln00033b6ky6j9cb62",
      "schemaId": "cl89b186w0xg407xk4yvkf3o8",
      "title": "first_checklist_answer",
      "value": "first_checklist_answer",
      "position":0
    },
    {
      "featureId": "cl89b1e3z00063b6kll28e559",
      "schemaId": "cl89b186w0xg607xk8ogy304a",
      "title": "second_checklist_answer",
      "value": "second_checklist_answer",
      "position":1
    },
    {
      "featureId": "cl89b1ekd000a3b6kbiipqxi7",
      "schemaId": "cl89b186w0xg807xke5kg606w",
      "title": "third_checklist_answer",
      "value": "third_checklist_answer",
      "position":2
    }
  ]
}

Response - Text

{
  "feature_id": "cldne96y301wy13yd0wp5z87y",
  "feature_schema_id": "cljg9my6h01000741aemmcln8",
  "name": "sample_name",
  "text_answer": {
    "content": "sample text"
  }
}
{
    "featureId": "cknp3dugp00073g68fkudn092",
    "schemaId": "cknp3ctsu06nu0yctf0v5gzij",
  	"scope": "global",
    "title": "Free-form text",
    "value": "free-form_text",
  	"maxCharacters":129,
     "minCharacters":12,
    "answer": "Correct text answer"
}