label-studio-sdk 1.0.20__py3-none-any.whl → 2.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of label-studio-sdk might be problematic. Click here for more details.

Files changed (421) hide show
  1. label_studio_sdk/__init__.py +345 -180
  2. label_studio_sdk/actions/__init__.py +4 -0
  3. label_studio_sdk/actions/client.py +46 -10
  4. label_studio_sdk/actions/types/__init__.py +4 -0
  5. label_studio_sdk/actions/types/actions_create_request_filters.py +2 -2
  6. label_studio_sdk/actions/types/actions_create_request_filters_items_item.py +2 -2
  7. label_studio_sdk/actions/types/actions_create_request_id.py +7 -7
  8. label_studio_sdk/actions/types/actions_create_request_selected_items_excluded.py +2 -2
  9. label_studio_sdk/actions/types/actions_create_request_selected_items_included.py +2 -2
  10. label_studio_sdk/actions/types/actions_list_response_item.py +25 -0
  11. label_studio_sdk/actions/types/actions_list_response_item_dialog.py +22 -0
  12. label_studio_sdk/annotations/__init__.py +2 -2
  13. label_studio_sdk/annotations/client.py +379 -243
  14. label_studio_sdk/annotations/types/__init__.py +4 -2
  15. label_studio_sdk/annotations/types/annotation_bulk_serializer_with_selected_items_request_last_action.py +7 -0
  16. label_studio_sdk/annotations/types/annotations_create_bulk_response_item.py +8 -5
  17. label_studio_sdk/base_client.py +32 -24
  18. label_studio_sdk/billing/__init__.py +2 -0
  19. label_studio_sdk/billing/client.py +112 -0
  20. label_studio_sdk/comments/client.py +378 -140
  21. label_studio_sdk/converter/README.md +207 -0
  22. label_studio_sdk/converter/imports/coco.py +132 -23
  23. label_studio_sdk/core/__init__.py +4 -0
  24. label_studio_sdk/core/unchecked_base_model.py +305 -0
  25. label_studio_sdk/environment.py +1 -1
  26. label_studio_sdk/errors/__init__.py +10 -1
  27. label_studio_sdk/errors/forbidden_error.py +9 -0
  28. label_studio_sdk/errors/method_not_allowed_error.py +9 -0
  29. label_studio_sdk/export_storage/__init__.py +1 -24
  30. label_studio_sdk/export_storage/azure/__init__.py +0 -3
  31. label_studio_sdk/export_storage/azure/client.py +231 -273
  32. label_studio_sdk/export_storage/client.py +5 -5
  33. label_studio_sdk/export_storage/gcs/__init__.py +0 -3
  34. label_studio_sdk/export_storage/gcs/client.py +231 -273
  35. label_studio_sdk/export_storage/local/__init__.py +0 -3
  36. label_studio_sdk/export_storage/local/client.py +211 -253
  37. label_studio_sdk/export_storage/redis/__init__.py +0 -3
  38. label_studio_sdk/export_storage/redis/client.py +239 -281
  39. label_studio_sdk/export_storage/s3/__init__.py +0 -3
  40. label_studio_sdk/export_storage/s3/client.py +254 -296
  41. label_studio_sdk/export_storage/s3s/client.py +694 -210
  42. label_studio_sdk/export_storage/types/export_storage_list_types_response_item.py +2 -2
  43. label_studio_sdk/files/client.py +52 -71
  44. label_studio_sdk/import_storage/__init__.py +1 -24
  45. label_studio_sdk/import_storage/azure/__init__.py +0 -3
  46. label_studio_sdk/import_storage/azure/client.py +249 -299
  47. label_studio_sdk/import_storage/client.py +5 -5
  48. label_studio_sdk/import_storage/gcs/__init__.py +0 -3
  49. label_studio_sdk/import_storage/gcs/client.py +249 -299
  50. label_studio_sdk/import_storage/local/__init__.py +0 -3
  51. label_studio_sdk/import_storage/local/client.py +211 -257
  52. label_studio_sdk/import_storage/redis/__init__.py +0 -3
  53. label_studio_sdk/import_storage/redis/client.py +239 -285
  54. label_studio_sdk/import_storage/s3/__init__.py +0 -3
  55. label_studio_sdk/import_storage/s3/client.py +274 -324
  56. label_studio_sdk/import_storage/s3s/client.py +728 -434
  57. label_studio_sdk/import_storage/types/import_storage_list_types_response_item.py +2 -2
  58. label_studio_sdk/jwt_settings/client.py +56 -58
  59. label_studio_sdk/label_interface/control_tags.py +48 -8
  60. label_studio_sdk/label_interface/interface.py +261 -56
  61. label_studio_sdk/ml/__init__.py +2 -16
  62. label_studio_sdk/ml/client.py +196 -179
  63. label_studio_sdk/ml/types/__init__.py +2 -12
  64. label_studio_sdk/ml/types/ml_list_model_versions_response.py +20 -0
  65. label_studio_sdk/model_providers/__init__.py +3 -0
  66. label_studio_sdk/model_providers/client.py +280 -228
  67. label_studio_sdk/model_providers/types/__init__.py +5 -0
  68. label_studio_sdk/{prompts/types/prompts_batch_predictions_response.py → model_providers/types/model_providers_list_model_provider_choices_response.py} +3 -3
  69. label_studio_sdk/organizations/__init__.py +5 -0
  70. label_studio_sdk/organizations/client.py +331 -0
  71. label_studio_sdk/organizations/members/__init__.py +2 -0
  72. label_studio_sdk/organizations/members/client.py +636 -0
  73. label_studio_sdk/predictions/client.py +29 -77
  74. label_studio_sdk/projects/__init__.py +18 -9
  75. label_studio_sdk/projects/client.py +905 -414
  76. label_studio_sdk/projects/exports/__init__.py +2 -2
  77. label_studio_sdk/projects/exports/client.py +336 -396
  78. label_studio_sdk/projects/exports/client_ext.py +30 -30
  79. label_studio_sdk/projects/exports/types/__init__.py +1 -2
  80. label_studio_sdk/projects/exports/types/exports_convert_response.py +5 -9
  81. label_studio_sdk/projects/pauses/client.py +114 -105
  82. label_studio_sdk/projects/stats/__init__.py +5 -0
  83. label_studio_sdk/projects/stats/client.py +175 -0
  84. label_studio_sdk/projects/stats/types/__init__.py +8 -0
  85. label_studio_sdk/projects/stats/types/stats_iaa_response.py +44 -0
  86. label_studio_sdk/projects/stats/types/stats_iaa_response_common_tasks.py +7 -0
  87. label_studio_sdk/projects/stats/types/stats_iaa_response_iaa.py +5 -0
  88. label_studio_sdk/{types/base_task_file_upload.py → projects/stats/types/stats_iaa_response_std.py} +1 -1
  89. label_studio_sdk/projects/types/__init__.py +10 -6
  90. label_studio_sdk/projects/types/lse_project_create_request_sampling.py +7 -0
  91. label_studio_sdk/projects/types/lse_project_create_request_skip_queue.py +7 -0
  92. label_studio_sdk/projects/types/patched_lse_project_update_request_sampling.py +7 -0
  93. label_studio_sdk/projects/types/patched_lse_project_update_request_skip_queue.py +7 -0
  94. label_studio_sdk/{prompts/types/prompts_batch_failed_predictions_response.py → projects/types/projects_duplicate_response.py} +8 -5
  95. label_studio_sdk/projects/types/projects_import_tasks_response.py +2 -2
  96. label_studio_sdk/projects/types/projects_list_request_filter.py +1 -1
  97. label_studio_sdk/prompts/__init__.py +4 -10
  98. label_studio_sdk/prompts/client.py +511 -442
  99. label_studio_sdk/prompts/indicators/__init__.py +3 -0
  100. label_studio_sdk/prompts/indicators/client.py +47 -49
  101. label_studio_sdk/prompts/indicators/types/__init__.py +5 -0
  102. label_studio_sdk/{types/key_indicator_value.py → prompts/indicators/types/indicators_list_response_item.py} +3 -3
  103. label_studio_sdk/prompts/runs/client.py +113 -135
  104. label_studio_sdk/prompts/types/__init__.py +2 -12
  105. label_studio_sdk/prompts/types/prompts_compatible_projects_request_project_type.py +7 -0
  106. label_studio_sdk/prompts/versions/client.py +372 -312
  107. label_studio_sdk/tasks/__init__.py +2 -2
  108. label_studio_sdk/tasks/client.py +514 -213
  109. label_studio_sdk/tasks/types/__init__.py +1 -2
  110. label_studio_sdk/tokens/client.py +160 -152
  111. label_studio_sdk/tokens/client_ext.py +3 -3
  112. label_studio_sdk/types/__init__.py +276 -142
  113. label_studio_sdk/{webhooks/types/webhooks_update_request_actions_item.py → types/actions_enum.py} +4 -1
  114. label_studio_sdk/types/all_roles_project_list.py +197 -0
  115. label_studio_sdk/types/all_roles_project_list_sampling.py +7 -0
  116. label_studio_sdk/types/all_roles_project_list_skip_queue.py +7 -0
  117. label_studio_sdk/types/annotated_enum.py +5 -0
  118. label_studio_sdk/types/annotation.py +24 -10
  119. label_studio_sdk/types/annotation_last_action.py +3 -15
  120. label_studio_sdk/types/{annotations_dm_field.py → annotation_request.py} +21 -30
  121. label_studio_sdk/types/annotation_request_last_action.py +7 -0
  122. label_studio_sdk/types/assignment_settings.py +31 -0
  123. label_studio_sdk/types/assignment_settings_label_stream_task_distribution.py +7 -0
  124. label_studio_sdk/types/assignment_settings_request.py +32 -0
  125. label_studio_sdk/types/assignment_settings_request_label_stream_task_distribution.py +7 -0
  126. label_studio_sdk/types/associated_project.py +30 -0
  127. label_studio_sdk/types/auth_method_enum.py +5 -0
  128. label_studio_sdk/types/azure_blob_export_storage.py +8 -12
  129. label_studio_sdk/types/azure_blob_import_storage.py +8 -12
  130. label_studio_sdk/types/{prompt_associated_projects_item_id.py → batch_failed_predictions.py} +4 -4
  131. label_studio_sdk/types/{access_token_response.py → batch_predictions.py} +6 -8
  132. label_studio_sdk/types/billing_checks.py +39 -0
  133. label_studio_sdk/types/billing_flags.py +44 -0
  134. label_studio_sdk/types/billing_info_response.py +22 -0
  135. label_studio_sdk/types/blank_enum.py +5 -0
  136. label_studio_sdk/types/{key_indicators_item_extra_kpis_item.py → blueprint_list.py} +12 -6
  137. label_studio_sdk/types/budget_reset_period_enum.py +5 -0
  138. label_studio_sdk/types/child_filter.py +44 -0
  139. label_studio_sdk/types/comment.py +39 -14
  140. label_studio_sdk/types/comment_request.py +32 -0
  141. label_studio_sdk/types/comment_serializer_with_expanded_user.py +53 -0
  142. label_studio_sdk/types/converted_format.py +5 -5
  143. label_studio_sdk/types/{api_token_response.py → converted_format_request.py} +8 -15
  144. label_studio_sdk/types/count_limit.py +22 -0
  145. label_studio_sdk/types/custom_scripts_editable_by_enum.py +5 -0
  146. label_studio_sdk/types/default_role_enum.py +5 -0
  147. label_studio_sdk/types/edition_enum.py +5 -0
  148. label_studio_sdk/types/export.py +7 -7
  149. label_studio_sdk/types/file_upload.py +5 -5
  150. label_studio_sdk/types/filter.py +9 -6
  151. label_studio_sdk/types/filter_group.py +3 -3
  152. label_studio_sdk/types/finished_enum.py +5 -0
  153. label_studio_sdk/types/gcs_export_storage.py +8 -12
  154. label_studio_sdk/types/gcs_import_storage.py +8 -12
  155. label_studio_sdk/types/{rotate_token_response.py → hotkeys.py} +5 -8
  156. label_studio_sdk/types/{base_task.py → import_api_request.py} +11 -34
  157. label_studio_sdk/types/inference_run_cost_estimate.py +2 -2
  158. label_studio_sdk/types/label_stream_task_distribution_enum.py +5 -0
  159. label_studio_sdk/types/{annotations_dm_field_last_action.py → last_action_enum.py} +1 -1
  160. label_studio_sdk/types/local_files_export_storage.py +8 -12
  161. label_studio_sdk/types/local_files_import_storage.py +8 -12
  162. label_studio_sdk/types/{annotation_filter_options.py → lse_annotation_filter_options.py} +12 -2
  163. label_studio_sdk/types/lse_annotation_filter_options_request.py +42 -0
  164. label_studio_sdk/types/lse_annotation_filter_options_request_reviewed.py +7 -0
  165. label_studio_sdk/types/lse_annotation_filter_options_reviewed.py +7 -0
  166. label_studio_sdk/types/{export_snapshot.py → lse_export_create.py} +11 -11
  167. label_studio_sdk/types/lse_fields.py +49 -0
  168. label_studio_sdk/types/lse_fields_onboarding_state.py +8 -0
  169. label_studio_sdk/types/lse_fields_trial_role.py +8 -0
  170. label_studio_sdk/types/lse_key_indicator_value.py +35 -0
  171. label_studio_sdk/types/lse_organization.py +57 -0
  172. label_studio_sdk/types/lse_organization_custom_scripts_editable_by.py +7 -0
  173. label_studio_sdk/types/{key_indicators_item_additional_kpis_item.py → lse_organization_member_list.py} +12 -7
  174. label_studio_sdk/types/lse_project_create.py +196 -0
  175. label_studio_sdk/types/lse_project_create_sampling.py +7 -0
  176. label_studio_sdk/types/lse_project_create_skip_queue.py +7 -0
  177. label_studio_sdk/types/lse_project_update.py +215 -0
  178. label_studio_sdk/types/lse_project_update_sampling.py +7 -0
  179. label_studio_sdk/types/lse_project_update_skip_queue.py +7 -0
  180. label_studio_sdk/types/lse_s3export_storage.py +134 -0
  181. label_studio_sdk/{import_storage/s3/types/s3create_response.py → types/lse_s3export_storage_request.py} +47 -21
  182. label_studio_sdk/{import_storage/s3/types/s3update_response.py → types/lse_s3import_storage.py} +60 -21
  183. label_studio_sdk/types/{s3s_import_storage.py → lse_s3import_storage_request.py} +32 -21
  184. label_studio_sdk/types/lse_task.py +117 -0
  185. label_studio_sdk/types/{data_manager_task_serializer_drafts_item.py → lse_task_drafts_item.py} +2 -2
  186. label_studio_sdk/types/lse_task_filter_options.py +63 -0
  187. label_studio_sdk/types/lse_task_filter_options_annotated.py +7 -0
  188. label_studio_sdk/types/lse_task_filter_options_finished.py +7 -0
  189. label_studio_sdk/types/lse_task_filter_options_request.py +63 -0
  190. label_studio_sdk/types/lse_task_filter_options_request_annotated.py +7 -0
  191. label_studio_sdk/types/lse_task_filter_options_request_finished.py +7 -0
  192. label_studio_sdk/types/lse_task_filter_options_request_reviewed.py +7 -0
  193. label_studio_sdk/types/lse_task_filter_options_request_skipped.py +7 -0
  194. label_studio_sdk/types/lse_task_filter_options_reviewed.py +7 -0
  195. label_studio_sdk/types/lse_task_filter_options_skipped.py +7 -0
  196. label_studio_sdk/types/{data_manager_task_serializer_predictions_item.py → lse_task_predictions_item.py} +4 -5
  197. label_studio_sdk/types/lse_task_serializer_for_annotators.py +54 -0
  198. label_studio_sdk/types/lse_task_serializer_for_annotators_drafts_item.py +22 -0
  199. label_studio_sdk/types/lse_task_serializer_for_annotators_predictions_item.py +28 -0
  200. label_studio_sdk/types/lse_task_serializer_for_reviewers.py +117 -0
  201. label_studio_sdk/types/lse_task_serializer_for_reviewers_drafts_item.py +22 -0
  202. label_studio_sdk/types/lse_task_serializer_for_reviewers_predictions_item.py +28 -0
  203. label_studio_sdk/types/lse_user.py +49 -0
  204. label_studio_sdk/types/{base_user.py → lse_user_api.py} +17 -6
  205. label_studio_sdk/types/lse_user_organization_member_list.py +48 -0
  206. label_studio_sdk/types/lseapi_token_create.py +21 -0
  207. label_studio_sdk/types/lseapi_token_list.py +21 -0
  208. label_studio_sdk/types/lsejwt_settings.py +32 -0
  209. label_studio_sdk/types/maybe_expanded_comment.py +7 -0
  210. label_studio_sdk/types/ml_backend.py +16 -17
  211. label_studio_sdk/types/mode_enum.py +5 -0
  212. label_studio_sdk/types/model_interface.py +44 -0
  213. label_studio_sdk/types/model_interface_request.py +40 -0
  214. label_studio_sdk/types/model_interface_serializer_get.py +45 -0
  215. label_studio_sdk/types/model_provider_connection.py +48 -17
  216. label_studio_sdk/types/model_provider_connection_budget_reset_period.py +3 -1
  217. label_studio_sdk/types/model_provider_connection_request.py +71 -0
  218. label_studio_sdk/types/model_run.py +40 -0
  219. label_studio_sdk/types/{inference_run_status.py → model_run_status_enum.py} +1 -1
  220. label_studio_sdk/types/null_enum.py +3 -0
  221. label_studio_sdk/types/onboarding_state_enum.py +7 -0
  222. label_studio_sdk/types/organization_billing.py +20 -0
  223. label_studio_sdk/types/organization_id.py +28 -0
  224. label_studio_sdk/types/organization_invite.py +20 -0
  225. label_studio_sdk/types/organization_member.py +37 -0
  226. label_studio_sdk/types/organization_membership.py +24 -0
  227. label_studio_sdk/{projects/types/projects_list_response.py → types/paginated_all_roles_project_list_list.py} +5 -5
  228. label_studio_sdk/types/paginated_lse_organization_member_list_list.py +23 -0
  229. label_studio_sdk/types/{jwt_settings_response.py → paginated_role_based_task_list.py} +11 -9
  230. label_studio_sdk/types/pause.py +55 -14
  231. label_studio_sdk/types/pause_request.py +41 -0
  232. label_studio_sdk/types/prediction.py +7 -11
  233. label_studio_sdk/types/prediction_request.py +56 -0
  234. label_studio_sdk/types/project.py +32 -39
  235. label_studio_sdk/types/project_import.py +12 -13
  236. label_studio_sdk/types/project_label_config.py +2 -2
  237. label_studio_sdk/types/project_label_config_request.py +22 -0
  238. label_studio_sdk/types/project_sampling.py +3 -3
  239. label_studio_sdk/types/project_skip_queue.py +3 -1
  240. label_studio_sdk/types/project_subset_enum.py +5 -0
  241. label_studio_sdk/types/prompts_status_enum.py +16 -0
  242. label_studio_sdk/types/{prompt_version_provider.py → provider_enum.py} +1 -1
  243. label_studio_sdk/types/reason_enum.py +7 -0
  244. label_studio_sdk/types/redis_export_storage.py +8 -12
  245. label_studio_sdk/types/redis_import_storage.py +8 -12
  246. label_studio_sdk/types/refined_prompt_response.py +5 -6
  247. label_studio_sdk/types/requeue_rejected_tasks_mode_enum.py +5 -0
  248. label_studio_sdk/types/review_criteria_enum.py +5 -0
  249. label_studio_sdk/types/review_settings.py +80 -0
  250. label_studio_sdk/types/review_settings_request.py +80 -0
  251. label_studio_sdk/types/review_settings_request_requeue_rejected_tasks_mode.py +8 -0
  252. label_studio_sdk/types/review_settings_request_review_criteria.py +7 -0
  253. label_studio_sdk/types/review_settings_requeue_rejected_tasks_mode.py +8 -0
  254. label_studio_sdk/types/review_settings_review_criteria.py +7 -0
  255. label_studio_sdk/types/reviewed_enum.py +5 -0
  256. label_studio_sdk/types/role9e7enum.py +5 -0
  257. label_studio_sdk/types/role_based_task.py +8 -0
  258. label_studio_sdk/types/s3export_storage.py +8 -12
  259. label_studio_sdk/types/s3import_storage.py +8 -12
  260. label_studio_sdk/types/sampling_enum.py +7 -0
  261. label_studio_sdk/types/scope_enum.py +5 -0
  262. label_studio_sdk/types/selected_items_request.py +23 -0
  263. label_studio_sdk/types/serialization_option.py +2 -6
  264. label_studio_sdk/types/serialization_option_request.py +22 -0
  265. label_studio_sdk/types/serialization_options.py +17 -5
  266. label_studio_sdk/types/serialization_options_request.py +47 -0
  267. label_studio_sdk/types/skill_name_enum.py +5 -0
  268. label_studio_sdk/types/skip_queue_enum.py +5 -0
  269. label_studio_sdk/types/skipped_enum.py +5 -0
  270. label_studio_sdk/types/state_enum.py +5 -0
  271. label_studio_sdk/types/status7bf_enum.py +5 -0
  272. label_studio_sdk/types/{azure_blob_import_storage_status.py → status_c5a_enum.py} +2 -2
  273. label_studio_sdk/types/third_party_model_version.py +65 -0
  274. label_studio_sdk/types/third_party_model_version_request.py +54 -0
  275. label_studio_sdk/types/token_refresh_response.py +19 -0
  276. label_studio_sdk/types/token_rotate_response.py +19 -0
  277. label_studio_sdk/types/trial_role_enum.py +16 -0
  278. label_studio_sdk/types/user_simple.py +8 -5
  279. label_studio_sdk/types/user_simple_request.py +28 -0
  280. label_studio_sdk/types/version_response.py +49 -0
  281. label_studio_sdk/types/view.py +8 -15
  282. label_studio_sdk/types/webhook.py +9 -13
  283. label_studio_sdk/types/webhook_serializer_for_update.py +15 -13
  284. label_studio_sdk/types/workspace.py +14 -34
  285. label_studio_sdk/types/workspace_member_create.py +27 -0
  286. label_studio_sdk/types/workspace_member_list.py +24 -0
  287. label_studio_sdk/users/client.py +604 -87
  288. label_studio_sdk/users/types/users_get_token_response.py +4 -11
  289. label_studio_sdk/users/types/users_reset_token_response.py +4 -11
  290. label_studio_sdk/versions/__init__.py +0 -3
  291. label_studio_sdk/versions/client.py +14 -14
  292. label_studio_sdk/views/client.py +227 -141
  293. label_studio_sdk/views/types/views_create_request_data.py +2 -2
  294. label_studio_sdk/views/types/views_create_request_data_filters.py +2 -2
  295. label_studio_sdk/views/types/views_create_request_data_filters_items_item.py +2 -2
  296. label_studio_sdk/views/types/views_update_request_data.py +2 -2
  297. label_studio_sdk/views/types/views_update_request_data_filters.py +2 -2
  298. label_studio_sdk/views/types/views_update_request_data_filters_items_item.py +2 -2
  299. label_studio_sdk/webhooks/__init__.py +36 -2
  300. label_studio_sdk/webhooks/client.py +173 -367
  301. label_studio_sdk/webhooks/types/__init__.py +34 -2
  302. label_studio_sdk/webhooks/types/webhooks_info_response.py +80 -0
  303. label_studio_sdk/webhooks/types/webhooks_info_response_annotation_created.py +24 -0
  304. label_studio_sdk/webhooks/types/webhooks_info_response_annotation_updated.py +24 -0
  305. label_studio_sdk/webhooks/types/webhooks_info_response_annotations_created.py +24 -0
  306. label_studio_sdk/webhooks/types/webhooks_info_response_annotations_deleted.py +24 -0
  307. label_studio_sdk/webhooks/types/webhooks_info_response_label_link_created.py +24 -0
  308. label_studio_sdk/webhooks/types/webhooks_info_response_label_link_deleted.py +24 -0
  309. label_studio_sdk/webhooks/types/webhooks_info_response_label_link_updated.py +24 -0
  310. label_studio_sdk/webhooks/types/webhooks_info_response_project_created.py +24 -0
  311. label_studio_sdk/webhooks/types/webhooks_info_response_project_deleted.py +24 -0
  312. label_studio_sdk/webhooks/types/webhooks_info_response_project_updated.py +24 -0
  313. label_studio_sdk/webhooks/types/webhooks_info_response_review_created.py +24 -0
  314. label_studio_sdk/webhooks/types/webhooks_info_response_review_updated.py +24 -0
  315. label_studio_sdk/webhooks/types/webhooks_info_response_reviews_deleted.py +24 -0
  316. label_studio_sdk/webhooks/types/webhooks_info_response_tasks_created.py +24 -0
  317. label_studio_sdk/webhooks/types/webhooks_info_response_tasks_deleted.py +24 -0
  318. label_studio_sdk/workspaces/__init__.py +1 -2
  319. label_studio_sdk/workspaces/client.py +97 -117
  320. label_studio_sdk/workspaces/members/__init__.py +0 -3
  321. label_studio_sdk/workspaces/members/client.py +65 -81
  322. {label_studio_sdk-1.0.20.dist-info → label_studio_sdk-2.0.1.dist-info}/METADATA +73 -25
  323. label_studio_sdk-2.0.1.dist-info/RECORD +435 -0
  324. {label_studio_sdk-1.0.20.dist-info → label_studio_sdk-2.0.1.dist-info}/WHEEL +1 -1
  325. label_studio_sdk/annotations/types/annotations_create_bulk_request_selected_items.py +0 -34
  326. label_studio_sdk/export_storage/azure/types/__init__.py +0 -6
  327. label_studio_sdk/export_storage/azure/types/azure_create_response.py +0 -57
  328. label_studio_sdk/export_storage/azure/types/azure_update_response.py +0 -57
  329. label_studio_sdk/export_storage/gcs/types/__init__.py +0 -6
  330. label_studio_sdk/export_storage/gcs/types/gcs_create_response.py +0 -57
  331. label_studio_sdk/export_storage/gcs/types/gcs_update_response.py +0 -57
  332. label_studio_sdk/export_storage/local/types/__init__.py +0 -6
  333. label_studio_sdk/export_storage/local/types/local_create_response.py +0 -47
  334. label_studio_sdk/export_storage/local/types/local_update_response.py +0 -47
  335. label_studio_sdk/export_storage/redis/types/__init__.py +0 -6
  336. label_studio_sdk/export_storage/redis/types/redis_create_response.py +0 -62
  337. label_studio_sdk/export_storage/redis/types/redis_update_response.py +0 -62
  338. label_studio_sdk/export_storage/s3/types/__init__.py +0 -6
  339. label_studio_sdk/export_storage/s3/types/s3create_response.py +0 -81
  340. label_studio_sdk/export_storage/s3/types/s3update_response.py +0 -81
  341. label_studio_sdk/import_storage/azure/types/__init__.py +0 -6
  342. label_studio_sdk/import_storage/azure/types/azure_create_response.py +0 -72
  343. label_studio_sdk/import_storage/azure/types/azure_update_response.py +0 -72
  344. label_studio_sdk/import_storage/gcs/types/__init__.py +0 -6
  345. label_studio_sdk/import_storage/gcs/types/gcs_create_response.py +0 -72
  346. label_studio_sdk/import_storage/gcs/types/gcs_update_response.py +0 -72
  347. label_studio_sdk/import_storage/local/types/__init__.py +0 -6
  348. label_studio_sdk/import_storage/local/types/local_create_response.py +0 -47
  349. label_studio_sdk/import_storage/local/types/local_update_response.py +0 -47
  350. label_studio_sdk/import_storage/redis/types/__init__.py +0 -6
  351. label_studio_sdk/import_storage/redis/types/redis_create_response.py +0 -62
  352. label_studio_sdk/import_storage/redis/types/redis_update_response.py +0 -62
  353. label_studio_sdk/import_storage/s3/types/__init__.py +0 -6
  354. label_studio_sdk/ml/types/ml_create_response.py +0 -68
  355. label_studio_sdk/ml/types/ml_create_response_auth_method.py +0 -5
  356. label_studio_sdk/ml/types/ml_update_response.py +0 -68
  357. label_studio_sdk/ml/types/ml_update_response_auth_method.py +0 -5
  358. label_studio_sdk/projects/exports/types/exports_list_formats_response_item.py +0 -44
  359. label_studio_sdk/projects/types/projects_create_response.py +0 -91
  360. label_studio_sdk/projects/types/projects_update_response.py +0 -96
  361. label_studio_sdk/prompts/types/prompts_batch_failed_predictions_request_failed_predictions_item.py +0 -32
  362. label_studio_sdk/prompts/types/prompts_batch_predictions_request_results_item.py +0 -59
  363. label_studio_sdk/tasks/types/tasks_list_response.py +0 -38
  364. label_studio_sdk/types/annotation_completed_by.py +0 -6
  365. label_studio_sdk/types/azure_blob_export_storage_status.py +0 -7
  366. label_studio_sdk/types/base_task_updated_by.py +0 -7
  367. label_studio_sdk/types/comment_created_by.py +0 -5
  368. label_studio_sdk/types/converted_format_status.py +0 -5
  369. label_studio_sdk/types/data_manager_task_serializer.py +0 -118
  370. label_studio_sdk/types/data_manager_task_serializer_annotators_item.py +0 -5
  371. label_studio_sdk/types/data_manager_task_serializer_comment_authors_item.py +0 -5
  372. label_studio_sdk/types/data_manager_task_serializer_predictions_item_model_run.py +0 -5
  373. label_studio_sdk/types/export_format.py +0 -25
  374. label_studio_sdk/types/export_snapshot_status.py +0 -5
  375. label_studio_sdk/types/export_status.py +0 -5
  376. label_studio_sdk/types/gcs_export_storage_status.py +0 -7
  377. label_studio_sdk/types/gcs_import_storage_status.py +0 -7
  378. label_studio_sdk/types/inference_run.py +0 -34
  379. label_studio_sdk/types/inference_run_created_by.py +0 -5
  380. label_studio_sdk/types/inference_run_organization.py +0 -5
  381. label_studio_sdk/types/inference_run_project_subset.py +0 -5
  382. label_studio_sdk/types/key_indicators.py +0 -6
  383. label_studio_sdk/types/key_indicators_item.py +0 -41
  384. label_studio_sdk/types/local_files_export_storage_status.py +0 -7
  385. label_studio_sdk/types/local_files_import_storage_status.py +0 -7
  386. label_studio_sdk/types/ml_backend_auth_method.py +0 -5
  387. label_studio_sdk/types/ml_backend_state.py +0 -5
  388. label_studio_sdk/types/model_provider_connection_created_by.py +0 -5
  389. label_studio_sdk/types/model_provider_connection_organization.py +0 -5
  390. label_studio_sdk/types/model_provider_connection_provider.py +0 -7
  391. label_studio_sdk/types/model_provider_connection_scope.py +0 -5
  392. label_studio_sdk/types/pause_paused_by.py +0 -5
  393. label_studio_sdk/types/project_import_status.py +0 -5
  394. label_studio_sdk/types/prompt.py +0 -71
  395. label_studio_sdk/types/prompt_associated_projects_item.py +0 -6
  396. label_studio_sdk/types/prompt_created_by.py +0 -5
  397. label_studio_sdk/types/prompt_organization.py +0 -5
  398. label_studio_sdk/types/prompt_version.py +0 -32
  399. label_studio_sdk/types/prompt_version_created_by.py +0 -5
  400. label_studio_sdk/types/prompt_version_organization.py +0 -5
  401. label_studio_sdk/types/redis_export_storage_status.py +0 -7
  402. label_studio_sdk/types/redis_import_storage_status.py +0 -7
  403. label_studio_sdk/types/refined_prompt_response_refinement_status.py +0 -7
  404. label_studio_sdk/types/s3export_storage_status.py +0 -7
  405. label_studio_sdk/types/s3import_storage_status.py +0 -7
  406. label_studio_sdk/types/s3s_export_storage.py +0 -73
  407. label_studio_sdk/types/s3s_import_storage_status.py +0 -7
  408. label_studio_sdk/types/task.py +0 -156
  409. label_studio_sdk/types/task_annotators_item.py +0 -5
  410. label_studio_sdk/types/task_comment_authors_item.py +0 -5
  411. label_studio_sdk/types/task_filter_options.py +0 -39
  412. label_studio_sdk/types/webhook_actions_item.py +0 -21
  413. label_studio_sdk/types/webhook_serializer_for_update_actions_item.py +0 -21
  414. label_studio_sdk/versions/types/__init__.py +0 -6
  415. label_studio_sdk/versions/types/versions_get_response.py +0 -73
  416. label_studio_sdk/versions/types/versions_get_response_edition.py +0 -5
  417. label_studio_sdk/workspaces/members/types/__init__.py +0 -6
  418. label_studio_sdk/workspaces/members/types/members_create_response.py +0 -22
  419. label_studio_sdk/workspaces/members/types/members_list_response_item.py +0 -22
  420. label_studio_sdk-1.0.20.dist-info/RECORD +0 -374
  421. {label_studio_sdk-1.0.20.dist-info → label_studio_sdk-2.0.1.dist-info}/LICENSE +0 -0
