Questions¶
Questions in Argilla are the questions that will be answered as feedback. They are used to define the questions that will be answered by users or models.
Usage Examples¶
To define a label question, for example, instantiate the LabelQuestion
class and pass it to the Settings
class.
label_question = rg.LabelQuestion(name="label", labels=["positive", "negative"])
settings = rg.Settings(
fields=[
rg.TextField(name="text"),
],
questions=[
label_question,
],
)
Questions can be combined in extensible ways based on the type of feedback you want to collect. For example, you can combine a label question with a text question to collect both a label and a text response.
label_question = rg.LabelQuestion(name="label", labels=["positive", "negative"])
text_question = rg.TextQuestion(name="response")
settings = rg.Settings(
fields=[
rg.TextField(name="text"),
],
questions=[
label_question,
text_question,
],
)
dataset = rg.Dataset(
name="my_dataset",
settings=settings,
)
To add records with responses to questions, refer to the
rg.Response
class documentation.
Class References¶
rg.LabelQuestion
¶
Bases: SettingsPropertyBase
Source code in src/argilla_sdk/settings/_question.py
__init__(name, labels, title=None, description=None, required=True, visible_labels=None)
¶
Define a new label question for Settings
of a Dataset
. A label question is a question where the user can select one label from a list of available labels.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
str: The name of the question to be used as a reference. |
required |
labels |
List[str]
|
List[str]: The list of available labels for the question. |
required |
title |
Optional[str]
|
Optional[str]: The title of the question to be shown in the UI. |
None
|
description |
Optional[str]
|
Optional[str]: The description of the question to be shown in the UI. |
None
|
required |
bool
|
bool: If the question is required for a record to be valid. |
True
|
visible_labels |
Optional[int]
|
Optional[int]: The number of visible labels for the question. |
None
|
Source code in src/argilla_sdk/settings/_question.py
rg.MultiLabelQuestion
¶
Bases: LabelQuestion
Source code in src/argilla_sdk/settings/_question.py
__init__(name, labels, visible_labels=None, title=None, description=None, required=True)
¶
Create a new multilabel question for Settings
of a Dataset
. A multilabel question is a question where the user can select multiple labels from a list of available labels.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
str: The name of the question to be used as a reference. |
required |
labels |
List[str]
|
List[str]: The list of available labels for the question. |
required |
title |
Optional[str]
|
Optional[str]: The title of the question to be shown in the UI. |
None
|
description |
Optional[str]
|
Optional[str]: The description of the question to be shown in the UI. |
None
|
required |
bool
|
bool: If the question is required for a record to be valid. |
True
|
visible_labels |
Optional[int]
|
Optional[int]: The number of visible labels for the question. |
None
|
Source code in src/argilla_sdk/settings/_question.py
rg.RankingQuestion
¶
Bases: SettingsPropertyBase
Source code in src/argilla_sdk/settings/_question.py
__init__(name, values, title=None, description=None, required=True)
¶
Create a new ranking question for Settings
of a Dataset
. A ranking question is a question where the user can rank a list of options.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
str: The name of the question to be used as a reference. |
required |
values |
List[str]
|
List[str]: The list of available values for the question. |
required |
title |
Optional[str]
|
Optional[str]: The title of the question to be shown in the UI. |
None
|
description |
Optional[str]
|
Optional[str]: The description of the question to be shown in the UI. |
None
|
required |
bool
|
bool: If the question is required for a record to be valid. |
True
|
Source code in src/argilla_sdk/settings/_question.py
rg.TextQuestion
¶
Bases: SettingsPropertyBase
Source code in src/argilla_sdk/settings/_question.py
__init__(name, title=None, description=None, required=True, use_markdown=False)
¶
Create a new text question for Settings
of a Dataset
. A text question is a question where the user can input text.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
str: The name of the question to be used as a reference. |
required |
title |
Optional[str]
|
Optional[str]: The title of the question to be shown in the UI. |
None
|
description |
Optional[str]
|
Optional[str]: The description of the question to be shown in the UI. |
None
|
required |
bool
|
bool: If the question is required for a record to be valid. |
True
|
use_markdown |
bool
|
bool: If the question should use markdown for the description. |
False
|
Source code in src/argilla_sdk/settings/_question.py
rg.RatingQuestion
¶
Bases: SettingsPropertyBase
Source code in src/argilla_sdk/settings/_question.py
__init__(name, values, title=None, description=None, required=True)
¶
Create a new rating question for Settings
of a Dataset
. A rating question is a question where the user can select a value from a sequential list of options.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
str: The name of the question to be used as a reference. |
required |
values |
List[int]
|
List[int]: The list of available values for the question. |
required |
title |
Optional[str]
|
Optional[str]: The title of the question to be shown in the UI. |
None
|
description |
Optional[str]
|
Optional[str]: The description of the question to be shown in the UI. |
None
|
required |
bool
|
bool: If the question is required for a record to be valid. |
True
|
Source code in src/argilla_sdk/settings/_question.py
rg.SpanQuestion
¶
Bases: SettingsPropertyBase
Source code in src/argilla_sdk/settings/_question.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
|
__init__(name, field, labels, allow_overlapping=False, visible_labels=None, title=None, description=None, required=True)
¶
Create a new span question for Settings
of a Dataset
. A span question is a question where the user can select a section of text within a text field and assign it a label.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
str: The name of the question to be used as a reference. |
required |
field |
str
|
str: The name of the text field to apply the span question to. |
required |
labels |
List[str]
|
List[str]: The list of available labels for the question. |
required |
allow_overlapping |
bool
|
bool: If the user can select overlapping spans. |
False
|
visible_labels |
Optional[int]
|
Optional[int]: The number of labels to show at once. |
None
|
title |
Optional[str]
|
Optional[str]: The title of the question to be shown in the UI. |
None
|
description |
Optional[str]
|
Optional[str]: The description of the question to be shown in the UI. |
None
|
required |
bool
|
bool: If the question is required for a record to be valid. |
True
|