Rapidata audience
RapidataAudience #
RapidataAudience(
id: str,
name: str,
filters: list[RapidataFilter],
openapi_service: OpenAPIService,
)
Represents a Rapidata audience.
An audience is a group of annotators that can be recruited based on example tasks and assigned jobs.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
The unique identifier of the audience. |
name |
str
|
The name of the audience. |
filters |
list[RapidataFilter]
|
The list of filters applied to the audience. |
Source code in src/rapidata/rapidata_client/audience/rapidata_audience.py
delete #
Deletes the audience.
Source code in src/rapidata/rapidata_client/audience/rapidata_audience.py
update_filters #
update_filters(
filters: list[RapidataFilter],
) -> RapidataAudience
Update the filters for this audience.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filters
|
list[RapidataFilter]
|
The new list of filters to apply to the audience. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
RapidataAudience |
RapidataAudience
|
The updated audience instance (self) for method chaining. |
Source code in src/rapidata/rapidata_client/audience/rapidata_audience.py
update_name #
update_name(name: str) -> RapidataAudience
Update the name of this audience.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The new name for the audience. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
RapidataAudience |
RapidataAudience
|
The updated audience instance (self) for method chaining. |
Source code in src/rapidata/rapidata_client/audience/rapidata_audience.py
assign_job #
assign_job(
job_definition: RapidataJobDefinition,
) -> RapidataJob
Assign a job to this audience.
Creates a new job instance from the job definition and assigns it to this audience. The job will be executed by the annotators in this audience.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job_definition
|
JobDefinition
|
The job definition to create and assign to the audience. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
RapidataJob |
RapidataJob
|
The created job instance. |
Source code in src/rapidata/rapidata_client/audience/rapidata_audience.py
add_classification_example #
add_classification_example(
instruction: str,
answer_options: list[str],
datapoint: str,
truth: list[str],
data_type: Literal["media", "text"] = "media",
context: str | None = None,
media_context: str | None = None,
explanation: str | None = None,
) -> RapidataAudience
Add a classification training example to this audience.
Training examples help annotators understand the task by showing them a sample datapoint with the correct answer before they start labeling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instruction
|
str
|
The instruction for how the data should be classified. |
required |
answer_options
|
list[str]
|
The list of possible answer options for the classification. |
required |
datapoint
|
str
|
The datapoint (URL or path) to use as the training example. |
required |
truth
|
list[str]
|
The correct answer(s) for this training example. |
required |
data_type
|
Literal['media', 'text']
|
The data type of the datapoint. Defaults to "media". |
'media'
|
context
|
str
|
Additional text context to display with the example. Defaults to None. |
None
|
media_context
|
str
|
Additional media (URL or path) to display with the example. Defaults to None. |
None
|
explanation
|
str
|
An explanation of why the truth is correct. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
RapidataAudience |
RapidataAudience
|
The audience instance (self) for method chaining. |
Source code in src/rapidata/rapidata_client/audience/rapidata_audience.py
add_compare_example #
add_compare_example(
instruction: str,
truth: str,
datapoint: list[str],
data_type: Literal["media", "text"] = "media",
context: str | None = None,
media_context: str | None = None,
explanation: str | None = None,
) -> RapidataAudience
Add a comparison training example to this audience.
Training examples help annotators understand the task by showing them a sample comparison with the correct answer before they start labeling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instruction
|
str
|
The instruction for the comparison task. |
required |
truth
|
str
|
The correct answer for this training example (which option should be selected). |
required |
datapoint
|
list[str]
|
A list of exactly two datapoints (URLs or paths) to compare. |
required |
data_type
|
Literal['media', 'text']
|
The data type of the datapoints. Defaults to "media". |
'media'
|
context
|
str
|
Additional text context to display with the example. Defaults to None. |
None
|
media_context
|
str
|
Additional media (URL or path) to display with the example. Defaults to None. |
None
|
explanation
|
str
|
An explanation of why the truth is correct. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
RapidataAudience |
RapidataAudience
|
The audience instance (self) for method chaining. |
Source code in src/rapidata/rapidata_client/audience/rapidata_audience.py
find_jobs #
find_jobs(
name: str = "", amount: int = 10, page: int = 1
) -> list[RapidataJob]
Find jobs assigned to this audience.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Filter jobs by name (matching jobs will contain this string). Defaults to "" for any job. |
''
|
amount
|
int
|
The maximum number of jobs to return. Defaults to 10. |
10
|
page
|
int
|
The page of jobs to return. Defaults to 1. |
1
|
Returns:
| Type | Description |
|---|---|
list[RapidataJob]
|
list[RapidataJob]: A list of RapidataJob instances assigned to this audience. |
Source code in src/rapidata/rapidata_client/audience/rapidata_audience.py
get_examples #
Get the examples for this audience as a DataFrame.
Returns a DataFrame with columns: asset, truth, context, contextAsset. Asset URLs are fully qualified with the environment's asset host.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
amount
|
int
|
Number of examples per page. |
10
|
page
|
int
|
Page number. |
1
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
A DataFrame containing the examples. |