@@ -5,10 +5,14 @@ from ..core.client_wrapper import SyncClientWrapper
5
5
  from ..core.request_options import RequestOptions
6
6
  from ..types.annotation import Annotation
7
7
  from ..core.jsonable_encoder import jsonable_encoder
8
- from ..core.pydantic_utilities import parse_obj_as
8
+ from ..core.unchecked_base_model import construct_type
9
9
  from json.decoder import JSONDecodeError
10
10
  from ..core.api_error import ApiError
11
- from .types.annotations_create_bulk_request_selected_items import AnnotationsCreateBulkRequestSelectedItems
11
+ from ..types.selected_items_request import SelectedItemsRequest
12
+ import datetime as dt
13
+ from .types.annotation_bulk_serializer_with_selected_items_request_last_action import (
14
+ AnnotationBulkSerializerWithSelectedItemsRequestLastAction,
15
+ )
12
16
  from .types.annotations_create_bulk_response_item import AnnotationsCreateBulkResponseItem
13
17
  from ..core.serialization import convert_and_respect_annotation_metadata
14
18
  from ..core.client_wrapper import AsyncClientWrapper
@@ -23,15 +27,11 @@ class AnnotationsClient:
23
27
 
24
28
  def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> Annotation:
25
29
  """
26
-
27
- Tasks can have multiple annotations. Use this call to retrieve a specific annotation using its ID.
28
-
29
- You can find the ID in the Label Studio UI listed at the top of the annotation in its tab. It is also listed in the History panel when viewing the annotation. Or you can use [Get all task annotations](list) to find all annotation IDs.
30
+ Retrieve a specific annotation for a task using the annotation result ID.
30
31
 
31
32
  Parameters
32
33
  ----------
33
34
  id : int
34
- A unique integer value identifying this annotation.
35
35
 
36
36
  request_options : typing.Optional[RequestOptions]
37
37
  Request-specific configuration.
@@ -61,7 +61,7 @@ class AnnotationsClient:
61
61
  if 200 <= _response.status_code < 300:
62
62
  return typing.cast(
63
63
  Annotation,
64
- parse_obj_as(
64
+ construct_type(
65
65
  type_=Annotation, # type: ignore
66
66
  object_=_response.json(),
67
67
  ),
@@ -73,17 +73,11 @@ class AnnotationsClient:
73
73
 
74
74
  def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
75
75
  """
