Questions¶
Argilla uses questions to gather the feedback. The questions 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.
LabelQuestion
¶
Bases: QuestionBase
Source code in src/argilla/settings/_question.py
__init__(name, labels, title=None, description=None, required=True, visible_labels=None, client=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
|
The name of the question to be used as a reference. |
required |
labels |
Union[List[str], Dict[str, str]]
|
The list of available labels for the question, or a dictionary of key-value pairs where the key is the label and the value is the label name displayed in the UI. |
required |
title |
Optional[str]
|
The title of the question to be shown in the UI. |
None
|
description |
Optional[str]
|
The description of the question to be shown in the UI. |
None
|
required |
bool
|
If the question is required for a record to be valid. At least one question must be required. |
True
|
visible_labels |
Optional[int]
|
The number of visible labels for the question to be shown in the UI. Setting it to None show all options. |
None
|
Source code in src/argilla/settings/_question.py
MultiLabelQuestion
¶
Bases: LabelQuestion
Source code in src/argilla/settings/_question.py
__init__(name, labels, visible_labels=None, labels_order='natural', title=None, description=None, required=True, client=None)
¶
Create a new multi-label question for Settings
of a Dataset
. A multi-label question is a question where the user can select multiple labels from a list of available labels.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
The name of the question to be used as a reference. |
required |
labels |
Union[List[str], Dict[str, str]]
|
The list of available labels for the question, or a dictionary of key-value pairs where the key is the label and the value is the label name displayed in the UI. |
required |
visible_labels |
Optional[int]
|
The number of visible labels for the question to be shown in the UI. Setting it to None show all options. |
None
|
labels_order |
Literal['natural', 'suggestion']
|
The order of the labels in the UI. Can be either "natural" (order in which they were specified) or "suggestion" (order prioritizing those associated with a suggestion). The score of the suggestion will be taken into account for ordering if available. |
'natural'
|
title |
Optional[str]
|
The title of the question to be shown in the UI. |
None
|
description |
Optional[str]
|
The description of the question to be shown in the UI. |
None
|
required |
bool
|
If the question is required for a record to be valid. At least one question must be required. |
True
|
Source code in src/argilla/settings/_question.py
RankingQuestion
¶
Bases: QuestionBase
Source code in src/argilla/settings/_question.py
__init__(name, values, title=None, description=None, required=True, client=None)
¶
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
|
The name of the question to be used as a reference. |
required |
values |
Union[List[str], Dict[str, str]]
|
The list of options to be ranked, or a dictionary of key-value pairs where the key is the label and the value is the label name displayed in the UI. |
required |
title |
Optional[str]
|
) The title of the question to be shown in the UI. |
None
|
description |
Optional[str]
|
The description of the question to be shown in the UI. |
None
|
required |
bool
|
If the question is required for a record to be valid. At least one question must be required. |
True
|
Source code in src/argilla/settings/_question.py
TextQuestion
¶
Bases: QuestionBase
Source code in src/argilla/settings/_question.py
__init__(name, title=None, description=None, required=True, use_markdown=False, client=None)
¶
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
|
The name of the question to be used as a reference. |
required |
title |
Optional[str]
|
The title of the question to be shown in the UI. |
None
|
description |
Optional[str]
|
The description of the question to be shown in the UI. |
None
|
required |
bool
|
If the question is required for a record to be valid. At least one question must be required. |
True
|
use_markdown |
Optional[bool]
|
Whether to render the markdown in the UI. When True, you will be able to use all the Markdown features for text formatting, including LaTex formulas and embedding multimedia content and PDFs. |
False
|
Source code in src/argilla/settings/_question.py
RatingQuestion
¶
Bases: QuestionBase
Source code in src/argilla/settings/_question.py
__init__(name, values, title=None, description=None, required=True, client=None)
¶
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
|
The name of the question to be used as a reference. |
required |
values |
List[int]
|
The list of selectable values. It should be defined in the range [0, 10]. |
required |
title |
Optional[str]
|
) The title of the question to be shown in the UI. |
None
|
description |
Optional[str]
|
The description of the question to be shown in the UI. |
None
|
required |
bool
|
If the question is required for a record to be valid. At least one question must be required. |
True
|
Source code in src/argilla/settings/_question.py
SpanQuestion
¶
Bases: QuestionBase
Source code in src/argilla/settings/_question.py
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 |
|
__init__(name, field, labels, allow_overlapping=False, visible_labels=None, title=None, description=None, required=True, client=None)
¶
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
|
The name of the question to be used as a reference. |
required |
field |
str
|
The name of the text field where the span question will be applied. |
required |
labels |
Union[List[str], Dict[str, str]]
|
The list of available labels for the question, or a dictionary of key-value pairs where the key is the label and the value is the label name displayed in the UI. |
required |
allow_overlapping |
bool
|
This value specifies whether overlapped spans are allowed or not. |
False
|
visible_labels |
Optional[int]
|
The number of visible labels for the question to be shown in the UI. Setting it to None show all options. |
None
|
title |
Optional[str]
|
) The title of the question to be shown in the UI. |
None
|
description |
Optional[str]
|
The description of the question to be shown in the UI. |
None
|
required |
bool
|
If the question is required for a record to be valid. At least one question must be required. |
True
|