Clarifai Guide
Clarifai Home
v7.2
v7.2
  • Welcome
  • Clarifai Basics
    • Build your first Clarifai App
    • Key Terminology to Know
    • Applications
      • Create an Application
      • Application Settings
      • Collaboration
    • Authentication
      • App-Specific API Keys
      • Authorize
      • Personal Access Tokens
      • Scopes
      • 2FA
      • Roll-Based Access Control
  • API Guide
    • Clarifai API Basics
      • Clarifai API Clients
        • gRPC vs HTTP Channels
      • Helpful API Resources
        • Using Postman with Clarifai APIs
    • Your Data
      • Supported Formats
      • Adding and Removing Data
      • Collectors
    • Making Predictions
      • Images
      • Video
      • Text
      • Prediction Parameters
      • Multilingual Classification
    • Creating and Managing Concepts
      • Create, Get, Update
      • Languages
      • Search by Concept
      • Knowledge Graph
    • Labeling Your Data
      • Annotations
      • Training Data
      • Positive and Negative Annotations
      • Tasks
      • Task Annotations
    • Creating and Training Models
      • Clarifai Models
      • Model Types
      • Custom Models
      • Custom Text Model
      • Create, Get, Update, Delete
      • Deep Training
    • Evaluating Models
      • Interpreting Evaluations
      • Improving Your Model
    • Creating Workflows
      • Base Workflows
      • Input Nodes
      • Setting Up Mesh Workflows
      • Common Workflows
        • Workflow Predict
        • Auto Annotation
        • Custom KNN Face Classifier Workflow
        • Visual Text Recognition
    • Search, Sort, Filter and Save
      • Search Overview
      • Combine or Negate
      • Filter
      • Rank
      • Index Images for Search
      • Legacy Search
        • Combine or Negate
        • Filter
        • Rank
        • Saved Searches
    • Advanced Topics
      • Status Codes
      • Patching
      • Pagination
      • Batch Predict CSV on Custom Text Model
  • Portal Guide
    • Clarifai Portal Basics
    • Your Data
      • Supported Formats
      • Exploring Your Data
        • Predictions
        • Annotations
        • Bulk Labeling
        • Proposals
        • Object Tracking
      • Collectors
    • Making Predictions
    • Creating and Managing Concepts
      • Create, Get, Update, Delete
      • Knowledge Graph
      • Languages
    • Labeling Your Data
      • Create a Task
      • Label Types
      • Labeling Tools
      • AI Assist
      • Workforce Management
      • Review
      • Training Data
      • Positive and Negative Annotations
    • Creating and Training Models
      • Training Basics
      • Clarifai Models
      • Custom Models
      • Model Types
      • Deep Training
    • Evaluating Models
      • Interpreting Evaluations
      • Improving Your Model
    • Creating Workflows
      • Input Nodes
      • Base Workflows
      • Setting Up a Workflow
      • Common Workflows
        • Auto Annotation
        • Visual Text Recognition
        • Text Classification
    • Search, Sort, Filter and Save
      • Rank
      • Filter
      • Combine or Negate
      • Saved Searches
      • Visual Search
      • Text Search
    • Advanced Topics
      • Importing Data with CSV and TSV Files
  • Data Labeling Services
    • Scribe LabelForce
  • Product Updates
    • Upcoming API Changes
    • Changelog
      • Release 7.3
      • Release 7.2
      • Release 7.1
      • Release 7.0
      • Release 6.11
      • Release 6.10
      • Release 6.9
      • Release 6.8
      • Release 6.7
      • Release 6.6
      • Release 6.5
      • Release 6.4
      • Release 6.3
      • Release 6.2
      • Release 6.1
      • Release 6.0
      • Release 5.11
      • Release 5.10
  • Additional Resources
    • API Status
    • Clarifai Blog
    • Clarifai Help
    • Clarifai Community