76
-
77
- Delete an annotation.
78
-
79
- <Warning>This action can't be undone!</Warning>
80
-
81
- You will need to supply the annotation's unique ID. You can find the ID in the Label Studio UI listed at the top of the annotation in its tab. It is also listed in the History panel when viewing the annotation. Or you can use [Get all task annotations](list) to find all annotation IDs.
76
+ Delete an annotation. This action can't be undone!
82
77
 
83
78
  Parameters
84
79
  ----------
85
80
  id : int
86
- A unique integer value identifying this annotation.
87
81
 
88
82
  request_options : typing.Optional[RequestOptions]
89
83
  Request-specific configuration.
@@ -131,17 +125,11 @@ class AnnotationsClient:
131
125
  request_options: typing.Optional[RequestOptions] = None,
132
126
  ) -> Annotation:
133
127
  """
134
-
135
- Update attributes for an existing annotation.
136
-
137
- You will need to supply the annotation's unique ID. You can find the ID in the Label Studio UI listed at the top of the annotation in its tab. It is also listed in the History panel when viewing the annotation. Or you can use [Get all task annotations](list) to find all annotation IDs.
138
-
139
- For information about the JSON format used in the result, see [Label Studio JSON format of annotated tasks](https://labelstud.io/guide/export#Label-Studio-JSON-format-of-annotated-tasks).
128
+ Update existing attributes on an annotation.
140
129
 
141
130
  Parameters
142
131
  ----------
143
132
  id : int
144
- A unique integer value identifying this annotation.
145
133
 
146
134
  result : typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]]
147
135
  Labeling result in JSON format. Read more about the format in [the Label Studio documentation.](https://labelstud.io/guide/task_format)
@@ -229,7 +217,7 @@ class AnnotationsClient:
229
217
  if 200 <= _response.status_code < 300:
230
218
  return typing.cast(
231
219
  Annotation,
232
- parse_obj_as(
220
+ construct_type(
233
221
  type_=Annotation, # type: ignore
234
222
  object_=_response.json(),
235
223
  ),
@@ -239,18 +227,175 @@ class AnnotationsClient:
239
227
  raise ApiError(status_code=_response.status_code, body=_response.text)
240
228
  raise ApiError(status_code=_response.status_code, body=_response_json)
241
229
 
242
- def list(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[Annotation]:
230
+ def create_bulk(
231
+ self,
232
+ *,
233
+ result: typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]] = OMIT,
234
+ completed_by: typing.Optional[int] = OMIT,
235
+ unique_id: typing.Optional[str] = OMIT,
236
+ tasks: typing.Optional[typing.Sequence[int]] = OMIT,
237
+ selected_items: typing.Optional[SelectedItemsRequest] = OMIT,
238
+ was_cancelled: typing.Optional[bool] = OMIT,
239
+ ground_truth: typing.Optional[bool] = OMIT,
240
+ draft_created_at: typing.Optional[dt.datetime] = OMIT,
241
+ lead_time: typing.Optional[float] = OMIT,
242
+ import_id: typing.Optional[int] = OMIT,
243
+ last_action: typing.Optional[AnnotationBulkSerializerWithSelectedItemsRequestLastAction] = OMIT,
244
+ bulk_created: typing.Optional[bool] = OMIT,
245
+ task: typing.Optional[int] = OMIT,
246
+ project: typing.Optional[int] = OMIT,
247
+ updated_by: typing.Optional[int] = OMIT,
248
+ parent_prediction: typing.Optional[int] = OMIT,
249
+ parent_annotation: typing.Optional[int] = OMIT,
250
+ last_created_by: typing.Optional[int] = OMIT,
251
+ request_options: typing.Optional[RequestOptions] = None,
252
+ ) -> typing.List[AnnotationsCreateBulkResponseItem]:
243
253
  """
