Toloka documentation

TemplateBuilderViewSpec

toloka.client.project.view_spec.TemplateBuilderViewSpec | Source code

TemplateBuilderViewSpec(
    self,
    *,
    settings: Optional[ViewSpec.Settings] = None,
    view: Optional[BaseComponent] = None,
    plugins: Optional[List[BaseComponent]] = None,
    vars: Optional[Dict[str, Any]] = None,
    core_version: Optional[str] = '1.0.0',
    infer_data_spec: Optional[bool] = False
)

A template builder view specification that defines an interface with

template builder components

Parameters Description

Parameters Type Description
view -
plugins -
vars -
core_version Optional[str]

Default template components version. Most likely you do not need to change this parameter.

infer_data_spec Optional[bool]

You can configure the data specification automatically or manually. You can change the way the specification is configured using the infer_data_spec option:

  • True — The specifications of input and output data are generated automatically depending on the task interface settings.
  • False — You can configure the specification manually. In this case, automatic detection of input and output data doesn't work. You may need to enable this option if:
    • You don't want the specification version to be affected by changes in the instructions or other project fields.
    • You have fields that you need but they become optional or are deleted after automatic generation.

Examples:

How to declare simple interface:

import toloka.client.project.template_builder as tb
project_interface = toloka.project.view_spec.TemplateBuilderViewSpec(
    view=tb.view.ListViewV1(
        items=[header, output_field, radiobuttons],
        validation=some_validation,
    ),
    plugins=[plugin1, plugin2]
)
# add 'project_interface' to 'toloka.project.Project' instance