Programmatically Label and Review
You can use the RedBrick AI SDK to programmatically label and review your data. If you have an automated method of generating labels / reviews, or want to update tasks in bulk, this is a good option.

Programmatically Label

Perform the standard SDK set up to create a RBProject object.
1
import redbrick
2
3
api_key = "<TODO>"
4
org_id = "<TODO>"
5
project_id = "<TODO>"
6
stage_name = "<TODO>"
7
8
project = redbrick.get_project(
9
org_id=org_id,
10
project_id=project_id,
11
api_key=api_key
12
)
Copied!
Get tasks from your RedBrick AI project. You can find the stage_name on the workflow visualization on the project dashboard.
Please see the format of TaskObject in the reference documentation.
1
# We recommend keeping the count < 50
2
tasks = project.label.get_tasks(stage_name, count=1)
Copied!
Add labels to the task entries in the tasks object above.
1
# Replace this code with your method of adding labels and creating
2
# the tasks_labeled list.
3
4
tasks_labeled = []
5
for task in tasks:
6
tasks_labeled += [
7
{
8
"taskId": task["taskId"],
9
"labels": task["labels"]
10
}
11
]
Copied!
Upload the labeled tasks to RedBrick AI
1
project.labeling.put_tasks(stage_name, tasks_labeled)
Copied!

Programmatically Review

Get review tasks from the RedBrick Ai platform.
You can find the stage_name from the workflow visualization on the project overview dashboard.
1
# We recommend keeping count < 50
2
tasks = project.review.get_tasks(stage_name, count=1)
Copied!
Please see the format of TaskObject in the reference documentation.
Review the tasks programmatically and upload
1
# Replace with your own logic for reviewing tasks
2
tasks_reviewed = []
3
for task in tasks:
4
tasks_reviewed += [
5
{"taskId": task["taskId"], "reviewVal": True} # reviewVal True accepts the task
6
# False will fail.
7
]
8
9
project.review.put_tasks(stage_name, tasks_reviewed)
Copied!
Last modified 1mo ago