254
+ Create multiple annotations at once
244
255
 
245
- List all annotations for a task.
256
+ Parameters
257
+ ----------
258
+ result : typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]]
259
+ List of annotation results for the task
260
+
261
+ completed_by : typing.Optional[int]
262
+
263
+ unique_id : typing.Optional[str]
264
+
265
+ tasks : typing.Optional[typing.Sequence[int]]
266
+
267
+ selected_items : typing.Optional[SelectedItemsRequest]
268
+
269
+ was_cancelled : typing.Optional[bool]
270
+ User skipped the task
271
+
272
+ ground_truth : typing.Optional[bool]
273
+ This annotation is a Ground Truth (ground_truth)
274
+
275
+ draft_created_at : typing.Optional[dt.datetime]
276
+ Draft creation time
277
+
278
+ lead_time : typing.Optional[float]
279
+ How much time it took to annotate the task
280
+
281
+ import_id : typing.Optional[int]
282
+ Original annotation ID that was at the import step or NULL if this annotation wasn't imported
283
+
284
+ last_action : typing.Optional[AnnotationBulkSerializerWithSelectedItemsRequestLastAction]
285
+ Action which was performed in the last annotation history item
286
+
287
+ * `prediction` - Created from prediction
288
+ * `propagated_annotation` - Created from another annotation
289
+ * `imported` - Imported
290
+ * `submitted` - Submitted
291
+ * `updated` - Updated
292
+ * `skipped` - Skipped
293
+ * `accepted` - Accepted
294
+ * `rejected` - Rejected
295
+ * `fixed_and_accepted` - Fixed and accepted
296
+ * `deleted_review` - Deleted review
297
+
298
+ bulk_created : typing.Optional[bool]
299
+ Annotation was created in bulk mode
300
+
301
+ task : typing.Optional[int]
302
+ Corresponding task for this annotation
303
+
304
+ project : typing.Optional[int]
305
+ Project ID for this annotation
306
+
307
+ updated_by : typing.Optional[int]
308
+ Last user who updated this annotation
309
+
310
+ parent_prediction : typing.Optional[int]
311
+ Points to the prediction from which this annotation was created
312
+
313
+ parent_annotation : typing.Optional[int]
314
+ Points to the parent annotation from which this annotation was created
315
+
316
+ last_created_by : typing.Optional[int]
317
+ User who created the last annotation history item
318
+
319
+ request_options : typing.Optional[RequestOptions]
320
+ Request-specific configuration.
321
+
322
+ Returns
323
+ -------
324
+ typing.List[AnnotationsCreateBulkResponseItem]
325
+ Bulk annotations created successfully
326
+
327
+ Examples
328
+ --------
329
+ from label_studio_sdk import LabelStudio
330
+
331
+ client = LabelStudio(
332
+ api_key="YOUR_API_KEY",
333
+ )
334
+ client.annotations.create_bulk()
335
+ """
336
+ _response = self._client_wrapper.httpx_client.request(
337
+ "api/annotations/bulk/",
338
+ method="POST",
339
+ json={
340
+ "result": result,
341
+ "completed_by": completed_by,
342
+ "unique_id": unique_id,
343
+ "tasks": tasks,
344
+ "selected_items": convert_and_respect_annotation_metadata(
345
+ object_=selected_items, annotation=SelectedItemsRequest, direction="write"
346
+ ),
347
+ "was_cancelled": was_cancelled,
348
+ "ground_truth": ground_truth,
349
+ "draft_created_at": draft_created_at,
350
+ "lead_time": lead_time,
351
+ "import_id": import_id,
352
+ "last_action": convert_and_respect_annotation_metadata(
353
+ object_=last_action,
354
+ annotation=AnnotationBulkSerializerWithSelectedItemsRequestLastAction,
355
+ direction="write",
356
+ ),
357
+ "bulk_created": bulk_created,
358
+ "task": task,
359
+ "project": project,
360
+ "updated_by": updated_by,
361
+ "parent_prediction": parent_prediction,
362
+ "parent_annotation": parent_annotation,
363
+ "last_created_by": last_created_by,
364
+ },
365
+ headers={
366
+ "content-type": "application/json",
367
+ },
368
+ request_options=request_options,
369
+ omit=OMIT,
370
+ )
371
+ try:
372
+ if 200 <= _response.status_code < 300:
373
+ return typing.cast(
374
+ typing.List[AnnotationsCreateBulkResponseItem],
375
+ construct_type(
376
+ type_=typing.List[AnnotationsCreateBulkResponseItem], # type: ignore
377
+ object_=_response.json(),
378
+ ),
379
+ )
380
+ _response_json = _response.json()
381
+ except JSONDecodeError:
382
+ raise ApiError(status_code=_response.status_code, body=_response.text)
383
+ raise ApiError(status_code=_response.status_code, body=_response_json)
246
384
 
247
- You will need to supply the task ID. You can find this in Label Studio by opening a task and checking the URL. It is also listed at the top of the labeling interface. Or you can use [Get tasks list](../tasks/list).
385
+ def list(
386
+ self, id: int, *, ordering: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
387
+ ) -> typing.List[Annotation]:
388
+ """
389
+ List all annotations for a task.
248
390
 
