label-studio-sdk 2.0.5__py3-none-any.whl → 2.0.7__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.
- label_studio_sdk/__init__.py +70 -0
- label_studio_sdk/annotation_history/__init__.py +5 -0
- label_studio_sdk/annotation_history/client.py +415 -0
- label_studio_sdk/annotation_history/types/__init__.py +5 -0
- label_studio_sdk/annotation_history/types/annotation_history_delete_response.py +22 -0
- label_studio_sdk/annotation_reviews/__init__.py +2 -0
- label_studio_sdk/annotation_reviews/client.py +713 -0
- label_studio_sdk/base_client.py +20 -0
- label_studio_sdk/blueprints/__init__.py +2 -0
- label_studio_sdk/blueprints/client.py +272 -0
- label_studio_sdk/core/client_wrapper.py +2 -1
- label_studio_sdk/export_storage/__init__.py +2 -2
- label_studio_sdk/export_storage/azure_spi/__init__.py +2 -0
- label_studio_sdk/export_storage/azure_spi/client.py +1354 -0
- label_studio_sdk/export_storage/client.py +8 -0
- label_studio_sdk/export_storage/gcswif/__init__.py +2 -0
- label_studio_sdk/export_storage/gcswif/client.py +1376 -0
- label_studio_sdk/import_storage/__init__.py +2 -2
- label_studio_sdk/import_storage/azure_spi/__init__.py +2 -0
- label_studio_sdk/import_storage/azure_spi/client.py +1378 -0
- label_studio_sdk/import_storage/client.py +8 -0
- label_studio_sdk/import_storage/gcswif/__init__.py +2 -0
- label_studio_sdk/import_storage/gcswif/client.py +1400 -0
- label_studio_sdk/jwt_settings/client.py +10 -8
- label_studio_sdk/label_interface/control_tags.py +38 -0
- label_studio_sdk/label_interface/data_examples.json +10 -0
- label_studio_sdk/label_interface/interface.py +13 -0
- label_studio_sdk/label_interface/object_tags.py +9 -0
- label_studio_sdk/ml/client.py +124 -0
- label_studio_sdk/organizations/__init__.py +3 -2
- label_studio_sdk/organizations/client.py +536 -1
- label_studio_sdk/organizations/invites/__init__.py +2 -0
- label_studio_sdk/organizations/invites/client.py +368 -0
- label_studio_sdk/organizations/types/__init__.py +5 -0
- label_studio_sdk/organizations/types/patched_default_role_request_custom_scripts_editable_by.py +7 -0
- label_studio_sdk/project_templates/__init__.py +2 -0
- label_studio_sdk/project_templates/client.py +909 -0
- label_studio_sdk/projects/client.py +8 -0
- label_studio_sdk/projects/members/__init__.py +2 -2
- label_studio_sdk/projects/members/bulk/client.py +46 -2
- label_studio_sdk/projects/members/client.py +4 -0
- label_studio_sdk/projects/members/paginated/__init__.py +2 -0
- label_studio_sdk/projects/members/paginated/client.py +248 -0
- label_studio_sdk/session_policy/__init__.py +2 -0
- label_studio_sdk/session_policy/client.py +247 -0
- label_studio_sdk/tasks/client.py +371 -0
- label_studio_sdk/types/__init__.py +56 -0
- label_studio_sdk/types/action_enum.py +19 -0
- label_studio_sdk/types/all_roles_project_list.py +1 -1
- label_studio_sdk/types/annotation.py +7 -0
- label_studio_sdk/types/annotation_history.py +81 -0
- label_studio_sdk/types/annotation_history_action.py +7 -0
- label_studio_sdk/types/annotation_request.py +7 -0
- label_studio_sdk/types/annotation_review.py +61 -0
- label_studio_sdk/types/annotation_review_request.py +41 -0
- label_studio_sdk/types/azure_service_principal_export_storage.py +114 -0
- label_studio_sdk/types/azure_service_principal_export_storage_request.py +107 -0
- label_studio_sdk/types/azure_service_principal_import_storage.py +115 -0
- label_studio_sdk/types/azure_service_principal_import_storage_request.py +108 -0
- label_studio_sdk/types/blueprint.py +41 -0
- label_studio_sdk/types/default_role.py +75 -0
- label_studio_sdk/types/default_role_custom_scripts_editable_by.py +7 -0
- label_studio_sdk/types/gcswif_export_storage.py +119 -0
- label_studio_sdk/types/gcswif_export_storage_request.py +112 -0
- label_studio_sdk/types/gcswif_import_storage.py +120 -0
- label_studio_sdk/types/gcswif_import_storage_request.py +113 -0
- label_studio_sdk/types/lse_project.py +223 -0
- label_studio_sdk/types/lse_project_sampling.py +7 -0
- label_studio_sdk/types/lse_project_skip_queue.py +7 -0
- label_studio_sdk/types/lse_project_update.py +1 -0
- label_studio_sdk/types/lse_task.py +1 -0
- label_studio_sdk/types/lse_task_serializer_for_reviewers.py +1 -0
- label_studio_sdk/types/lsejwt_settings.py +1 -5
- label_studio_sdk/types/paginated_annotation_history_list.py +23 -0
- label_studio_sdk/types/paginated_lse_user_list.py +23 -0
- label_studio_sdk/types/paginated_paginated_project_member_list.py +23 -0
- label_studio_sdk/types/paginated_project_member.py +50 -0
- label_studio_sdk/types/project_member_bulk_assign_roles_request.py +21 -0
- label_studio_sdk/types/project_template.py +41 -0
- label_studio_sdk/types/project_template_request.py +38 -0
- label_studio_sdk/types/review_settings.py +5 -0
- label_studio_sdk/types/review_settings_request.py +5 -0
- label_studio_sdk/types/session_timeout_policy.py +31 -0
- label_studio_sdk/types/task_event.py +61 -0
- label_studio_sdk/workspaces/members/__init__.py +2 -2
- label_studio_sdk/workspaces/members/client.py +4 -0
- label_studio_sdk/workspaces/members/paginated/__init__.py +2 -0
- label_studio_sdk/workspaces/members/paginated/client.py +212 -0
- {label_studio_sdk-2.0.5.dist-info → label_studio_sdk-2.0.7.dist-info}/METADATA +2 -2
- {label_studio_sdk-2.0.5.dist-info → label_studio_sdk-2.0.7.dist-info}/RECORD +92 -36
- {label_studio_sdk-2.0.5.dist-info → label_studio_sdk-2.0.7.dist-info}/LICENSE +0 -0
- {label_studio_sdk-2.0.5.dist-info → label_studio_sdk-2.0.7.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,713 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from ..core.client_wrapper import SyncClientWrapper
|
|
5
|
+
from ..core.request_options import RequestOptions
|
|
6
|
+
from ..types.annotation_review import AnnotationReview
|
|
7
|
+
from ..core.unchecked_base_model import construct_type
|
|
8
|
+
from json.decoder import JSONDecodeError
|
|
9
|
+
from ..core.api_error import ApiError
|
|
10
|
+
import datetime as dt
|
|
11
|
+
from ..core.jsonable_encoder import jsonable_encoder
|
|
12
|
+
from ..core.client_wrapper import AsyncClientWrapper
|
|
13
|
+
|
|
14
|
+
# this is used as the default value for optional parameters
|
|
15
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class AnnotationReviewsClient:
|
|
19
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
20
|
+
self._client_wrapper = client_wrapper
|
|
21
|
+
|
|
22
|
+
def list(
|
|
23
|
+
self,
|
|
24
|
+
*,
|
|
25
|
+
annotation: typing.Optional[int] = None,
|
|
26
|
+
annotation_task_project: typing.Optional[int] = None,
|
|
27
|
+
ordering: typing.Optional[str] = None,
|
|
28
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
29
|
+
) -> typing.List[AnnotationReview]:
|
|
30
|
+
"""
|
|
31
|
+
List all reviews for a specific annotation ID.
|
|
32
|
+
|
|
33
|
+
Parameters
|
|
34
|
+
----------
|
|
35
|
+
annotation : typing.Optional[int]
|
|
36
|
+
|
|
37
|
+
annotation_task_project : typing.Optional[int]
|
|
38
|
+
|
|
39
|
+
ordering : typing.Optional[str]
|
|
40
|
+
Which field to use when ordering the results.
|
|
41
|
+
|
|
42
|
+
request_options : typing.Optional[RequestOptions]
|
|
43
|
+
Request-specific configuration.
|
|
44
|
+
|
|
45
|
+
Returns
|
|
46
|
+
-------
|
|
47
|
+
typing.List[AnnotationReview]
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
Examples
|
|
51
|
+
--------
|
|
52
|
+
from label_studio_sdk import LabelStudio
|
|
53
|
+
|
|
54
|
+
client = LabelStudio(
|
|
55
|
+
api_key="YOUR_API_KEY",
|
|
56
|
+
)
|
|
57
|
+
client.annotation_reviews.list()
|
|
58
|
+
"""
|
|
59
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
60
|
+
"api/annotation-reviews/",
|
|
61
|
+
method="GET",
|
|
62
|
+
params={
|
|
63
|
+
"annotation": annotation,
|
|
64
|
+
"annotation__task__project": annotation_task_project,
|
|
65
|
+
"ordering": ordering,
|
|
66
|
+
},
|
|
67
|
+
request_options=request_options,
|
|
68
|
+
)
|
|
69
|
+
try:
|
|
70
|
+
if 200 <= _response.status_code < 300:
|
|
71
|
+
return typing.cast(
|
|
72
|
+
typing.List[AnnotationReview],
|
|
73
|
+
construct_type(
|
|
74
|
+
type_=typing.List[AnnotationReview], # type: ignore
|
|
75
|
+
object_=_response.json(),
|
|
76
|
+
),
|
|
77
|
+
)
|
|
78
|
+
_response_json = _response.json()
|
|
79
|
+
except JSONDecodeError:
|
|
80
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
81
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
82
|
+
|
|
83
|
+
def create(
|
|
84
|
+
self,
|
|
85
|
+
*,
|
|
86
|
+
annotation: int,
|
|
87
|
+
async_postprocess: typing.Optional[bool] = None,
|
|
88
|
+
accepted: typing.Optional[bool] = OMIT,
|
|
89
|
+
comment: typing.Optional[str] = OMIT,
|
|
90
|
+
last_annotation_history: typing.Optional[int] = OMIT,
|
|
91
|
+
remove_from_queue: typing.Optional[bool] = OMIT,
|
|
92
|
+
result: typing.Optional[typing.Optional[typing.Any]] = OMIT,
|
|
93
|
+
started_at: typing.Optional[dt.datetime] = OMIT,
|
|
94
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
95
|
+
) -> AnnotationReview:
|
|
96
|
+
"""
|
|
97
|
+
Create a review for a specific annotation ID.
|
|
98
|
+
|
|
99
|
+
Parameters
|
|
100
|
+
----------
|
|
101
|
+
annotation : int
|
|
102
|
+
Corresponding annotation
|
|
103
|
+
|
|
104
|
+
async_postprocess : typing.Optional[bool]
|
|
105
|
+
Whether to postprocess the review asynchronously.
|
|
106
|
+
|
|
107
|
+
accepted : typing.Optional[bool]
|
|
108
|
+
Accepted or rejected (if false) flag
|
|
109
|
+
|
|
110
|
+
comment : typing.Optional[str]
|
|
111
|
+
|
|
112
|
+
last_annotation_history : typing.Optional[int]
|
|
113
|
+
|
|
114
|
+
remove_from_queue : typing.Optional[bool]
|
|
115
|
+
|
|
116
|
+
result : typing.Optional[typing.Optional[typing.Any]]
|
|
117
|
+
|
|
118
|
+
started_at : typing.Optional[dt.datetime]
|
|
119
|
+
|
|
120
|
+
request_options : typing.Optional[RequestOptions]
|
|
121
|
+
Request-specific configuration.
|
|
122
|
+
|
|
123
|
+
Returns
|
|
124
|
+
-------
|
|
125
|
+
AnnotationReview
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
Examples
|
|
129
|
+
--------
|
|
130
|
+
from label_studio_sdk import LabelStudio
|
|
131
|
+
|
|
132
|
+
client = LabelStudio(
|
|
133
|
+
api_key="YOUR_API_KEY",
|
|
134
|
+
)
|
|
135
|
+
client.annotation_reviews.create(
|
|
136
|
+
annotation=1,
|
|
137
|
+
)
|
|
138
|
+
"""
|
|
139
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
140
|
+
"api/annotation-reviews/",
|
|
141
|
+
method="POST",
|
|
142
|
+
params={
|
|
143
|
+
"async_postprocess": async_postprocess,
|
|
144
|
+
},
|
|
145
|
+
json={
|
|
146
|
+
"accepted": accepted,
|
|
147
|
+
"annotation": annotation,
|
|
148
|
+
"comment": comment,
|
|
149
|
+
"last_annotation_history": last_annotation_history,
|
|
150
|
+
"remove_from_queue": remove_from_queue,
|
|
151
|
+
"result": result,
|
|
152
|
+
"started_at": started_at,
|
|
153
|
+
},
|
|
154
|
+
request_options=request_options,
|
|
155
|
+
omit=OMIT,
|
|
156
|
+
)
|
|
157
|
+
try:
|
|
158
|
+
if 200 <= _response.status_code < 300:
|
|
159
|
+
return typing.cast(
|
|
160
|
+
AnnotationReview,
|
|
161
|
+
construct_type(
|
|
162
|
+
type_=AnnotationReview, # type: ignore
|
|
163
|
+
object_=_response.json(),
|
|
164
|
+
),
|
|
165
|
+
)
|
|
166
|
+
_response_json = _response.json()
|
|
167
|
+
except JSONDecodeError:
|
|
168
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
169
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
170
|
+
|
|
171
|
+
def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> AnnotationReview:
|
|
172
|
+
"""
|
|
173
|
+
Retrieve a specific review by ID for an annotation.
|
|
174
|
+
|
|
175
|
+
Parameters
|
|
176
|
+
----------
|
|
177
|
+
id : int
|
|
178
|
+
A unique integer value identifying this annotation review.
|
|
179
|
+
|
|
180
|
+
request_options : typing.Optional[RequestOptions]
|
|
181
|
+
Request-specific configuration.
|
|
182
|
+
|
|
183
|
+
Returns
|
|
184
|
+
-------
|
|
185
|
+
AnnotationReview
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
Examples
|
|
189
|
+
--------
|
|
190
|
+
from label_studio_sdk import LabelStudio
|
|
191
|
+
|
|
192
|
+
client = LabelStudio(
|
|
193
|
+
api_key="YOUR_API_KEY",
|
|
194
|
+
)
|
|
195
|
+
client.annotation_reviews.get(
|
|
196
|
+
id=1,
|
|
197
|
+
)
|
|
198
|
+
"""
|
|
199
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
200
|
+
f"api/annotation-reviews/{jsonable_encoder(id)}/",
|
|
201
|
+
method="GET",
|
|
202
|
+
request_options=request_options,
|
|
203
|
+
)
|
|
204
|
+
try:
|
|
205
|
+
if 200 <= _response.status_code < 300:
|
|
206
|
+
return typing.cast(
|
|
207
|
+
AnnotationReview,
|
|
208
|
+
construct_type(
|
|
209
|
+
type_=AnnotationReview, # type: ignore
|
|
210
|
+
object_=_response.json(),
|
|
211
|
+
),
|
|
212
|
+
)
|
|
213
|
+
_response_json = _response.json()
|
|
214
|
+
except JSONDecodeError:
|
|
215
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
216
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
217
|
+
|
|
218
|
+
def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
219
|
+
"""
|
|
220
|
+
Delete a review by ID
|
|
221
|
+
|
|
222
|
+
Parameters
|
|
223
|
+
----------
|
|
224
|
+
id : int
|
|
225
|
+
A unique integer value identifying this annotation review.
|
|
226
|
+
|
|
227
|
+
request_options : typing.Optional[RequestOptions]
|
|
228
|
+
Request-specific configuration.
|
|
229
|
+
|
|
230
|
+
Returns
|
|
231
|
+
-------
|
|
232
|
+
None
|
|
233
|
+
|
|
234
|
+
Examples
|
|
235
|
+
--------
|
|
236
|
+
from label_studio_sdk import LabelStudio
|
|
237
|
+
|
|
238
|
+
client = LabelStudio(
|
|
239
|
+
api_key="YOUR_API_KEY",
|
|
240
|
+
)
|
|
241
|
+
client.annotation_reviews.delete(
|
|
242
|
+
id=1,
|
|
243
|
+
)
|
|
244
|
+
"""
|
|
245
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
246
|
+
f"api/annotation-reviews/{jsonable_encoder(id)}/",
|
|
247
|
+
method="DELETE",
|
|
248
|
+
request_options=request_options,
|
|
249
|
+
)
|
|
250
|
+
try:
|
|
251
|
+
if 200 <= _response.status_code < 300:
|
|
252
|
+
return
|
|
253
|
+
_response_json = _response.json()
|
|
254
|
+
except JSONDecodeError:
|
|
255
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
256
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
257
|
+
|
|
258
|
+
def update(
|
|
259
|
+
self,
|
|
260
|
+
id: int,
|
|
261
|
+
*,
|
|
262
|
+
accepted: typing.Optional[bool] = OMIT,
|
|
263
|
+
annotation: typing.Optional[int] = OMIT,
|
|
264
|
+
comment: typing.Optional[str] = OMIT,
|
|
265
|
+
last_annotation_history: typing.Optional[int] = OMIT,
|
|
266
|
+
remove_from_queue: typing.Optional[bool] = OMIT,
|
|
267
|
+
result: typing.Optional[typing.Optional[typing.Any]] = OMIT,
|
|
268
|
+
started_at: typing.Optional[dt.datetime] = OMIT,
|
|
269
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
270
|
+
) -> AnnotationReview:
|
|
271
|
+
"""
|
|
272
|
+
Update a specific review by ID.
|
|
273
|
+
|
|
274
|
+
Parameters
|
|
275
|
+
----------
|
|
276
|
+
id : int
|
|
277
|
+
A unique integer value identifying this annotation review.
|
|
278
|
+
|
|
279
|
+
accepted : typing.Optional[bool]
|
|
280
|
+
Accepted or rejected (if false) flag
|
|
281
|
+
|
|
282
|
+
annotation : typing.Optional[int]
|
|
283
|
+
Corresponding annotation
|
|
284
|
+
|
|
285
|
+
comment : typing.Optional[str]
|
|
286
|
+
|
|
287
|
+
last_annotation_history : typing.Optional[int]
|
|
288
|
+
|
|
289
|
+
remove_from_queue : typing.Optional[bool]
|
|
290
|
+
|
|
291
|
+
result : typing.Optional[typing.Optional[typing.Any]]
|
|
292
|
+
|
|
293
|
+
started_at : typing.Optional[dt.datetime]
|
|
294
|
+
|
|
295
|
+
request_options : typing.Optional[RequestOptions]
|
|
296
|
+
Request-specific configuration.
|
|
297
|
+
|
|
298
|
+
Returns
|
|
299
|
+
-------
|
|
300
|
+
AnnotationReview
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
Examples
|
|
304
|
+
--------
|
|
305
|
+
from label_studio_sdk import LabelStudio
|
|
306
|
+
|
|
307
|
+
client = LabelStudio(
|
|
308
|
+
api_key="YOUR_API_KEY",
|
|
309
|
+
)
|
|
310
|
+
client.annotation_reviews.update(
|
|
311
|
+
id=1,
|
|
312
|
+
)
|
|
313
|
+
"""
|
|
314
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
315
|
+
f"api/annotation-reviews/{jsonable_encoder(id)}/",
|
|
316
|
+
method="PATCH",
|
|
317
|
+
json={
|
|
318
|
+
"accepted": accepted,
|
|
319
|
+
"annotation": annotation,
|
|
320
|
+
"comment": comment,
|
|
321
|
+
"last_annotation_history": last_annotation_history,
|
|
322
|
+
"remove_from_queue": remove_from_queue,
|
|
323
|
+
"result": result,
|
|
324
|
+
"started_at": started_at,
|
|
325
|
+
},
|
|
326
|
+
headers={
|
|
327
|
+
"content-type": "application/json",
|
|
328
|
+
},
|
|
329
|
+
request_options=request_options,
|
|
330
|
+
omit=OMIT,
|
|
331
|
+
)
|
|
332
|
+
try:
|
|
333
|
+
if 200 <= _response.status_code < 300:
|
|
334
|
+
return typing.cast(
|
|
335
|
+
AnnotationReview,
|
|
336
|
+
construct_type(
|
|
337
|
+
type_=AnnotationReview, # type: ignore
|
|
338
|
+
object_=_response.json(),
|
|
339
|
+
),
|
|
340
|
+
)
|
|
341
|
+
_response_json = _response.json()
|
|
342
|
+
except JSONDecodeError:
|
|
343
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
344
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
class AsyncAnnotationReviewsClient:
|
|
348
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
349
|
+
self._client_wrapper = client_wrapper
|
|
350
|
+
|
|
351
|
+
async def list(
|
|
352
|
+
self,
|
|
353
|
+
*,
|
|
354
|
+
annotation: typing.Optional[int] = None,
|
|
355
|
+
annotation_task_project: typing.Optional[int] = None,
|
|
356
|
+
ordering: typing.Optional[str] = None,
|
|
357
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
358
|
+
) -> typing.List[AnnotationReview]:
|
|
359
|
+
"""
|
|
360
|
+
List all reviews for a specific annotation ID.
|
|
361
|
+
|
|
362
|
+
Parameters
|
|
363
|
+
----------
|
|
364
|
+
annotation : typing.Optional[int]
|
|
365
|
+
|
|
366
|
+
annotation_task_project : typing.Optional[int]
|
|
367
|
+
|
|
368
|
+
ordering : typing.Optional[str]
|
|
369
|
+
Which field to use when ordering the results.
|
|
370
|
+
|
|
371
|
+
request_options : typing.Optional[RequestOptions]
|
|
372
|
+
Request-specific configuration.
|
|
373
|
+
|
|
374
|
+
Returns
|
|
375
|
+
-------
|
|
376
|
+
typing.List[AnnotationReview]
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
Examples
|
|
380
|
+
--------
|
|
381
|
+
import asyncio
|
|
382
|
+
|
|
383
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
384
|
+
|
|
385
|
+
client = AsyncLabelStudio(
|
|
386
|
+
api_key="YOUR_API_KEY",
|
|
387
|
+
)
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
async def main() -> None:
|
|
391
|
+
await client.annotation_reviews.list()
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
asyncio.run(main())
|
|
395
|
+
"""
|
|
396
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
397
|
+
"api/annotation-reviews/",
|
|
398
|
+
method="GET",
|
|
399
|
+
params={
|
|
400
|
+
"annotation": annotation,
|
|
401
|
+
"annotation__task__project": annotation_task_project,
|
|
402
|
+
"ordering": ordering,
|
|
403
|
+
},
|
|
404
|
+
request_options=request_options,
|
|
405
|
+
)
|
|
406
|
+
try:
|
|
407
|
+
if 200 <= _response.status_code < 300:
|
|
408
|
+
return typing.cast(
|
|
409
|
+
typing.List[AnnotationReview],
|
|
410
|
+
construct_type(
|
|
411
|
+
type_=typing.List[AnnotationReview], # type: ignore
|
|
412
|
+
object_=_response.json(),
|
|
413
|
+
),
|
|
414
|
+
)
|
|
415
|
+
_response_json = _response.json()
|
|
416
|
+
except JSONDecodeError:
|
|
417
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
418
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
419
|
+
|
|
420
|
+
async def create(
|
|
421
|
+
self,
|
|
422
|
+
*,
|
|
423
|
+
annotation: int,
|
|
424
|
+
async_postprocess: typing.Optional[bool] = None,
|
|
425
|
+
accepted: typing.Optional[bool] = OMIT,
|
|
426
|
+
comment: typing.Optional[str] = OMIT,
|
|
427
|
+
last_annotation_history: typing.Optional[int] = OMIT,
|
|
428
|
+
remove_from_queue: typing.Optional[bool] = OMIT,
|
|
429
|
+
result: typing.Optional[typing.Optional[typing.Any]] = OMIT,
|
|
430
|
+
started_at: typing.Optional[dt.datetime] = OMIT,
|
|
431
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
432
|
+
) -> AnnotationReview:
|
|
433
|
+
"""
|
|
434
|
+
Create a review for a specific annotation ID.
|
|
435
|
+
|
|
436
|
+
Parameters
|
|
437
|
+
----------
|
|
438
|
+
annotation : int
|
|
439
|
+
Corresponding annotation
|
|
440
|
+
|
|
441
|
+
async_postprocess : typing.Optional[bool]
|
|
442
|
+
Whether to postprocess the review asynchronously.
|
|
443
|
+
|
|
444
|
+
accepted : typing.Optional[bool]
|
|
445
|
+
Accepted or rejected (if false) flag
|
|
446
|
+
|
|
447
|
+
comment : typing.Optional[str]
|
|
448
|
+
|
|
449
|
+
last_annotation_history : typing.Optional[int]
|
|
450
|
+
|
|
451
|
+
remove_from_queue : typing.Optional[bool]
|
|
452
|
+
|
|
453
|
+
result : typing.Optional[typing.Optional[typing.Any]]
|
|
454
|
+
|
|
455
|
+
started_at : typing.Optional[dt.datetime]
|
|
456
|
+
|
|
457
|
+
request_options : typing.Optional[RequestOptions]
|
|
458
|
+
Request-specific configuration.
|
|
459
|
+
|
|
460
|
+
Returns
|
|
461
|
+
-------
|
|
462
|
+
AnnotationReview
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
Examples
|
|
466
|
+
--------
|
|
467
|
+
import asyncio
|
|
468
|
+
|
|
469
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
470
|
+
|
|
471
|
+
client = AsyncLabelStudio(
|
|
472
|
+
api_key="YOUR_API_KEY",
|
|
473
|
+
)
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
async def main() -> None:
|
|
477
|
+
await client.annotation_reviews.create(
|
|
478
|
+
annotation=1,
|
|
479
|
+
)
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
asyncio.run(main())
|
|
483
|
+
"""
|
|
484
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
485
|
+
"api/annotation-reviews/",
|
|
486
|
+
method="POST",
|
|
487
|
+
params={
|
|
488
|
+
"async_postprocess": async_postprocess,
|
|
489
|
+
},
|
|
490
|
+
json={
|
|
491
|
+
"accepted": accepted,
|
|
492
|
+
"annotation": annotation,
|
|
493
|
+
"comment": comment,
|
|
494
|
+
"last_annotation_history": last_annotation_history,
|
|
495
|
+
"remove_from_queue": remove_from_queue,
|
|
496
|
+
"result": result,
|
|
497
|
+
"started_at": started_at,
|
|
498
|
+
},
|
|
499
|
+
request_options=request_options,
|
|
500
|
+
omit=OMIT,
|
|
501
|
+
)
|
|
502
|
+
try:
|
|
503
|
+
if 200 <= _response.status_code < 300:
|
|
504
|
+
return typing.cast(
|
|
505
|
+
AnnotationReview,
|
|
506
|
+
construct_type(
|
|
507
|
+
type_=AnnotationReview, # type: ignore
|
|
508
|
+
object_=_response.json(),
|
|
509
|
+
),
|
|
510
|
+
)
|
|
511
|
+
_response_json = _response.json()
|
|
512
|
+
except JSONDecodeError:
|
|
513
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
514
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
515
|
+
|
|
516
|
+
async def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> AnnotationReview:
|
|
517
|
+
"""
|
|
518
|
+
Retrieve a specific review by ID for an annotation.
|
|
519
|
+
|
|
520
|
+
Parameters
|
|
521
|
+
----------
|
|
522
|
+
id : int
|
|
523
|
+
A unique integer value identifying this annotation review.
|
|
524
|
+
|
|
525
|
+
request_options : typing.Optional[RequestOptions]
|
|
526
|
+
Request-specific configuration.
|
|
527
|
+
|
|
528
|
+
Returns
|
|
529
|
+
-------
|
|
530
|
+
AnnotationReview
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
Examples
|
|
534
|
+
--------
|
|
535
|
+
import asyncio
|
|
536
|
+
|
|
537
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
538
|
+
|
|
539
|
+
client = AsyncLabelStudio(
|
|
540
|
+
api_key="YOUR_API_KEY",
|
|
541
|
+
)
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
async def main() -> None:
|
|
545
|
+
await client.annotation_reviews.get(
|
|
546
|
+
id=1,
|
|
547
|
+
)
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
asyncio.run(main())
|
|
551
|
+
"""
|
|
552
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
553
|
+
f"api/annotation-reviews/{jsonable_encoder(id)}/",
|
|
554
|
+
method="GET",
|
|
555
|
+
request_options=request_options,
|
|
556
|
+
)
|
|
557
|
+
try:
|
|
558
|
+
if 200 <= _response.status_code < 300:
|
|
559
|
+
return typing.cast(
|
|
560
|
+
AnnotationReview,
|
|
561
|
+
construct_type(
|
|
562
|
+
type_=AnnotationReview, # type: ignore
|
|
563
|
+
object_=_response.json(),
|
|
564
|
+
),
|
|
565
|
+
)
|
|
566
|
+
_response_json = _response.json()
|
|
567
|
+
except JSONDecodeError:
|
|
568
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
569
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
570
|
+
|
|
571
|
+
async def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
572
|
+
"""
|
|
573
|
+
Delete a review by ID
|
|
574
|
+
|
|
575
|
+
Parameters
|
|
576
|
+
----------
|
|
577
|
+
id : int
|
|
578
|
+
A unique integer value identifying this annotation review.
|
|
579
|
+
|
|
580
|
+
request_options : typing.Optional[RequestOptions]
|
|
581
|
+
Request-specific configuration.
|
|
582
|
+
|
|
583
|
+
Returns
|
|
584
|
+
-------
|
|
585
|
+
None
|
|
586
|
+
|
|
587
|
+
Examples
|
|
588
|
+
--------
|
|
589
|
+
import asyncio
|
|
590
|
+
|
|
591
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
592
|
+
|
|
593
|
+
client = AsyncLabelStudio(
|
|
594
|
+
api_key="YOUR_API_KEY",
|
|
595
|
+
)
|
|
596
|
+
|
|
597
|
+
|
|
598
|
+
async def main() -> None:
|
|
599
|
+
await client.annotation_reviews.delete(
|
|
600
|
+
id=1,
|
|
601
|
+
)
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
asyncio.run(main())
|
|
605
|
+
"""
|
|
606
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
607
|
+
f"api/annotation-reviews/{jsonable_encoder(id)}/",
|
|
608
|
+
method="DELETE",
|
|
609
|
+
request_options=request_options,
|
|
610
|
+
)
|
|
611
|
+
try:
|
|
612
|
+
if 200 <= _response.status_code < 300:
|
|
613
|
+
return
|
|
614
|
+
_response_json = _response.json()
|
|
615
|
+
except JSONDecodeError:
|
|
616
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
617
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
618
|
+
|
|
619
|
+
async def update(
|
|
620
|
+
self,
|
|
621
|
+
id: int,
|
|
622
|
+
*,
|
|
623
|
+
accepted: typing.Optional[bool] = OMIT,
|
|
624
|
+
annotation: typing.Optional[int] = OMIT,
|
|
625
|
+
comment: typing.Optional[str] = OMIT,
|
|
626
|
+
last_annotation_history: typing.Optional[int] = OMIT,
|
|
627
|
+
remove_from_queue: typing.Optional[bool] = OMIT,
|
|
628
|
+
result: typing.Optional[typing.Optional[typing.Any]] = OMIT,
|
|
629
|
+
started_at: typing.Optional[dt.datetime] = OMIT,
|
|
630
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
631
|
+
) -> AnnotationReview:
|
|
632
|
+
"""
|
|
633
|
+
Update a specific review by ID.
|
|
634
|
+
|
|
635
|
+
Parameters
|
|
636
|
+
----------
|
|
637
|
+
id : int
|
|
638
|
+
A unique integer value identifying this annotation review.
|
|
639
|
+
|
|
640
|
+
accepted : typing.Optional[bool]
|
|
641
|
+
Accepted or rejected (if false) flag
|
|
642
|
+
|
|
643
|
+
annotation : typing.Optional[int]
|
|
644
|
+
Corresponding annotation
|
|
645
|
+
|
|
646
|
+
comment : typing.Optional[str]
|
|
647
|
+
|
|
648
|
+
last_annotation_history : typing.Optional[int]
|
|
649
|
+
|
|
650
|
+
remove_from_queue : typing.Optional[bool]
|
|
651
|
+
|
|
652
|
+
result : typing.Optional[typing.Optional[typing.Any]]
|
|
653
|
+
|
|
654
|
+
started_at : typing.Optional[dt.datetime]
|
|
655
|
+
|
|
656
|
+
request_options : typing.Optional[RequestOptions]
|
|
657
|
+
Request-specific configuration.
|
|
658
|
+
|
|
659
|
+
Returns
|
|
660
|
+
-------
|
|
661
|
+
AnnotationReview
|
|
662
|
+
|
|
663
|
+
|
|
664
|
+
Examples
|
|
665
|
+
--------
|
|
666
|
+
import asyncio
|
|
667
|
+
|
|
668
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
669
|
+
|
|
670
|
+
client = AsyncLabelStudio(
|
|
671
|
+
api_key="YOUR_API_KEY",
|
|
672
|
+
)
|
|
673
|
+
|
|
674
|
+
|
|
675
|
+
async def main() -> None:
|
|
676
|
+
await client.annotation_reviews.update(
|
|
677
|
+
id=1,
|
|
678
|
+
)
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
asyncio.run(main())
|
|
682
|
+
"""
|
|
683
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
684
|
+
f"api/annotation-reviews/{jsonable_encoder(id)}/",
|
|
685
|
+
method="PATCH",
|
|
686
|
+
json={
|
|
687
|
+
"accepted": accepted,
|
|
688
|
+
"annotation": annotation,
|
|
689
|
+
"comment": comment,
|
|
690
|
+
"last_annotation_history": last_annotation_history,
|
|
691
|
+
"remove_from_queue": remove_from_queue,
|
|
692
|
+
"result": result,
|
|
693
|
+
"started_at": started_at,
|
|
694
|
+
},
|
|
695
|
+
headers={
|
|
696
|
+
"content-type": "application/json",
|
|
697
|
+
},
|
|
698
|
+
request_options=request_options,
|
|
699
|
+
omit=OMIT,
|
|
700
|
+
)
|
|
701
|
+
try:
|
|
702
|
+
if 200 <= _response.status_code < 300:
|
|
703
|
+
return typing.cast(
|
|
704
|
+
AnnotationReview,
|
|
705
|
+
construct_type(
|
|
706
|
+
type_=AnnotationReview, # type: ignore
|
|
707
|
+
object_=_response.json(),
|
|
708
|
+
),
|
|
709
|
+
)
|
|
710
|
+
_response_json = _response.json()
|
|
711
|
+
except JSONDecodeError:
|
|
712
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
713
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|