label-studio-sdk 2.0.6__py3-none-any.whl → 2.0.8__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.
- label_studio_sdk/__init__.py +32 -2
- label_studio_sdk/base_client.py +4 -0
- label_studio_sdk/converter/exports/yolo.py +89 -74
- label_studio_sdk/core/client_wrapper.py +1 -1
- label_studio_sdk/import_storage/azure_spi/client.py +30 -0
- 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 +540 -1
- label_studio_sdk/organizations/invites/__init__.py +2 -0
- label_studio_sdk/organizations/invites/client.py +368 -0
- label_studio_sdk/organizations/permissions/__init__.py +2 -0
- label_studio_sdk/organizations/permissions/client.py +1129 -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/__init__.py +30 -0
- label_studio_sdk/projects/client.py +355 -0
- label_studio_sdk/projects/stats/__init__.py +28 -0
- label_studio_sdk/projects/stats/client.py +1002 -43
- label_studio_sdk/projects/stats/types/__init__.py +30 -0
- label_studio_sdk/projects/stats/types/stats_agreement_annotator_response.py +26 -0
- label_studio_sdk/projects/stats/types/stats_data_filters_response.py +23 -0
- label_studio_sdk/projects/stats/types/stats_data_filters_response_user_filters.py +34 -0
- label_studio_sdk/projects/stats/types/stats_data_filters_response_user_filters_stats_item.py +22 -0
- label_studio_sdk/projects/stats/types/stats_finished_tasks_response.py +32 -0
- label_studio_sdk/projects/stats/types/stats_lead_time_response.py +23 -0
- label_studio_sdk/projects/stats/types/stats_lead_time_response_lead_time_stats_item.py +37 -0
- label_studio_sdk/projects/stats/types/stats_user_ground_truth_agreement_response.py +20 -0
- label_studio_sdk/projects/stats/types/stats_user_ground_truth_agreement_response_agreement.py +5 -0
- label_studio_sdk/projects/stats/types/stats_user_prediction_agreement_response.py +24 -0
- label_studio_sdk/projects/stats/types/stats_user_prediction_agreement_response_average_prediction_agreement_per_user.py +5 -0
- label_studio_sdk/projects/stats/types/stats_user_review_score_response.py +22 -0
- label_studio_sdk/projects/stats/types/stats_user_review_score_response_performance_score.py +5 -0
- label_studio_sdk/projects/stats/types/stats_user_review_score_response_review_score.py +5 -0
- label_studio_sdk/projects/types/__init__.py +2 -0
- label_studio_sdk/projects/types/projects_import_predictions_response.py +26 -0
- label_studio_sdk/prompts/versions/client.py +4 -16
- label_studio_sdk/types/__init__.py +26 -2
- label_studio_sdk/types/azure_service_principal_import_storage.py +5 -0
- label_studio_sdk/types/azure_service_principal_import_storage_request.py +5 -0
- label_studio_sdk/types/configurable_permission_option.py +25 -0
- label_studio_sdk/types/configurable_permission_option_default.py +7 -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/lse_organization.py +2 -2
- label_studio_sdk/types/lse_project.py +223 -0
- label_studio_sdk/types/lse_project_counts.py +46 -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_task.py +1 -1
- label_studio_sdk/types/lse_task_serializer_for_reviewers.py +1 -1
- label_studio_sdk/types/organization_permission.py +31 -0
- label_studio_sdk/types/organization_permission_request.py +24 -0
- label_studio_sdk/types/paginated_lse_project_counts_list.py +23 -0
- label_studio_sdk/types/project_template.py +41 -0
- label_studio_sdk/types/project_template_request.py +38 -0
- label_studio_sdk/types/who_am_i_user.py +1 -0
- {label_studio_sdk-2.0.6.dist-info → label_studio_sdk-2.0.8.dist-info}/METADATA +1 -1
- {label_studio_sdk-2.0.6.dist-info → label_studio_sdk-2.0.8.dist-info}/RECORD +66 -31
- label_studio_sdk/types/default_role_enum.py +0 -5
- {label_studio_sdk-2.0.6.dist-info → label_studio_sdk-2.0.8.dist-info}/LICENSE +0 -0
- {label_studio_sdk-2.0.6.dist-info → label_studio_sdk-2.0.8.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,368 @@
|
|
|
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.organization_invite import OrganizationInvite
|
|
7
|
+
from ...core.unchecked_base_model import construct_type
|
|
8
|
+
from ...errors.forbidden_error import ForbiddenError
|
|
9
|
+
from json.decoder import JSONDecodeError
|
|
10
|
+
from ...core.api_error import ApiError
|
|
11
|
+
from ...core.client_wrapper import AsyncClientWrapper
|
|
12
|
+
|
|
13
|
+
# this is used as the default value for optional parameters
|
|
14
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class InvitesClient:
|
|
18
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
19
|
+
self._client_wrapper = client_wrapper
|
|
20
|
+
|
|
21
|
+
def get_invite_link(self, *, request_options: typing.Optional[RequestOptions] = None) -> OrganizationInvite:
|
|
22
|
+
"""
|
|
23
|
+
Get invite link for organization
|
|
24
|
+
|
|
25
|
+
Parameters
|
|
26
|
+
----------
|
|
27
|
+
request_options : typing.Optional[RequestOptions]
|
|
28
|
+
Request-specific configuration.
|
|
29
|
+
|
|
30
|
+
Returns
|
|
31
|
+
-------
|
|
32
|
+
OrganizationInvite
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
Examples
|
|
36
|
+
--------
|
|
37
|
+
from label_studio_sdk import LabelStudio
|
|
38
|
+
|
|
39
|
+
client = LabelStudio(
|
|
40
|
+
api_key="YOUR_API_KEY",
|
|
41
|
+
)
|
|
42
|
+
client.organizations.invites.get_invite_link()
|
|
43
|
+
"""
|
|
44
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
45
|
+
"api/invite",
|
|
46
|
+
method="GET",
|
|
47
|
+
request_options=request_options,
|
|
48
|
+
)
|
|
49
|
+
try:
|
|
50
|
+
if 200 <= _response.status_code < 300:
|
|
51
|
+
return typing.cast(
|
|
52
|
+
OrganizationInvite,
|
|
53
|
+
construct_type(
|
|
54
|
+
type_=OrganizationInvite, # type: ignore
|
|
55
|
+
object_=_response.json(),
|
|
56
|
+
),
|
|
57
|
+
)
|
|
58
|
+
if _response.status_code == 403:
|
|
59
|
+
raise ForbiddenError(
|
|
60
|
+
typing.cast(
|
|
61
|
+
typing.Optional[typing.Any],
|
|
62
|
+
construct_type(
|
|
63
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
64
|
+
object_=_response.json(),
|
|
65
|
+
),
|
|
66
|
+
)
|
|
67
|
+
)
|
|
68
|
+
_response_json = _response.json()
|
|
69
|
+
except JSONDecodeError:
|
|
70
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
71
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
72
|
+
|
|
73
|
+
def revoke_invite(self, *, email: str, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
74
|
+
"""
|
|
75
|
+
Revoke invite to organization
|
|
76
|
+
|
|
77
|
+
Parameters
|
|
78
|
+
----------
|
|
79
|
+
email : str
|
|
80
|
+
|
|
81
|
+
request_options : typing.Optional[RequestOptions]
|
|
82
|
+
Request-specific configuration.
|
|
83
|
+
|
|
84
|
+
Returns
|
|
85
|
+
-------
|
|
86
|
+
None
|
|
87
|
+
|
|
88
|
+
Examples
|
|
89
|
+
--------
|
|
90
|
+
from label_studio_sdk import LabelStudio
|
|
91
|
+
|
|
92
|
+
client = LabelStudio(
|
|
93
|
+
api_key="YOUR_API_KEY",
|
|
94
|
+
)
|
|
95
|
+
client.organizations.invites.revoke_invite(
|
|
96
|
+
email="email",
|
|
97
|
+
)
|
|
98
|
+
"""
|
|
99
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
100
|
+
"api/invite/revoke",
|
|
101
|
+
method="POST",
|
|
102
|
+
json={
|
|
103
|
+
"email": email,
|
|
104
|
+
},
|
|
105
|
+
headers={
|
|
106
|
+
"content-type": "application/json",
|
|
107
|
+
},
|
|
108
|
+
request_options=request_options,
|
|
109
|
+
omit=OMIT,
|
|
110
|
+
)
|
|
111
|
+
try:
|
|
112
|
+
if 200 <= _response.status_code < 300:
|
|
113
|
+
return
|
|
114
|
+
_response_json = _response.json()
|
|
115
|
+
except JSONDecodeError:
|
|
116
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
117
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
118
|
+
|
|
119
|
+
def send_email(
|
|
120
|
+
self, *, emails: typing.Sequence[str], role: str, request_options: typing.Optional[RequestOptions] = None
|
|
121
|
+
) -> None:
|
|
122
|
+
"""
|
|
123
|
+
Send email with invite to organization
|
|
124
|
+
|
|
125
|
+
Parameters
|
|
126
|
+
----------
|
|
127
|
+
emails : typing.Sequence[str]
|
|
128
|
+
|
|
129
|
+
role : str
|
|
130
|
+
|
|
131
|
+
request_options : typing.Optional[RequestOptions]
|
|
132
|
+
Request-specific configuration.
|
|
133
|
+
|
|
134
|
+
Returns
|
|
135
|
+
-------
|
|
136
|
+
None
|
|
137
|
+
|
|
138
|
+
Examples
|
|
139
|
+
--------
|
|
140
|
+
from label_studio_sdk import LabelStudio
|
|
141
|
+
|
|
142
|
+
client = LabelStudio(
|
|
143
|
+
api_key="YOUR_API_KEY",
|
|
144
|
+
)
|
|
145
|
+
client.organizations.invites.send_email(
|
|
146
|
+
emails=["emails"],
|
|
147
|
+
role="role",
|
|
148
|
+
)
|
|
149
|
+
"""
|
|
150
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
151
|
+
"api/invite/send-email",
|
|
152
|
+
method="POST",
|
|
153
|
+
json={
|
|
154
|
+
"emails": emails,
|
|
155
|
+
"role": role,
|
|
156
|
+
},
|
|
157
|
+
headers={
|
|
158
|
+
"content-type": "application/json",
|
|
159
|
+
},
|
|
160
|
+
request_options=request_options,
|
|
161
|
+
omit=OMIT,
|
|
162
|
+
)
|
|
163
|
+
try:
|
|
164
|
+
if 200 <= _response.status_code < 300:
|
|
165
|
+
return
|
|
166
|
+
if _response.status_code == 403:
|
|
167
|
+
raise ForbiddenError(
|
|
168
|
+
typing.cast(
|
|
169
|
+
typing.Optional[typing.Any],
|
|
170
|
+
construct_type(
|
|
171
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
172
|
+
object_=_response.json(),
|
|
173
|
+
),
|
|
174
|
+
)
|
|
175
|
+
)
|
|
176
|
+
_response_json = _response.json()
|
|
177
|
+
except JSONDecodeError:
|
|
178
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
179
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
class AsyncInvitesClient:
|
|
183
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
184
|
+
self._client_wrapper = client_wrapper
|
|
185
|
+
|
|
186
|
+
async def get_invite_link(self, *, request_options: typing.Optional[RequestOptions] = None) -> OrganizationInvite:
|
|
187
|
+
"""
|
|
188
|
+
Get invite link for organization
|
|
189
|
+
|
|
190
|
+
Parameters
|
|
191
|
+
----------
|
|
192
|
+
request_options : typing.Optional[RequestOptions]
|
|
193
|
+
Request-specific configuration.
|
|
194
|
+
|
|
195
|
+
Returns
|
|
196
|
+
-------
|
|
197
|
+
OrganizationInvite
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
Examples
|
|
201
|
+
--------
|
|
202
|
+
import asyncio
|
|
203
|
+
|
|
204
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
205
|
+
|
|
206
|
+
client = AsyncLabelStudio(
|
|
207
|
+
api_key="YOUR_API_KEY",
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
async def main() -> None:
|
|
212
|
+
await client.organizations.invites.get_invite_link()
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
asyncio.run(main())
|
|
216
|
+
"""
|
|
217
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
218
|
+
"api/invite",
|
|
219
|
+
method="GET",
|
|
220
|
+
request_options=request_options,
|
|
221
|
+
)
|
|
222
|
+
try:
|
|
223
|
+
if 200 <= _response.status_code < 300:
|
|
224
|
+
return typing.cast(
|
|
225
|
+
OrganizationInvite,
|
|
226
|
+
construct_type(
|
|
227
|
+
type_=OrganizationInvite, # type: ignore
|
|
228
|
+
object_=_response.json(),
|
|
229
|
+
),
|
|
230
|
+
)
|
|
231
|
+
if _response.status_code == 403:
|
|
232
|
+
raise ForbiddenError(
|
|
233
|
+
typing.cast(
|
|
234
|
+
typing.Optional[typing.Any],
|
|
235
|
+
construct_type(
|
|
236
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
237
|
+
object_=_response.json(),
|
|
238
|
+
),
|
|
239
|
+
)
|
|
240
|
+
)
|
|
241
|
+
_response_json = _response.json()
|
|
242
|
+
except JSONDecodeError:
|
|
243
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
244
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
245
|
+
|
|
246
|
+
async def revoke_invite(self, *, email: str, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
247
|
+
"""
|
|
248
|
+
Revoke invite to organization
|
|
249
|
+
|
|
250
|
+
Parameters
|
|
251
|
+
----------
|
|
252
|
+
email : str
|
|
253
|
+
|
|
254
|
+
request_options : typing.Optional[RequestOptions]
|
|
255
|
+
Request-specific configuration.
|
|
256
|
+
|
|
257
|
+
Returns
|
|
258
|
+
-------
|
|
259
|
+
None
|
|
260
|
+
|
|
261
|
+
Examples
|
|
262
|
+
--------
|
|
263
|
+
import asyncio
|
|
264
|
+
|
|
265
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
266
|
+
|
|
267
|
+
client = AsyncLabelStudio(
|
|
268
|
+
api_key="YOUR_API_KEY",
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
async def main() -> None:
|
|
273
|
+
await client.organizations.invites.revoke_invite(
|
|
274
|
+
email="email",
|
|
275
|
+
)
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
asyncio.run(main())
|
|
279
|
+
"""
|
|
280
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
281
|
+
"api/invite/revoke",
|
|
282
|
+
method="POST",
|
|
283
|
+
json={
|
|
284
|
+
"email": email,
|
|
285
|
+
},
|
|
286
|
+
headers={
|
|
287
|
+
"content-type": "application/json",
|
|
288
|
+
},
|
|
289
|
+
request_options=request_options,
|
|
290
|
+
omit=OMIT,
|
|
291
|
+
)
|
|
292
|
+
try:
|
|
293
|
+
if 200 <= _response.status_code < 300:
|
|
294
|
+
return
|
|
295
|
+
_response_json = _response.json()
|
|
296
|
+
except JSONDecodeError:
|
|
297
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
298
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
299
|
+
|
|
300
|
+
async def send_email(
|
|
301
|
+
self, *, emails: typing.Sequence[str], role: str, request_options: typing.Optional[RequestOptions] = None
|
|
302
|
+
) -> None:
|
|
303
|
+
"""
|
|
304
|
+
Send email with invite to organization
|
|
305
|
+
|
|
306
|
+
Parameters
|
|
307
|
+
----------
|
|
308
|
+
emails : typing.Sequence[str]
|
|
309
|
+
|
|
310
|
+
role : str
|
|
311
|
+
|
|
312
|
+
request_options : typing.Optional[RequestOptions]
|
|
313
|
+
Request-specific configuration.
|
|
314
|
+
|
|
315
|
+
Returns
|
|
316
|
+
-------
|
|
317
|
+
None
|
|
318
|
+
|
|
319
|
+
Examples
|
|
320
|
+
--------
|
|
321
|
+
import asyncio
|
|
322
|
+
|
|
323
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
324
|
+
|
|
325
|
+
client = AsyncLabelStudio(
|
|
326
|
+
api_key="YOUR_API_KEY",
|
|
327
|
+
)
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
async def main() -> None:
|
|
331
|
+
await client.organizations.invites.send_email(
|
|
332
|
+
emails=["emails"],
|
|
333
|
+
role="role",
|
|
334
|
+
)
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
asyncio.run(main())
|
|
338
|
+
"""
|
|
339
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
340
|
+
"api/invite/send-email",
|
|
341
|
+
method="POST",
|
|
342
|
+
json={
|
|
343
|
+
"emails": emails,
|
|
344
|
+
"role": role,
|
|
345
|
+
},
|
|
346
|
+
headers={
|
|
347
|
+
"content-type": "application/json",
|
|
348
|
+
},
|
|
349
|
+
request_options=request_options,
|
|
350
|
+
omit=OMIT,
|
|
351
|
+
)
|
|
352
|
+
try:
|
|
353
|
+
if 200 <= _response.status_code < 300:
|
|
354
|
+
return
|
|
355
|
+
if _response.status_code == 403:
|
|
356
|
+
raise ForbiddenError(
|
|
357
|
+
typing.cast(
|
|
358
|
+
typing.Optional[typing.Any],
|
|
359
|
+
construct_type(
|
|
360
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
361
|
+
object_=_response.json(),
|
|
362
|
+
),
|
|
363
|
+
)
|
|
364
|
+
)
|
|
365
|
+
_response_json = _response.json()
|
|
366
|
+
except JSONDecodeError:
|
|
367
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
368
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|