249
391
  Parameters
250
392
  ----------
251
393
  id : int
252
394
  Task ID
253
395
 
396
+ ordering : typing.Optional[str]
397
+ Which field to use when ordering the results.
398
+
254
399
  request_options : typing.Optional[RequestOptions]
255
400
  Request-specific configuration.
256
401
 
@@ -273,13 +418,16 @@ class AnnotationsClient:
273
418
  _response = self._client_wrapper.httpx_client.request(
274
419
  f"api/tasks/{jsonable_encoder(id)}/annotations/",
275
420
  method="GET",
421
+ params={
422
+ "ordering": ordering,
423
+ },
276
424
  request_options=request_options,
277
425
  )
278
426
  try:
279
427
  if 200 <= _response.status_code < 300:
280
428
  return typing.cast(
281
429
  typing.List[Annotation],
282
- parse_obj_as(
430
+ construct_type(
283
431
  type_=typing.List[Annotation], # type: ignore
284
432
  object_=_response.json(),
285
433
  ),
@@ -305,24 +453,21 @@ class AnnotationsClient:
305
453
  ) -> Annotation:
306
454
  """
307
455
 
308
- Add annotations to a task like an annotator does.
309
-
310
- You will need to supply the task ID. You can find this in Label Studio by opening a task and checking the URL. It is also listed at the top of the labeling interface. Or you can use [Get tasks list](../tasks/list).
456
+ Add annotations to a task like an annotator does. The content of the result field depends on your
457
+ labeling configuration. For example, send the following data as part of your POST
458
+ request to send an empty annotation with the ID of the user who completed the task:
311
459
 
460
+ ```json
461
+ {
462
+ "result": {},
463
+ "was_cancelled": true,
464
+ "ground_truth": true,
465
+ "lead_time": 0,
466
+ "task": 0
467
+ "completed_by": 123
468
+ }
469
+ ```
312
470
 
313
- The content of the result field depends on your labeling configuration. For example, send the following data as part of your POST
314
- request to send an empty annotation with the ID of the user who completed the task:
315
-
316
- ```json
317
- {
318
- "result": {},
319
- "was_cancelled": true,
320
- "ground_truth": true,
321
- "lead_time": 0,
322
- "task": 0
323
- "completed_by": 123
324
- }
325
- ```
326
471
 
327
472
  Parameters
328
473
  ----------
@@ -415,7 +560,7 @@ class AnnotationsClient:
415
560
  if 200 <= _response.status_code < 300:
416
561
  return typing.cast(
417
562
  Annotation,
418
- parse_obj_as(
563
+ construct_type(
419
564
  type_=Annotation, # type: ignore
420
565
  object_=_response.json(),
421
566
  ),
@@ -425,80 +570,6 @@ class AnnotationsClient:
425
570
  raise ApiError(status_code=_response.status_code, body=_response.text)
426
571
  raise ApiError(status_code=_response.status_code, body=_response_json)
427
572
 
428
- def create_bulk(
429
- self,
430
- *,
431
- tasks: typing.Optional[typing.Sequence[int]] = OMIT,
432
- selected_items: typing.Optional[AnnotationsCreateBulkRequestSelectedItems] = OMIT,
433
- lead_time: typing.Optional[float] = OMIT,
434
- project: typing.Optional[int] = OMIT,
435
- result: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
436
- request_options: typing.Optional[RequestOptions] = None,
437
- ) -> typing.List[AnnotationsCreateBulkResponseItem]:
438
- """
439
- Create multiple annotations for specific tasks in a bulk operation.
440
-
441
- Parameters
442
- ----------
443
- tasks : typing.Optional[typing.Sequence[int]]
444
-
445
- selected_items : typing.Optional[AnnotationsCreateBulkRequestSelectedItems]
446
-
447
- lead_time : typing.Optional[float]
448
-
449
- project : typing.Optional[int]
450
-
451
- result : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
452
-
453
- request_options : typing.Optional[RequestOptions]
454
- Request-specific configuration.
455
-
456
- Returns
457
- -------
458
- typing.List[AnnotationsCreateBulkResponseItem]
459
- Annotations created successfully
460
-
461
- Examples
462
- --------
463
- from label_studio_sdk import LabelStudio
464
-
465
- client = LabelStudio(
466
- api_key="YOUR_API_KEY",
467
- )
468
- client.annotations.create_bulk()
469
- """
470
- _response = self._client_wrapper.httpx_client.request(
471
- "api/annotations/bulk",
472
- method="POST",
473
- json={
474
- "tasks": tasks,
475
- "selectedItems": convert_and_respect_annotation_metadata(
476
- object_=selected_items, annotation=AnnotationsCreateBulkRequestSelectedItems, direction="write"
477
- ),
478
- "lead_time": lead_time,
479
- "project": project,
480
- "result": result,
481
- },
482
- headers={
483
- "content-type": "application/json",
484
- },
485
- request_options=request_options,
486
- omit=OMIT,
487
- )
488
- try:
489
- if 200 <= _response.status_code < 300:
490
- return typing.cast(
491
- typing.List[AnnotationsCreateBulkResponseItem],
492
- parse_obj_as(
493
- type_=typing.List[AnnotationsCreateBulkResponseItem], # type: ignore
494
- object_=_response.json(),
495
- ),
496
- )
497
- _response_json = _response.json()
498
- except JSONDecodeError:
499
- raise ApiError(status_code=_response.status_code, body=_response.text)
500
- raise ApiError(status_code=_response.status_code, body=_response_json)
501
-
502
573
 
503
574
  class AsyncAnnotationsClient:
504
575
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
@@ -506,15 +577,11 @@ class AsyncAnnotationsClient:
506
577
 
507
578
  async def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> Annotation:
508
579
  """
509
-
510
- Tasks can have multiple annotations. Use this call to retrieve a specific annotation using its ID.
511
-
512
- You can find the ID in the Label Studio UI listed at the top of the annotation in its tab. It is also listed in the History panel when viewing the annotation. Or you can use [Get all task annotations](list) to find all annotation IDs.
580
+ Retrieve a specific annotation for a task using the annotation result ID.
513
581
 
514
582
  Parameters
515
583
  ----------
516
584
  id : int
517
- A unique integer value identifying this annotation.
518
585
 
519
586
  request_options : typing.Optional[RequestOptions]
520
587
  Request-specific configuration.
@@ -552,7 +619,7 @@ class AsyncAnnotationsClient:
552
619
  if 200 <= _response.status_code < 300:
553
620
  return typing.cast(
554
621
  Annotation,
555
- parse_obj_as(
622
+ construct_type(
556
623
  type_=Annotation, # type: ignore
557
624
  object_=_response.json(),
558
625
  ),
@@ -564,17 +631,11 @@ class AsyncAnnotationsClient:
564
631
 
565
632
  async def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
566
633
  """
567
-
568
- Delete an annotation.
569
-
570
- <Warning>This action can't be undone!</Warning>
571
-
572
- You will need to supply the annotation's unique ID. You can find the ID in the Label Studio UI listed at the top of the annotation in its tab. It is also listed in the History panel when viewing the annotation. Or you can use [Get all task annotations](list) to find all annotation IDs.
634
+ Delete an annotation. This action can't be undone!
573
635
 
574
636
  Parameters
575
637
  ----------
576
638
  id : int
577
- A unique integer value identifying this annotation.
578
639
 
579
640
  request_options : typing.Optional[RequestOptions]
580
641
  Request-specific configuration.
@@ -630,17 +691,11 @@ class AsyncAnnotationsClient:
630
691
  request_options: typing.Optional[RequestOptions] = None,
631
692
  ) -> Annotation:
632
693
  """
633
-
634
- Update attributes for an existing annotation.
635
-
636
- You will need to supply the annotation's unique ID. You can find the ID in the Label Studio UI listed at the top of the annotation in its tab. It is also listed in the History panel when viewing the annotation. Or you can use [Get all task annotations](list) to find all annotation IDs.
637
-
638
- For information about the JSON format used in the result, see [Label Studio JSON format of annotated tasks](https://labelstud.io/guide/export#Label-Studio-JSON-format-of-annotated-tasks).
694
+ Update existing attributes on an annotation.
639
695
 
640
696
  Parameters
641
697
  ----------
642
698
  id : int
643
- A unique integer value identifying this annotation.
644
699
 
645
700
  result : typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]]
646
701
  Labeling result in JSON format. Read more about the format in [the Label Studio documentation.](https://labelstud.io/guide/task_format)
@@ -736,7 +791,7 @@ class AsyncAnnotationsClient:
736
791
  if 200 <= _response.status_code < 300:
737
792
  return typing.cast(
738
793
  Annotation,
739
- parse_obj_as(
794
+ construct_type(
740
795
  type_=Annotation, # type: ignore
741
796
  object_=_response.json(),
742
797
  ),
@@ -746,20 +801,183 @@ class AsyncAnnotationsClient:
746
801
  raise ApiError(status_code=_response.status_code, body=_response.text)
747
802
  raise ApiError(status_code=_response.status_code, body=_response_json)
748
803
 
804
+ async def create_bulk(
805
+ self,
806
+ *,
807
+ result: typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]] = OMIT,
808
+ completed_by: typing.Optional[int] = OMIT,
809
+ unique_id: typing.Optional[str] = OMIT,
810
+ tasks: typing.Optional[typing.Sequence[int]] = OMIT,
811
+ selected_items: typing.Optional[SelectedItemsRequest] = OMIT,
812
+ was_cancelled: typing.Optional[bool] = OMIT,
813
+ ground_truth: typing.Optional[bool] = OMIT,
814
+ draft_created_at: typing.Optional[dt.datetime] = OMIT,
815
+ lead_time: typing.Optional[float] = OMIT,
816
+ import_id: typing.Optional[int] = OMIT,
817
+ last_action: typing.Optional[AnnotationBulkSerializerWithSelectedItemsRequestLastAction] = OMIT,
818
+ bulk_created: typing.Optional[bool] = OMIT,
819
+ task: typing.Optional[int] = OMIT,
820
+ project: typing.Optional[int] = OMIT,
821
+ updated_by: typing.Optional[int] = OMIT,
822
+ parent_prediction: typing.Optional[int] = OMIT,
823
+ parent_annotation: typing.Optional[int] = OMIT,
824
+ last_created_by: typing.Optional[int] = OMIT,
825
+ request_options: typing.Optional[RequestOptions] = None,
826
+ ) -> typing.List[AnnotationsCreateBulkResponseItem]:
827
+ """
828
+ Create multiple annotations at once
829
+
830
+ Parameters
831
+ ----------
832
+ result : typing.Optional[typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]]
833
+ List of annotation results for the task
834
+
835
+ completed_by : typing.Optional[int]
836
+
837
+ unique_id : typing.Optional[str]
838
+
839
+ tasks : typing.Optional[typing.Sequence[int]]
840
+
841
+ selected_items : typing.Optional[SelectedItemsRequest]
842
+
843
+ was_cancelled : typing.Optional[bool]
844
+ User skipped the task
845
+
846
+ ground_truth : typing.Optional[bool]
847
+ This annotation is a Ground Truth (ground_truth)
848
+
849
+ draft_created_at : typing.Optional[dt.datetime]
850
+ Draft creation time
851
+
852
+ lead_time : typing.Optional[float]
853
+ How much time it took to annotate the task
854
+
855
+ import_id : typing.Optional[int]
856
+ Original annotation ID that was at the import step or NULL if this annotation wasn't imported
857
+
858
+ last_action : typing.Optional[AnnotationBulkSerializerWithSelectedItemsRequestLastAction]
859
+ Action which was performed in the last annotation history item
860
+
861
+ * `prediction` - Created from prediction
862
+ * `propagated_annotation` - Created from another annotation
863
+ * `imported` - Imported
864
+ * `submitted` - Submitted
865
+ * `updated` - Updated
866
+ * `skipped` - Skipped
867
+ * `accepted` - Accepted
868
+ * `rejected` - Rejected
869
+ * `fixed_and_accepted` - Fixed and accepted
870
+ * `deleted_review` - Deleted review
871
+
872
+ bulk_created : typing.Optional[bool]
873
+ Annotation was created in bulk mode
874
+
875
+ task : typing.Optional[int]
876
+ Corresponding task for this annotation
877
+
878
+ project : typing.Optional[int]
879
+ Project ID for this annotation
880
+
881
+ updated_by : typing.Optional[int]
882
+ Last user who updated this annotation
883
+
884
+ parent_prediction : typing.Optional[int]
885
+ Points to the prediction from which this annotation was created
886
+
887
+ parent_annotation : typing.Optional[int]
888
+ Points to the parent annotation from which this annotation was created
889
+
890
+ last_created_by : typing.Optional[int]
891
+ User who created the last annotation history item
892
+
893
+ request_options : typing.Optional[RequestOptions]
894
+ Request-specific configuration.
895
+
896
+ Returns
897
+ -------
898
+ typing.List[AnnotationsCreateBulkResponseItem]
899
+ Bulk annotations created successfully
900
+
901
+ Examples
902
+ --------
903
+ import asyncio
904
+
905
+ from label_studio_sdk import AsyncLabelStudio
906
+
907
+ client = AsyncLabelStudio(
908
+ api_key="YOUR_API_KEY",
909
+ )
910
+
911
+
912
+ async def main() -> None:
913
+ await client.annotations.create_bulk()
914
+
915
+
916
+ asyncio.run(main())
917
+ """
918
+ _response = await self._client_wrapper.httpx_client.request(
919
+ "api/annotations/bulk/",
920
+ method="POST",
921
+ json={
922
+ "result": result,
923
+ "completed_by": completed_by,
924
+ "unique_id": unique_id,
925
+ "tasks": tasks,
926
+ "selected_items": convert_and_respect_annotation_metadata(
927
+ object_=selected_items, annotation=SelectedItemsRequest, direction="write"
928
+ ),
929
+ "was_cancelled": was_cancelled,
930
+ "ground_truth": ground_truth,
931
+ "draft_created_at": draft_created_at,
932
+ "lead_time": lead_time,
933
+ "import_id": import_id,
934
+ "last_action": convert_and_respect_annotation_metadata(
935
+ object_=last_action,
936
+ annotation=AnnotationBulkSerializerWithSelectedItemsRequestLastAction,
937
+ direction="write",
938
+ ),
939
+ "bulk_created": bulk_created,
940
+ "task": task,
941
+ "project": project,
942
+ "updated_by": updated_by,
943
+ "parent_prediction": parent_prediction,
944
+ "parent_annotation": parent_annotation,
945
+ "last_created_by": last_created_by,
946
+ },
947
+ headers={
948
+ "content-type": "application/json",
949
+ },
950
+ request_options=request_options,
951
+ omit=OMIT,
952
+ )
953
+ try:
954
+ if 200 <= _response.status_code < 300:
955
+ return typing.cast(
956
+ typing.List[AnnotationsCreateBulkResponseItem],
957
+ construct_type(
958
+ type_=typing.List[AnnotationsCreateBulkResponseItem], # type: ignore
959
+ object_=_response.json(),
960
+ ),
961
+ )
962
+ _response_json = _response.json()
963
+ except JSONDecodeError:
964
+ raise ApiError(status_code=_response.status_code, body=_response.text)
965
+ raise ApiError(status_code=_response.status_code, body=_response_json)
966
+
749
967
  async def list(
750
- self, id: int, *, request_options: typing.Optional[RequestOptions] = None
968
+ self, id: int, *, ordering: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
751
969
  ) -> typing.List[Annotation]:
752
970
  """
753
-
754
971
  List all annotations for a task.
755
972
 
756
- You will need to supply the task ID. You can find this in Label Studio by opening a task and checking the URL. It is also listed at the top of the labeling interface. Or you can use [Get tasks list](../tasks/list).
757
-
758
973
  Parameters
759
974
  ----------
760
975
  id : int
761
976
  Task ID
762
977
 
978
+ ordering : typing.Optional[str]
979
+ Which field to use when ordering the results.
980
+
763
981
  request_options : typing.Optional[RequestOptions]
764
982
  Request-specific configuration.
765
983
 
@@ -790,13 +1008,16 @@ class AsyncAnnotationsClient:
790
1008
  _response = await self._client_wrapper.httpx_client.request(
791
1009
  f"api/tasks/{jsonable_encoder(id)}/annotations/",
792
1010
  method="GET",
1011
+ params={
1012
+ "ordering": ordering,
1013
+ },
793
1014
  request_options=request_options,
794
1015
  )
795
1016
  try:
796
1017
  if 200 <= _response.status_code < 300:
797
1018
  return typing.cast(
798
1019
  typing.List[Annotation],
799
- parse_obj_as(
1020
+ construct_type(
800
1021
  type_=typing.List[Annotation], # type: ignore
801
1022
  object_=_response.json(),
802
1023
  ),
@@ -822,24 +1043,21 @@ class AsyncAnnotationsClient:
822
1043
  ) -> Annotation:
823
1044
  """
824
1045
 
825
- Add annotations to a task like an annotator does.
826
-
827
- You will need to supply the task ID. You can find this in Label Studio by opening a task and checking the URL. It is also listed at the top of the labeling interface. Or you can use [Get tasks list](../tasks/list).
1046
+ Add annotations to a task like an annotator does. The content of the result field depends on your
1047
+ labeling configuration. For example, send the following data as part of your POST
1048
+ request to send an empty annotation with the ID of the user who completed the task:
828
1049
 
1050
+ ```json
1051
+ {
1052
+ "result": {},
1053
+ "was_cancelled": true,
1054
+ "ground_truth": true,
1055
+ "lead_time": 0,
1056
+ "task": 0
1057
+ "completed_by": 123
1058
+ }
1059
+ ```
829
1060
 
830
- The content of the result field depends on your labeling configuration. For example, send the following data as part of your POST
831
- request to send an empty annotation with the ID of the user who completed the task:
832
-
833
- ```json
834
- {
835
- "result": {},
836
- "was_cancelled": true,
837
- "ground_truth": true,
838
- "lead_time": 0,
839
- "task": 0
840
- "completed_by": 123
841
- }
842
- ```
843
1061
 
844
1062
  Parameters
845
1063
  ----------
@@ -940,7 +1158,7 @@ class AsyncAnnotationsClient:
940
1158
  if 200 <= _response.status_code < 300:
941
1159
  return typing.cast(
942
1160
  Annotation,
943
- parse_obj_as(
1161
+ construct_type(
944
1162
  type_=Annotation, # type: ignore
945
1163
  object_=_response.json(),
946
1164
  ),
@@ -949,85 +1167,3 @@ class AsyncAnnotationsClient:
949
1167
  except JSONDecodeError:
950
1168
  raise ApiError(status_code=_response.status_code, body=_response.text)
951
1169
  raise ApiError(status_code=_response.status_code, body=_response_json)
952
-
953
- async def create_bulk(
954
- self,
955
- *,
956
- tasks: typing.Optional[typing.Sequence[int]] = OMIT,
957
- selected_items: typing.Optional[AnnotationsCreateBulkRequestSelectedItems] = OMIT,
958
- lead_time: typing.Optional[float] = OMIT,
959
- project: typing.Optional[int] = OMIT,
960
- result: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
961
- request_options: typing.Optional[RequestOptions] = None,
962
- ) -> typing.List[AnnotationsCreateBulkResponseItem]:
963
- """
964
- Create multiple annotations for specific tasks in a bulk operation.
965
-
966
- Parameters
967
- ----------
968
- tasks : typing.Optional[typing.Sequence[int]]
969
-
970
- selected_items : typing.Optional[AnnotationsCreateBulkRequestSelectedItems]
971
-
972
- lead_time : typing.Optional[float]
973
-
974
- project : typing.Optional[int]
975
-
976
- result : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
977
-
978
- request_options : typing.Optional[RequestOptions]
979
- Request-specific configuration.
980
-
981
- Returns
982
- -------
983
- typing.List[AnnotationsCreateBulkResponseItem]
984
- Annotations created successfully
985
-
986
- Examples
987
- --------
988
- import asyncio
989
-
990
- from label_studio_sdk import AsyncLabelStudio
991
-
992
- client = AsyncLabelStudio(
993
- api_key="YOUR_API_KEY",
994
- )
995
-
996
-
997
- async def main() -> None:
998
- await client.annotations.create_bulk()
999
-
1000
-
1001
- asyncio.run(main())
1002
- """
1003
- _response = await self._client_wrapper.httpx_client.request(
1004
- "api/annotations/bulk",
1005
- method="POST",
1006
- json={
1007
- "tasks": tasks,
1008
- "selectedItems": convert_and_respect_annotation_metadata(
1009
- object_=selected_items, annotation=AnnotationsCreateBulkRequestSelectedItems, direction="write"
1010
- ),
1011
- "lead_time": lead_time,
1012
- "project": project,
1013
- "result": result,
1014
- },
1015
- headers={
1016
- "content-type": "application/json",
1017
- },
1018
- request_options=request_options,
1019
- omit=OMIT,
1020
- )
1021
- try:
1022
- if 200 <= _response.status_code < 300:
1023
- return typing.cast(
1024
- typing.List[AnnotationsCreateBulkResponseItem],
1025
- parse_obj_as(
1026
- type_=typing.List[AnnotationsCreateBulkResponseItem], # type: ignore
1027
- object_=_response.json(),
1028
- ),
1029
- )
1030
- _response_json = _response.json()
1031
- except JSONDecodeError:
1032
- raise ApiError(status_code=_response.status_code, body=_response.text)
1033
- raise ApiError(status_code=_response.status_code, body=_response_json)