Toloka documentation

Task

toloka.client.task.Task | Source code

Task(
    self,
    *,
    input_values: Optional[Dict[str, Any]] = None,
    known_solutions: Optional[List[BaseTask.KnownSolution]] = None,
    message_on_unknown_solution: Optional[str] = None,
    id: Optional[str] = None,
    infinite_overlap=None,
    overlap=None,
    pool_id: Optional[str] = None,
    remaining_overlap: Optional[int] = None,
    reserved_for: Optional[List[str]] = None,
    unavailable_for: Optional[List[str]] = None,
    traits_all_of: Optional[List[str]] = None,
    traits_any_of: Optional[List[str]] = None,
    traits_none_of_any: Optional[List[str]] = None,
    origin_task_id: Optional[str] = None,
    created: Optional[datetime] = None,
    baseline_solutions: Optional[List[BaselineSolution]] = None
)

The task that will be issued to the performers

Not to be confused with TaskSuite - a set of tasks that is shown to the user at one time. TaskSuite may contain several Tasks.

Parameters Description

Parameters Type Description
input_values Optional[Dict[str, Any]]

Input data for a task. List of pairs: "<input field ID 1>": "<field value 1>", "<input field ID 1>": "<field value 2>", ... "<input field ID n>": "<field value n>"

known_solutions Optional[List[BaseTask.KnownSolution]]

Responses and hints for control tasks and training tasks. If multiple output fields are included in the validation, all combinations of the correct response must be specified.

message_on_unknown_solution Optional[str]

Hint for the task (for training tasks).

id Optional[str]

Task ID.

pool_id Optional[str]

The ID of the pool that the task is uploaded to.

remaining_overlap Optional[int]

How many times will this task be issued to performers. Read Only field.

reserved_for Optional[List[str]]

IDs of users who will have access to the task.

unavailable_for Optional[List[str]]

IDs of users who shouldn't have access to the task.

traits_all_of Optional[List[str]]

traits_any_of Optional[List[str]]

traits_none_of_any Optional[List[str]]

origin_task_id Optional[str]

ID of the task it was copied from.

created Optional[datetime]

The UTC date and time when the task was created.

baseline_solutions Optional[List[BaselineSolution]]

Preliminary responses. This data simulates performer responses when calculating confidence in a response. It is used in dynamic overlap (also known as incremental relabeling or IRL) and aggregation of results by skill.

Examples:

How to create tasks.

tasks = [
    Task(input_values={'image': 'https://some.url/my_img0001.png'}, pool_id=my_pool_id),
    Task(input_values={'image': 'https://some.url/my_img0002.png'}, pool_id=my_pool_id),
]
created_tasks = toloka_client.create_tasks(tasks, allow_defaults=True)
print(len(created_tasks.items))