Skip to content

Distribution

Distribution settings are used to define the criteria used by the tool to automatically manage records in the dataset depending on the expected number of submitted responses per record.

Usage Examples

The default minimum submitted responses per record is 1. If you wish to increase this value, you can define it through the TaskDistribution class and pass it to the Settings class.

settings = rg.Settings(
    guidelines="These are some guidelines.",
    fields=[
        rg.TextField(
            name="text",
        ),
    ],
    questions=[
        rg.LabelQuestion(
            name="label",
            labels=["label_1", "label_2", "label_3"]
        ),
    ],
    distribution=rg.TaskDistribution(min_submitted=3)
)

dataset = rg.Dataset(
    name="my_dataset",
    settings=settings
)

OverlapTaskDistribution

The task distribution settings class.

This task distribution defines a number of submitted responses required to complete a record.

Parameters:

Name Type Description Default
min_submitted int

The number of min. submitted responses to complete the record

required
Source code in src/argilla/settings/_task_distribution.py
class OverlapTaskDistribution:
    """The task distribution settings class.

    This task distribution defines a number of submitted responses required to complete a record.

    Parameters:
        min_submitted (int): The number of min. submitted responses to complete the record
    """

    strategy: Literal["overlap"] = "overlap"

    def __init__(self, min_submitted: int):
        self._model = OverlapTaskDistributionModel(min_submitted=min_submitted, strategy=self.strategy)

    def __repr__(self) -> str:
        return f"OverlapTaskDistribution(min_submitted={self.min_submitted})"

    def __eq__(self, other) -> bool:
        if not isinstance(other, self.__class__):
            return False

        return self._model == other._model

    @classmethod
    def default(cls) -> "OverlapTaskDistribution":
        return cls(min_submitted=1)

    @property
    def min_submitted(self):
        return self._model.min_submitted

    @min_submitted.setter
    def min_submitted(self, value: int):
        self._model.min_submitted = value

    @classmethod
    def from_model(cls, model: OverlapTaskDistributionModel) -> "OverlapTaskDistribution":
        return cls(min_submitted=model.min_submitted)

    @classmethod
    def from_dict(cls, dict: Dict[str, Any]) -> "OverlapTaskDistribution":
        return cls.from_model(OverlapTaskDistributionModel.model_validate(dict))

    def to_dict(self):
        return self._model.model_dump()

    def _api_model(self) -> OverlapTaskDistributionModel:
        return self._model