Powered by GitBook
On this page
  • Create
  • Non-Assigned Task
  • Assigned Task
  • Task with Partitioned Worker Strategy
  • Task with Consensus Review
  • Get
  • Get Task by ID
  • List All Tasks
  • List Tasks Assigned to User
  • List Tasks Assigned to User for Review
  • Update
  • Update Task
  • Delete
  • Delete Multiple Tasks

Was this helpful?

  1. API Guide
  2. Labeling Your Data

Tasks

Group your labeling work into tasks that can be delegated.

The tasks are a powerful tool which can help your team to annotate inputs from your application.

Create

To create a new task in your app you POST the task information to v2/task endpoint.

Non-Assigned Task

A task should be assigned to a list of users, but it's not required. The following code will create a non-assigned task.

curl -X POST \
  -H "Authorization: Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '
  {
      "tasks": [
          {
              "type": "CONCEPTS_CLASSIFICATION",
              "name": "Annotate {{concept_id}}",
              "worker": {
                  "strategy": "FULL"
              },
              "concept_ids": [
                  "{{concept_id}}"
              ],
              "input_source": {
                  "type": "ALL_INPUTS"
              },
              "sample_ms": 1000,
              "review": {
                  "strategy": "NONE"
              }
          }
      ]
  }'\
  https://api.clarifai.com/v2/tasks

Assigned Task

A task should be assigned to a list of users. These users will do the work, so they're also called workers. A task may also be assigned to a list of users for review.

curl -X POST \
  -H "Authorization: Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '
    {
        "tasks": [
            {
                "type": "CONCEPTS_CLASSIFICATION",
                "name": "Annotate {{concept_id}}",
                "worker": {
                    "strategy": "FULL",
                    "user_ids": [
                        "{{worker_user_id}}"
                    ]
                },
                "concept_ids": [
                    "{{concept_id}}"
                ],
                "input_source": {
                    "type": "ALL_INPUTS"
                },
                "sample_ms": 1000,
                "review": {
                    "strategy": "MANUAL",
                    "manual_strategy_info": {
                        "sample_percentage": 0.5
                    },
                    "user_ids": [
                        "{{reviewer_user_id}}"
                    ]
                }
            }
        ]
    }'\
  https://api.clarifai.com/v2/tasks

Task with Partitioned Worker Strategy

The previous tasks were created with full worker strategy.

{
    "strategy": "FULL"
}

In case of FULL worker strategy, each worker will work on all inputs selected in the input source.

If you wish the work to be distributed between workers, then you can select the PARTITIONED worker strategy.

In the following example:

  • there are two workers

  • workers_per_input: each input will be assigned to 1 worker

  • weights.{{user_id1}}: the first worker will get 90% of inputs

  • weights.{{user_id2}}: the second worker will get 10% of inputs

curl -X POST \
  -H "Authorization: Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '
    {
        "tasks": [
            {
                "type": "CONCEPTS_CLASSIFICATION",
                "name": "Annotate {{concept_id}}",
                "worker": {
                    "strategy": "PARTITIONED",
                    "user_ids": ["{{user_id1}}", "{{user_id2}}"],
                    "partitioned_strategy_info": {
                        "type": "WEIGHTED",
                        "workers_per_input": 1,
                        "weights": {
                            "{{user_id1}}": 90,
                            "{{user_id2}}": 10
                        }
                    }
                },
                "concept_ids": [
                    "{{concept_id}}"
                ],
                "input_source": {
                    "type": "ALL_INPUTS"
                },
                "sample_ms": 1000,
                "review": {
                    "strategy": "NONE"
                }
            }
        ]
    }'\
  https://api.clarifai.com/v2/tasks

Notes:

  • It is not required for the weights to add up to 100. For example, the weights [9, 1] are equivalent with weights [90, 10].

  • The partitioning is approximate. This means that the number of assigned inputs to each worker may have a small error margin, but it will be close to the assigned weight percentage.

Task with Consensus Review

The previous tasks were created with no review or manual review strategy.

