Export LLM human preference annotations

How to export LLM human preference annotations and sample export formats.

πŸ“˜

Deprecating Export V1

Starting in April 2024, we will begin sunsetting Export V1 for customers on a rolling basis. For more details, see this guide.

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")

Annotation export formats

Classification - Radio

{
		"feature_id": "clp8gzc7a000h07iu2uqcfziq",
		"feature_schema_id": "clp8fepqc02nd071phl4tck59",
		"name": "Choose the best response",
		"radio_answer": {
				"feature_id": "clp8gzc7a000i07iu46z39uwl",
				"feature_schema_id": "clp8fepqc02ng071p9ufm76xj",
				"name": "Response B",
				"classifications": []
		}
}

Classification - Free-form text

{
    "feature_id": "clph8rvw700013b6pbsq1lwcg",
    "feature_schema_id": "clp8fepqc02nl071p8z948pd4",
    "name": "Provide a reason for your choice",
    "text_answer": {
        "content": "Clear recommendation"
    }
}

Classification - Checklist

{
    "feature_id": "clpiyav9m00053b6mpe2qk0im",
    "feature_schema_id": "clpiya8h507dx072efo9kb97j",
    "name": "Evaluations done",
    "checklist_answers": [
        {
            "feature_id": "clpiyav9m00043b6mvhur1p19",
            "name": "Usefulness",
            "classifications": []
        },
        {
            "feature_id": "clpiyax4d00073b6mqyyt0504",
            "name": "Toxicity",
            "classifications": []
        }
    ]
}

Sample project export

{
    "data_row": {
        "id": "clpiqgsvn4lxr079096g5mt9v",
        "global_key": "0914c7da-5999-464b-b621-054a5247cf48",
        "row_data": "https://storage.googleapis.com/labelbox-developer-testing-assets/Pranoy/shopping_3.json",
        "details": {
            "dataset_id": "clpiqgrsr00f60737sqeiaf4v",
            "dataset_name": "pairwise_demo_42454af2-b7b5-45c0-a25a-90f97efd49be",
            "created_at": "2023-11-28T19:30:49.729+00:00",
            "updated_at": "2023-11-28T19:30:50.609+00:00",
            "last_activity_at": "2023-11-28T23:11:08.000+00:00",
            "created_by": "[email protected]"
        }
    },
    "media_attributes": {
        "mime_type": "application/vnd.labelbox.conversational",
        "labelable_ids": [
            "message-1",
            "message-3"
        ],
        "message_count": 4
    },
    "attachments": [],
    "metadata_fields": [],
    "projects": {
        "clpiy2itz08vg0705akh60zc1": {
            "name": "Test LLM Human Preference",
            "labels": [
                {
                    "label_kind": "Default",
                    "version": "1.0.0",
                    "id": "clpiyah63071f07e4756yer2d",
                    "label_details": {
                        "created_at": "2023-11-28T23:11:08.000+00:00",
                        "updated_at": "2023-11-28T23:11:07.000+00:00",
                        "created_by": "[email protected]",
                        "content_last_updated_at": "2023-11-28T23:11:07.568+00:00",
                        "reviews": []
                    },
                    "annotations": {
                        "objects": [],
                        "classifications": [
                            {
                                "feature_id": "clpiybl7h000g3b6mil1amjme",
                                "feature_schema_id": "clpiqh0v104mq0729homqffup",
                                "name": "Choose the best response",
                                "radio_answer": {
                                    "feature_id": "clpiybl7h000f3b6m03fn8ry3",
                                    "feature_schema_id": "clpiqh0v104mt0729atflgvvw",
                                    "name": "Response B",
                                    "classifications": []
                                }
                            },
                            {
                                "feature_id": "clpiybzp3000h3b6m9uowaci4",
                                "feature_schema_id": "clpiqh0v104my072907gt7id0",
                                "name": "Provide a reason for your choice",
                                "text_answer": {
                                    "content": "Direct approach that is convenient"
                                }
                            },
                            {
                                "feature_id": "clpiyc10q000j3b6m01i2d1pv",
                                "feature_schema_id": "clpiya8h507dx072efo9kb97j",
                                "name": "Evaluations done",
                                "checklist_answers": [
                                    {
                                        "feature_id": "clpiyc10q000i3b6mhhvhdzqs",
                                        "name": "Relevance",
                                        "classifications": []
                                    },
                                    {
                                        "feature_id": "clpiyc1ie000l3b6m3kpff0lp",
                                        "name": "Usefulness",
                                        "classifications": []
                                    }
                                ]
                            }
                        ],
                        "relationships": []
                    }
                }
            ],
            "project_details": {
                "ontology_id": "clpiqh0ud04mp0729adeoccsl",
                "task_id": "33e77b4d-424f-49ba-8792-628c1cb746b7",
                "task_name": "Initial review task",
                "batch_id": "66882c10-8e42-11ee-8f8d-71857f06db2f",
                "batch_name": "test_llm_human_preference_batch_1",
                "workflow_status": "IN_REVIEW",
                "priority": 5,
                "consensus_expected_label_count": 1,
                "workflow_history": [
                    {
                        "action": "Move",
                        "created_at": "2023-11-28T23:11:07.654+00:00",
                        "created_by": "[email protected]",
                        "previous_task_name": "Initial labeling task",
                        "previous_task_id": "8f9917a7-6030-0914-befc-ac06f59a7ec9",
                        "next_task_name": "Initial review task",
                        "next_task_id": "33e77b4d-424f-49ba-8792-628c1cb746b7"
                    },
                    {
                        "action": "Move",
                        "created_at": "2023-11-28T23:11:07.631+00:00",
                        "created_by": "[email protected]",
                        "next_task_name": "Initial labeling task",
                        "next_task_id": "8f9917a7-6030-0914-befc-ac06f59a7ec9"
                    }
                ]
            }
        }
    }
}