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: QuestionPropertyBase
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, labels_order='natural', 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
|
labels_order |
str
|
str: The order of the labels in the UI. Can be either "natural" or "suggestion". Default is "natural". |
'natural'
|
Source code in src/argilla_sdk/settings/_question.py
rg.RankingQuestion
¶
Bases: QuestionPropertyBase
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: QuestionPropertyBase
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: QuestionPropertyBase
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: QuestionPropertyBase
Source code in src/argilla_sdk/settings/_question.py
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 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 |
|
__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
|