{
  "strategy": "MANUAL"
}

We recommend to create tasks with CONSENSUS review strategy. When enough workers label an input in the same way, it will automatically be approved, with no need for the reviewer to spend time to check. In this way, the reviewer will be able to focus on the inputs where the workers don't agree.

Note that an approval threshold must be set. For example, in case of 3 workers and approval_threshold set to 2, if an input is labeled in the same way by 2 workers, they form a majority and the group reaches a consensus.

curl -X POST \
  -H "Authorization: Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '
    {
        "tasks": [
            {
                "type": "CONCEPTS_CLASSIFICATION",
                "name": "Annotate {{concept_id}}",
                "worker": {
                    "strategy": "PARTITIONED",
                    "user_ids": ["{{user_id1}}", "{{user_id2}}", "{{user_id3}}"],
                    "partitioned_strategy_info": {
                        "type": "WEIGHTED",
                        "workers_per_input": 1,
                        "weights": {
                            "{{user_id1}}": 1,
                            "{{user_id2}}": 1,
                            "{{user_id3}}": 1
                        }
                    }
                },
                "concept_ids": [
                    "{{concept_id}}"
                ],
                "input_source": {
                    "type": "ALL_INPUTS"
                },
                "sample_ms": 1000,
                "review": {
                    "strategy": "CONSENSUS",
                    "consensus_strategy_info": {
                        "approval_threshold": 2
                    },
                    "user_ids": [
                        "{{user_id4}}"
                    ]
                }
            }
        ]
    }'\
  https://api.clarifai.com/v2/tasks

Get

Get Task by ID

You can get a singular task by its ID. The ID was automatically generated when it was created.

curl -X GET \
  -H "Authorization: Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  https://api.clarifai.com/v2/tasks/{task_id}

List All Tasks

curl -X GET \
  -H "Authorization: Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  https://api.clarifai.com/v2/tasks

List Tasks Assigned to User

Get only the tasks assigned to a specific user for work.

curl -X GET \
  -H "Authorization: Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  https://api.clarifai.com/v2/tasks?worker_user_ids={{user_id}}

List Tasks Assigned to User for Review

Get only the tasks assigned to a specific user for review.

curl -X GET \
  -H "Authorization: Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  https://api.clarifai.com/v2/tasks?review_user_ids={{user_id}}

Update

Currently, we only support updating a task by providing all information at once.

Update Task

curl -X PATCH \
  -H "Authorization: Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '
    {
        "action": "overwrite",
        "tasks": [
            {
                "id": "{{task_id}}",
                "type": "CONCEPTS_CLASSIFICATION",
                "name": "Annotate {{concept_id}}",
                "worker": {
                    "strategy": "PARTITIONED",
                    "user_ids": ["{{user_id1}}", "{{user_id2}}"],
                    "partitioned_strategy_info": {
                        "type": "WEIGHTED",
                        "workers_per_input": 1,
                        "weights": {
                            "{{user_id1}}": 1,
                            "{{user_id2}}": 1
                        }
                    }
                },
                "concept_ids": [
                    "{{concept_id}}"
                ],
                "input_source": {
                    "type": "ALL_INPUTS"
                },
                "sample_ms": 1000,
                "review": {
                    "strategy": "CONSENSUS",
                    "consensus_strategy_info": {
                        "approval_threshold": 2
                    },
                    "user_ids": [
                        "{{user_id3}}"
                    ]
                },
                "status": {
                    "code": "TASK_DONE"
                }
            }
        ]
    }'\
  https://api.clarifai.com/v2/tasks

Delete

Delete Multiple Tasks

You can delete tasks using their IDs.

curl -X DELETE \
  -H "Authorization: Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '
    {
        "ids":["{{task_id}}"]
    }'\
  https://api.clarifai.com/v2/tasks
PreviousPositive and Negative AnnotationsNextTask Annotations

Last updated 4 years ago

Was this helpful?

You can get a list of tasks within your app with a GET call. This call supports .

pagination