label-studio-sdk 1.0.7__py3-none-any.whl → 1.0.10__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 +26 -7
- label_studio_sdk/_extensions/label_studio_tools/core/label_config.py +13 -4
- label_studio_sdk/_extensions/label_studio_tools/core/utils/io.py +16 -4
- label_studio_sdk/_extensions/label_studio_tools/core/utils/json_schema.py +86 -0
- label_studio_sdk/_extensions/pager_ext.py +8 -0
- label_studio_sdk/_legacy/schema/label_config_schema.json +42 -11
- label_studio_sdk/actions/client.py +91 -40
- label_studio_sdk/actions/types/actions_create_request_filters.py +14 -24
- label_studio_sdk/actions/types/actions_create_request_filters_items_item.py +16 -26
- label_studio_sdk/actions/types/actions_create_request_filters_items_item_value.py +3 -1
- label_studio_sdk/actions/types/actions_create_request_selected_items.py +1 -2
- label_studio_sdk/actions/types/actions_create_request_selected_items_excluded.py +15 -25
- label_studio_sdk/actions/types/actions_create_request_selected_items_included.py +15 -25
- label_studio_sdk/annotations/__init__.py +2 -2
- label_studio_sdk/annotations/client.py +278 -104
- label_studio_sdk/annotations/types/__init__.py +2 -1
- label_studio_sdk/annotations/types/annotations_create_bulk_request_selected_items.py +34 -0
- label_studio_sdk/annotations/types/annotations_create_bulk_response_item.py +11 -21
- label_studio_sdk/base_client.py +46 -27
- label_studio_sdk/client.py +1 -0
- label_studio_sdk/comments/client.py +190 -44
- label_studio_sdk/converter/converter.py +66 -18
- label_studio_sdk/converter/imports/yolo.py +1 -1
- label_studio_sdk/converter/utils.py +3 -2
- label_studio_sdk/core/__init__.py +21 -4
- label_studio_sdk/core/client_wrapper.py +9 -10
- label_studio_sdk/core/file.py +37 -8
- label_studio_sdk/core/http_client.py +52 -28
- label_studio_sdk/core/jsonable_encoder.py +33 -31
- label_studio_sdk/core/pagination.py +5 -4
- label_studio_sdk/core/pydantic_utilities.py +272 -4
- label_studio_sdk/core/query_encoder.py +38 -13
- label_studio_sdk/core/request_options.py +3 -0
- label_studio_sdk/core/serialization.py +272 -0
- label_studio_sdk/errors/bad_request_error.py +2 -3
- label_studio_sdk/export_storage/azure/client.py +228 -58
- label_studio_sdk/export_storage/azure/types/azure_create_response.py +19 -29
- label_studio_sdk/export_storage/azure/types/azure_update_response.py +19 -29
- label_studio_sdk/export_storage/client.py +48 -18
- label_studio_sdk/export_storage/gcs/client.py +228 -58
- label_studio_sdk/export_storage/gcs/types/gcs_create_response.py +19 -29
- label_studio_sdk/export_storage/gcs/types/gcs_update_response.py +19 -29
- label_studio_sdk/export_storage/local/client.py +222 -56
- label_studio_sdk/export_storage/local/types/local_create_response.py +17 -27
- label_studio_sdk/export_storage/local/types/local_update_response.py +17 -27
- label_studio_sdk/export_storage/redis/client.py +228 -58
- label_studio_sdk/export_storage/redis/types/redis_create_response.py +20 -30
- label_studio_sdk/export_storage/redis/types/redis_update_response.py +20 -30
- label_studio_sdk/export_storage/s3/client.py +228 -58
- label_studio_sdk/export_storage/s3/types/s3create_response.py +27 -35
- label_studio_sdk/export_storage/s3/types/s3update_response.py +27 -35
- label_studio_sdk/export_storage/s3s/client.py +187 -43
- label_studio_sdk/export_storage/types/export_storage_list_types_response_item.py +11 -21
- label_studio_sdk/files/client.py +172 -56
- label_studio_sdk/import_storage/azure/client.py +223 -53
- label_studio_sdk/import_storage/azure/types/azure_create_response.py +22 -32
- label_studio_sdk/import_storage/azure/types/azure_update_response.py +22 -32
- label_studio_sdk/import_storage/client.py +48 -18
- label_studio_sdk/import_storage/gcs/client.py +223 -53
- label_studio_sdk/import_storage/gcs/types/gcs_create_response.py +22 -32
- label_studio_sdk/import_storage/gcs/types/gcs_update_response.py +22 -32
- label_studio_sdk/import_storage/local/client.py +223 -53
- label_studio_sdk/import_storage/local/types/local_create_response.py +17 -27
- label_studio_sdk/import_storage/local/types/local_update_response.py +17 -27
- label_studio_sdk/import_storage/redis/client.py +223 -53
- label_studio_sdk/import_storage/redis/types/redis_create_response.py +20 -30
- label_studio_sdk/import_storage/redis/types/redis_update_response.py +20 -30
- label_studio_sdk/import_storage/s3/client.py +223 -53
- label_studio_sdk/import_storage/s3/types/s3create_response.py +31 -39
- label_studio_sdk/import_storage/s3/types/s3update_response.py +31 -39
- label_studio_sdk/import_storage/s3s/client.py +222 -52
- label_studio_sdk/import_storage/types/import_storage_list_types_response_item.py +11 -21
- label_studio_sdk/label_interface/control_tags.py +205 -10
- label_studio_sdk/label_interface/interface.py +80 -6
- label_studio_sdk/label_interface/region.py +1 -10
- label_studio_sdk/ml/client.py +280 -78
- label_studio_sdk/ml/types/ml_create_response.py +21 -31
- label_studio_sdk/ml/types/ml_update_response.py +21 -31
- label_studio_sdk/model_providers/client.py +656 -21
- label_studio_sdk/predictions/client.py +247 -101
- label_studio_sdk/projects/__init__.py +3 -0
- label_studio_sdk/projects/client.py +309 -115
- label_studio_sdk/projects/client_ext.py +16 -0
- label_studio_sdk/projects/exports/__init__.py +3 -0
- label_studio_sdk/projects/exports/client.py +447 -296
- label_studio_sdk/projects/exports/client_ext.py +134 -0
- label_studio_sdk/projects/exports/types/__init__.py +6 -0
- label_studio_sdk/projects/exports/types/exports_convert_response.py +24 -0
- label_studio_sdk/projects/exports/types/exports_list_formats_response_item.py +44 -0
- label_studio_sdk/projects/types/projects_create_response.py +29 -34
- label_studio_sdk/projects/types/projects_import_tasks_response.py +19 -29
- label_studio_sdk/projects/types/projects_list_response.py +11 -21
- label_studio_sdk/projects/types/projects_update_response.py +24 -34
- label_studio_sdk/prompts/client.py +309 -92
- label_studio_sdk/prompts/indicators/client.py +67 -23
- label_studio_sdk/prompts/runs/client.py +95 -40
- label_studio_sdk/prompts/types/prompts_batch_failed_predictions_request_failed_predictions_item.py +14 -24
- label_studio_sdk/prompts/types/prompts_batch_failed_predictions_response.py +11 -21
- label_studio_sdk/prompts/types/prompts_batch_predictions_request_results_item.py +26 -29
- label_studio_sdk/prompts/types/prompts_batch_predictions_response.py +11 -21
- label_studio_sdk/prompts/versions/client.py +389 -75
- label_studio_sdk/tasks/client.py +263 -90
- label_studio_sdk/tasks/types/tasks_list_response.py +15 -25
- label_studio_sdk/types/__init__.py +16 -6
- label_studio_sdk/types/annotation.py +29 -38
- label_studio_sdk/types/annotation_filter_options.py +14 -24
- label_studio_sdk/types/annotations_dm_field.py +30 -39
- label_studio_sdk/types/azure_blob_export_storage.py +28 -37
- label_studio_sdk/types/azure_blob_import_storage.py +28 -37
- label_studio_sdk/types/base_task.py +30 -39
- label_studio_sdk/types/base_task_updated_by.py +3 -1
- label_studio_sdk/types/base_user.py +14 -21
- label_studio_sdk/types/comment.py +12 -21
- label_studio_sdk/types/comment_created_by.py +1 -1
- label_studio_sdk/types/converted_format.py +12 -22
- label_studio_sdk/types/data_manager_task_serializer.py +31 -40
- label_studio_sdk/types/data_manager_task_serializer_annotators_item.py +1 -1
- label_studio_sdk/types/data_manager_task_serializer_drafts_item.py +13 -22
- label_studio_sdk/types/data_manager_task_serializer_predictions_item.py +15 -24
- label_studio_sdk/types/export.py +17 -26
- label_studio_sdk/types/export_format.py +25 -0
- label_studio_sdk/types/export_snapshot.py +45 -0
- label_studio_sdk/types/export_snapshot_status.py +5 -0
- label_studio_sdk/types/file_upload.py +11 -21
- label_studio_sdk/types/filter.py +16 -26
- label_studio_sdk/types/filter_group.py +12 -22
- label_studio_sdk/types/gcs_export_storage.py +28 -37
- label_studio_sdk/types/gcs_import_storage.py +28 -37
- label_studio_sdk/types/inference_run.py +14 -23
- label_studio_sdk/types/inference_run_cost_estimate.py +47 -0
- label_studio_sdk/types/inference_run_created_by.py +1 -1
- label_studio_sdk/types/inference_run_organization.py +1 -1
- label_studio_sdk/types/key_indicator_value.py +12 -22
- label_studio_sdk/types/key_indicators.py +0 -1
- label_studio_sdk/types/key_indicators_item.py +15 -25
- label_studio_sdk/types/key_indicators_item_additional_kpis_item.py +13 -23
- label_studio_sdk/types/key_indicators_item_extra_kpis_item.py +13 -23
- label_studio_sdk/types/local_files_export_storage.py +25 -34
- label_studio_sdk/types/local_files_import_storage.py +24 -33
- label_studio_sdk/types/ml_backend.py +23 -32
- label_studio_sdk/types/model_provider_connection.py +47 -26
- label_studio_sdk/types/model_provider_connection_budget_reset_period.py +5 -0
- label_studio_sdk/types/model_provider_connection_created_by.py +1 -1
- label_studio_sdk/types/model_provider_connection_organization.py +1 -1
- label_studio_sdk/types/model_provider_connection_provider.py +3 -1
- label_studio_sdk/types/prediction.py +21 -30
- label_studio_sdk/types/project.py +48 -55
- label_studio_sdk/types/project_import.py +21 -30
- label_studio_sdk/types/project_label_config.py +12 -22
- label_studio_sdk/types/prompt.py +24 -32
- label_studio_sdk/types/prompt_associated_projects_item.py +6 -0
- label_studio_sdk/types/prompt_associated_projects_item_id.py +20 -0
- label_studio_sdk/types/prompt_created_by.py +1 -1
- label_studio_sdk/types/prompt_organization.py +1 -1
- label_studio_sdk/types/prompt_version.py +13 -22
- label_studio_sdk/types/prompt_version_created_by.py +1 -1
- label_studio_sdk/types/prompt_version_organization.py +1 -1
- label_studio_sdk/types/prompt_version_provider.py +3 -1
- label_studio_sdk/types/redis_export_storage.py +29 -38
- label_studio_sdk/types/redis_import_storage.py +28 -37
- label_studio_sdk/types/refined_prompt_response.py +19 -29
- label_studio_sdk/types/s3export_storage.py +36 -43
- label_studio_sdk/types/s3import_storage.py +37 -44
- label_studio_sdk/types/s3s_export_storage.py +26 -33
- label_studio_sdk/types/s3s_import_storage.py +35 -42
- label_studio_sdk/types/serialization_option.py +12 -22
- label_studio_sdk/types/serialization_options.py +18 -28
- label_studio_sdk/types/task.py +46 -48
- label_studio_sdk/types/task_annotators_item.py +1 -1
- label_studio_sdk/types/task_comment_authors_item.py +5 -0
- label_studio_sdk/types/task_filter_options.py +15 -25
- label_studio_sdk/types/user_simple.py +11 -21
- label_studio_sdk/types/view.py +16 -26
- label_studio_sdk/types/webhook.py +19 -28
- label_studio_sdk/types/webhook_serializer_for_update.py +19 -28
- label_studio_sdk/types/workspace.py +22 -31
- label_studio_sdk/users/client.py +257 -63
- label_studio_sdk/users/types/users_get_token_response.py +12 -22
- label_studio_sdk/users/types/users_reset_token_response.py +12 -22
- label_studio_sdk/version.py +0 -1
- label_studio_sdk/versions/__init__.py +5 -0
- label_studio_sdk/versions/client.py +112 -0
- label_studio_sdk/versions/types/__init__.py +6 -0
- label_studio_sdk/versions/types/versions_get_response.py +73 -0
- label_studio_sdk/versions/types/versions_get_response_edition.py +5 -0
- label_studio_sdk/views/client.py +219 -52
- label_studio_sdk/views/types/views_create_request_data.py +13 -23
- label_studio_sdk/views/types/views_create_request_data_filters.py +14 -24
- label_studio_sdk/views/types/views_create_request_data_filters_items_item.py +16 -26
- label_studio_sdk/views/types/views_create_request_data_filters_items_item_value.py +3 -1
- label_studio_sdk/views/types/views_update_request_data.py +13 -23
- label_studio_sdk/views/types/views_update_request_data_filters.py +14 -24
- label_studio_sdk/views/types/views_update_request_data_filters_items_item.py +16 -26
- label_studio_sdk/views/types/views_update_request_data_filters_items_item_value.py +3 -1
- label_studio_sdk/webhooks/client.py +191 -61
- label_studio_sdk/workspaces/client.py +164 -41
- label_studio_sdk/workspaces/members/client.py +109 -31
- label_studio_sdk/workspaces/members/types/members_create_response.py +12 -22
- label_studio_sdk/workspaces/members/types/members_list_response_item.py +12 -22
- {label_studio_sdk-1.0.7.dist-info → label_studio_sdk-1.0.10.dist-info}/METADATA +9 -5
- {label_studio_sdk-1.0.7.dist-info → label_studio_sdk-1.0.10.dist-info}/RECORD +203 -186
- {label_studio_sdk-1.0.7.dist-info → label_studio_sdk-1.0.10.dist-info}/WHEEL +1 -1
- label_studio_sdk/types/export_convert.py +0 -32
- label_studio_sdk/types/export_create.py +0 -54
- label_studio_sdk/types/export_create_status.py +0 -5
- {label_studio_sdk-1.0.7.dist-info → label_studio_sdk-1.0.10.dist-info}/LICENSE +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
3
|
import typing
|
|
4
|
+
from ...core.client_wrapper import SyncClientWrapper
|
|
5
|
+
from ...core.request_options import RequestOptions
|
|
6
|
+
from ...types.s3s_import_storage import S3SImportStorage
|
|
7
|
+
from ...core.pydantic_utilities import parse_obj_as
|
|
4
8
|
from json.decoder import JSONDecodeError
|
|
5
|
-
|
|
6
9
|
from ...core.api_error import ApiError
|
|
7
|
-
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
8
10
|
from ...core.jsonable_encoder import jsonable_encoder
|
|
9
|
-
from ...core.
|
|
10
|
-
from ...core.request_options import RequestOptions
|
|
11
|
-
from ...types.s3s_import_storage import S3SImportStorage
|
|
11
|
+
from ...core.client_wrapper import AsyncClientWrapper
|
|
12
12
|
|
|
13
13
|
# this is used as the default value for optional parameters
|
|
14
14
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -22,6 +22,7 @@ class S3SClient:
|
|
|
22
22
|
self, *, project: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
|
|
23
23
|
) -> typing.List[S3SImportStorage]:
|
|
24
24
|
"""
|
|
25
|
+
|
|
25
26
|
You can connect your S3 bucket to Label Studio as a source storage or target storage. Use this API request to get a list of all Google import (source) storage connections for a specific project.
|
|
26
27
|
|
|
27
28
|
The project ID can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using [List all projects](../projects/list).
|
|
@@ -43,7 +44,7 @@ class S3SClient:
|
|
|
43
44
|
|
|
44
45
|
Examples
|
|
45
46
|
--------
|
|
46
|
-
from label_studio_sdk
|
|
47
|
+
from label_studio_sdk import LabelStudio
|
|
47
48
|
|
|
48
49
|
client = LabelStudio(
|
|
49
50
|
api_key="YOUR_API_KEY",
|
|
@@ -51,11 +52,22 @@ class S3SClient:
|
|
|
51
52
|
client.import_storage.s3s.list()
|
|
52
53
|
"""
|
|
53
54
|
_response = self._client_wrapper.httpx_client.request(
|
|
54
|
-
"api/storages/s3s",
|
|
55
|
+
"api/storages/s3s",
|
|
56
|
+
method="GET",
|
|
57
|
+
params={
|
|
58
|
+
"project": project,
|
|
59
|
+
},
|
|
60
|
+
request_options=request_options,
|
|
55
61
|
)
|
|
56
62
|
try:
|
|
57
63
|
if 200 <= _response.status_code < 300:
|
|
58
|
-
return
|
|
64
|
+
return typing.cast(
|
|
65
|
+
typing.List[S3SImportStorage],
|
|
66
|
+
parse_obj_as(
|
|
67
|
+
type_=typing.List[S3SImportStorage], # type: ignore
|
|
68
|
+
object_=_response.json(),
|
|
69
|
+
),
|
|
70
|
+
)
|
|
59
71
|
_response_json = _response.json()
|
|
60
72
|
except JSONDecodeError:
|
|
61
73
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -81,6 +93,7 @@ class S3SClient:
|
|
|
81
93
|
request_options: typing.Optional[RequestOptions] = None,
|
|
82
94
|
) -> S3SImportStorage:
|
|
83
95
|
"""
|
|
96
|
+
|
|
84
97
|
Create a new source storage connection to a S3 bucket.
|
|
85
98
|
|
|
86
99
|
For information about the required fields and prerequisites, see [Amazon S3](https://labelstud.io/guide/storage#Amazon-S3) in the Label Studio documentation.
|
|
@@ -143,7 +156,7 @@ class S3SClient:
|
|
|
143
156
|
|
|
144
157
|
Examples
|
|
145
158
|
--------
|
|
146
|
-
from label_studio_sdk
|
|
159
|
+
from label_studio_sdk import LabelStudio
|
|
147
160
|
|
|
148
161
|
client = LabelStudio(
|
|
149
162
|
api_key="YOUR_API_KEY",
|
|
@@ -169,12 +182,21 @@ class S3SClient:
|
|
|
169
182
|
"region_name": region_name,
|
|
170
183
|
"s3_endpoint": s3endpoint,
|
|
171
184
|
},
|
|
185
|
+
headers={
|
|
186
|
+
"content-type": "application/json",
|
|
187
|
+
},
|
|
172
188
|
request_options=request_options,
|
|
173
189
|
omit=OMIT,
|
|
174
190
|
)
|
|
175
191
|
try:
|
|
176
192
|
if 200 <= _response.status_code < 300:
|
|
177
|
-
return
|
|
193
|
+
return typing.cast(
|
|
194
|
+
S3SImportStorage,
|
|
195
|
+
parse_obj_as(
|
|
196
|
+
type_=S3SImportStorage, # type: ignore
|
|
197
|
+
object_=_response.json(),
|
|
198
|
+
),
|
|
199
|
+
)
|
|
178
200
|
_response_json = _response.json()
|
|
179
201
|
except JSONDecodeError:
|
|
180
202
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -182,6 +204,7 @@ class S3SClient:
|
|
|
182
204
|
|
|
183
205
|
def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> S3SImportStorage:
|
|
184
206
|
"""
|
|
207
|
+
|
|
185
208
|
Get a specific S3 import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
|
|
186
209
|
|
|
187
210
|
Parameters
|
|
@@ -199,7 +222,7 @@ class S3SClient:
|
|
|
199
222
|
|
|
200
223
|
Examples
|
|
201
224
|
--------
|
|
202
|
-
from label_studio_sdk
|
|
225
|
+
from label_studio_sdk import LabelStudio
|
|
203
226
|
|
|
204
227
|
client = LabelStudio(
|
|
205
228
|
api_key="YOUR_API_KEY",
|
|
@@ -209,11 +232,19 @@ class S3SClient:
|
|
|
209
232
|
)
|
|
210
233
|
"""
|
|
211
234
|
_response = self._client_wrapper.httpx_client.request(
|
|
212
|
-
f"api/storages/s3s/{jsonable_encoder(id)}",
|
|
235
|
+
f"api/storages/s3s/{jsonable_encoder(id)}",
|
|
236
|
+
method="GET",
|
|
237
|
+
request_options=request_options,
|
|
213
238
|
)
|
|
214
239
|
try:
|
|
215
240
|
if 200 <= _response.status_code < 300:
|
|
216
|
-
return
|
|
241
|
+
return typing.cast(
|
|
242
|
+
S3SImportStorage,
|
|
243
|
+
parse_obj_as(
|
|
244
|
+
type_=S3SImportStorage, # type: ignore
|
|
245
|
+
object_=_response.json(),
|
|
246
|
+
),
|
|
247
|
+
)
|
|
217
248
|
_response_json = _response.json()
|
|
218
249
|
except JSONDecodeError:
|
|
219
250
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -221,6 +252,7 @@ class S3SClient:
|
|
|
221
252
|
|
|
222
253
|
def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
223
254
|
"""
|
|
255
|
+
|
|
224
256
|
Delete a specific S3 import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
|
|
225
257
|
|
|
226
258
|
Deleting a source storage connection does not affect tasks with synced data in Label Studio. The sync process is designed to import new or updated tasks from the connected storage into the project, but it does not track deletions of files from the storage. Therefore, if you remove the external storage connection, the tasks that were created from that storage will remain in the project.
|
|
@@ -241,7 +273,7 @@ class S3SClient:
|
|
|
241
273
|
|
|
242
274
|
Examples
|
|
243
275
|
--------
|
|
244
|
-
from label_studio_sdk
|
|
276
|
+
from label_studio_sdk import LabelStudio
|
|
245
277
|
|
|
246
278
|
client = LabelStudio(
|
|
247
279
|
api_key="YOUR_API_KEY",
|
|
@@ -251,7 +283,9 @@ class S3SClient:
|
|
|
251
283
|
)
|
|
252
284
|
"""
|
|
253
285
|
_response = self._client_wrapper.httpx_client.request(
|
|
254
|
-
f"api/storages/s3s/{jsonable_encoder(id)}",
|
|
286
|
+
f"api/storages/s3s/{jsonable_encoder(id)}",
|
|
287
|
+
method="DELETE",
|
|
288
|
+
request_options=request_options,
|
|
255
289
|
)
|
|
256
290
|
try:
|
|
257
291
|
if 200 <= _response.status_code < 300:
|
|
@@ -282,6 +316,7 @@ class S3SClient:
|
|
|
282
316
|
request_options: typing.Optional[RequestOptions] = None,
|
|
283
317
|
) -> S3SImportStorage:
|
|
284
318
|
"""
|
|
319
|
+
|
|
285
320
|
Update a specific S3 import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
|
|
286
321
|
|
|
287
322
|
For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
|
|
@@ -343,7 +378,7 @@ class S3SClient:
|
|
|
343
378
|
|
|
344
379
|
Examples
|
|
345
380
|
--------
|
|
346
|
-
from label_studio_sdk
|
|
381
|
+
from label_studio_sdk import LabelStudio
|
|
347
382
|
|
|
348
383
|
client = LabelStudio(
|
|
349
384
|
api_key="YOUR_API_KEY",
|
|
@@ -371,12 +406,21 @@ class S3SClient:
|
|
|
371
406
|
"region_name": region_name,
|
|
372
407
|
"s3_endpoint": s3endpoint,
|
|
373
408
|
},
|
|
409
|
+
headers={
|
|
410
|
+
"content-type": "application/json",
|
|
411
|
+
},
|
|
374
412
|
request_options=request_options,
|
|
375
413
|
omit=OMIT,
|
|
376
414
|
)
|
|
377
415
|
try:
|
|
378
416
|
if 200 <= _response.status_code < 300:
|
|
379
|
-
return
|
|
417
|
+
return typing.cast(
|
|
418
|
+
S3SImportStorage,
|
|
419
|
+
parse_obj_as(
|
|
420
|
+
type_=S3SImportStorage, # type: ignore
|
|
421
|
+
object_=_response.json(),
|
|
422
|
+
),
|
|
423
|
+
)
|
|
380
424
|
_response_json = _response.json()
|
|
381
425
|
except JSONDecodeError:
|
|
382
426
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -402,6 +446,7 @@ class S3SClient:
|
|
|
402
446
|
request_options: typing.Optional[RequestOptions] = None,
|
|
403
447
|
) -> None:
|
|
404
448
|
"""
|
|
449
|
+
|
|
405
450
|
Validate a specific S3 import storage connection. This is useful to ensure that the storage configuration settings are correct and operational before attempting to import data.
|
|
406
451
|
|
|
407
452
|
Parameters
|
|
@@ -457,7 +502,7 @@ class S3SClient:
|
|
|
457
502
|
|
|
458
503
|
Examples
|
|
459
504
|
--------
|
|
460
|
-
from label_studio_sdk
|
|
505
|
+
from label_studio_sdk import LabelStudio
|
|
461
506
|
|
|
462
507
|
client = LabelStudio(
|
|
463
508
|
api_key="YOUR_API_KEY",
|
|
@@ -483,6 +528,9 @@ class S3SClient:
|
|
|
483
528
|
"region_name": region_name,
|
|
484
529
|
"s3_endpoint": s3endpoint,
|
|
485
530
|
},
|
|
531
|
+
headers={
|
|
532
|
+
"content-type": "application/json",
|
|
533
|
+
},
|
|
486
534
|
request_options=request_options,
|
|
487
535
|
omit=OMIT,
|
|
488
536
|
)
|
|
@@ -496,6 +544,7 @@ class S3SClient:
|
|
|
496
544
|
|
|
497
545
|
def sync(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> S3SImportStorage:
|
|
498
546
|
"""
|
|
547
|
+
|
|
499
548
|
Sync tasks from an S3 import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
|
|
500
549
|
|
|
501
550
|
Parameters
|
|
@@ -513,7 +562,7 @@ class S3SClient:
|
|
|
513
562
|
|
|
514
563
|
Examples
|
|
515
564
|
--------
|
|
516
|
-
from label_studio_sdk
|
|
565
|
+
from label_studio_sdk import LabelStudio
|
|
517
566
|
|
|
518
567
|
client = LabelStudio(
|
|
519
568
|
api_key="YOUR_API_KEY",
|
|
@@ -523,11 +572,19 @@ class S3SClient:
|
|
|
523
572
|
)
|
|
524
573
|
"""
|
|
525
574
|
_response = self._client_wrapper.httpx_client.request(
|
|
526
|
-
f"api/storages/s3s/{jsonable_encoder(id)}/sync",
|
|
575
|
+
f"api/storages/s3s/{jsonable_encoder(id)}/sync",
|
|
576
|
+
method="POST",
|
|
577
|
+
request_options=request_options,
|
|
527
578
|
)
|
|
528
579
|
try:
|
|
529
580
|
if 200 <= _response.status_code < 300:
|
|
530
|
-
return
|
|
581
|
+
return typing.cast(
|
|
582
|
+
S3SImportStorage,
|
|
583
|
+
parse_obj_as(
|
|
584
|
+
type_=S3SImportStorage, # type: ignore
|
|
585
|
+
object_=_response.json(),
|
|
586
|
+
),
|
|
587
|
+
)
|
|
531
588
|
_response_json = _response.json()
|
|
532
589
|
except JSONDecodeError:
|
|
533
590
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -542,6 +599,7 @@ class AsyncS3SClient:
|
|
|
542
599
|
self, *, project: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
|
|
543
600
|
) -> typing.List[S3SImportStorage]:
|
|
544
601
|
"""
|
|
602
|
+
|
|
545
603
|
You can connect your S3 bucket to Label Studio as a source storage or target storage. Use this API request to get a list of all Google import (source) storage connections for a specific project.
|
|
546
604
|
|
|
547
605
|
The project ID can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using [List all projects](../projects/list).
|
|
@@ -563,19 +621,38 @@ class AsyncS3SClient:
|
|
|
563
621
|
|
|
564
622
|
Examples
|
|
565
623
|
--------
|
|
566
|
-
|
|
624
|
+
import asyncio
|
|
625
|
+
|
|
626
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
567
627
|
|
|
568
628
|
client = AsyncLabelStudio(
|
|
569
629
|
api_key="YOUR_API_KEY",
|
|
570
630
|
)
|
|
571
|
-
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
async def main() -> None:
|
|
634
|
+
await client.import_storage.s3s.list()
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
asyncio.run(main())
|
|
572
638
|
"""
|
|
573
639
|
_response = await self._client_wrapper.httpx_client.request(
|
|
574
|
-
"api/storages/s3s",
|
|
640
|
+
"api/storages/s3s",
|
|
641
|
+
method="GET",
|
|
642
|
+
params={
|
|
643
|
+
"project": project,
|
|
644
|
+
},
|
|
645
|
+
request_options=request_options,
|
|
575
646
|
)
|
|
576
647
|
try:
|
|
577
648
|
if 200 <= _response.status_code < 300:
|
|
578
|
-
return
|
|
649
|
+
return typing.cast(
|
|
650
|
+
typing.List[S3SImportStorage],
|
|
651
|
+
parse_obj_as(
|
|
652
|
+
type_=typing.List[S3SImportStorage], # type: ignore
|
|
653
|
+
object_=_response.json(),
|
|
654
|
+
),
|
|
655
|
+
)
|
|
579
656
|
_response_json = _response.json()
|
|
580
657
|
except JSONDecodeError:
|
|
581
658
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -601,6 +678,7 @@ class AsyncS3SClient:
|
|
|
601
678
|
request_options: typing.Optional[RequestOptions] = None,
|
|
602
679
|
) -> S3SImportStorage:
|
|
603
680
|
"""
|
|
681
|
+
|
|
604
682
|
Create a new source storage connection to a S3 bucket.
|
|
605
683
|
|
|
606
684
|
For information about the required fields and prerequisites, see [Amazon S3](https://labelstud.io/guide/storage#Amazon-S3) in the Label Studio documentation.
|
|
@@ -663,12 +741,20 @@ class AsyncS3SClient:
|
|
|
663
741
|
|
|
664
742
|
Examples
|
|
665
743
|
--------
|
|
666
|
-
|
|
744
|
+
import asyncio
|
|
745
|
+
|
|
746
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
667
747
|
|
|
668
748
|
client = AsyncLabelStudio(
|
|
669
749
|
api_key="YOUR_API_KEY",
|
|
670
750
|
)
|
|
671
|
-
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
async def main() -> None:
|
|
754
|
+
await client.import_storage.s3s.create()
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
asyncio.run(main())
|
|
672
758
|
"""
|
|
673
759
|
_response = await self._client_wrapper.httpx_client.request(
|
|
674
760
|
"api/storages/s3s",
|
|
@@ -689,12 +775,21 @@ class AsyncS3SClient:
|
|
|
689
775
|
"region_name": region_name,
|
|
690
776
|
"s3_endpoint": s3endpoint,
|
|
691
777
|
},
|
|
778
|
+
headers={
|
|
779
|
+
"content-type": "application/json",
|
|
780
|
+
},
|
|
692
781
|
request_options=request_options,
|
|
693
782
|
omit=OMIT,
|
|
694
783
|
)
|
|
695
784
|
try:
|
|
696
785
|
if 200 <= _response.status_code < 300:
|
|
697
|
-
return
|
|
786
|
+
return typing.cast(
|
|
787
|
+
S3SImportStorage,
|
|
788
|
+
parse_obj_as(
|
|
789
|
+
type_=S3SImportStorage, # type: ignore
|
|
790
|
+
object_=_response.json(),
|
|
791
|
+
),
|
|
792
|
+
)
|
|
698
793
|
_response_json = _response.json()
|
|
699
794
|
except JSONDecodeError:
|
|
700
795
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -702,6 +797,7 @@ class AsyncS3SClient:
|
|
|
702
797
|
|
|
703
798
|
async def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> S3SImportStorage:
|
|
704
799
|
"""
|
|
800
|
+
|
|
705
801
|
Get a specific S3 import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
|
|
706
802
|
|
|
707
803
|
Parameters
|
|
@@ -719,21 +815,37 @@ class AsyncS3SClient:
|
|
|
719
815
|
|
|
720
816
|
Examples
|
|
721
817
|
--------
|
|
722
|
-
|
|
818
|
+
import asyncio
|
|
819
|
+
|
|
820
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
723
821
|
|
|
724
822
|
client = AsyncLabelStudio(
|
|
725
823
|
api_key="YOUR_API_KEY",
|
|
726
824
|
)
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
)
|
|
825
|
+
|
|
826
|
+
|
|
827
|
+
async def main() -> None:
|
|
828
|
+
await client.import_storage.s3s.get(
|
|
829
|
+
id=1,
|
|
830
|
+
)
|
|
831
|
+
|
|
832
|
+
|
|
833
|
+
asyncio.run(main())
|
|
730
834
|
"""
|
|
731
835
|
_response = await self._client_wrapper.httpx_client.request(
|
|
732
|
-
f"api/storages/s3s/{jsonable_encoder(id)}",
|
|
836
|
+
f"api/storages/s3s/{jsonable_encoder(id)}",
|
|
837
|
+
method="GET",
|
|
838
|
+
request_options=request_options,
|
|
733
839
|
)
|
|
734
840
|
try:
|
|
735
841
|
if 200 <= _response.status_code < 300:
|
|
736
|
-
return
|
|
842
|
+
return typing.cast(
|
|
843
|
+
S3SImportStorage,
|
|
844
|
+
parse_obj_as(
|
|
845
|
+
type_=S3SImportStorage, # type: ignore
|
|
846
|
+
object_=_response.json(),
|
|
847
|
+
),
|
|
848
|
+
)
|
|
737
849
|
_response_json = _response.json()
|
|
738
850
|
except JSONDecodeError:
|
|
739
851
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -741,6 +853,7 @@ class AsyncS3SClient:
|
|
|
741
853
|
|
|
742
854
|
async def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
743
855
|
"""
|
|
856
|
+
|
|
744
857
|
Delete a specific S3 import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
|
|
745
858
|
|
|
746
859
|
Deleting a source storage connection does not affect tasks with synced data in Label Studio. The sync process is designed to import new or updated tasks from the connected storage into the project, but it does not track deletions of files from the storage. Therefore, if you remove the external storage connection, the tasks that were created from that storage will remain in the project.
|
|
@@ -761,17 +874,27 @@ class AsyncS3SClient:
|
|
|
761
874
|
|
|
762
875
|
Examples
|
|
763
876
|
--------
|
|
764
|
-
|
|
877
|
+
import asyncio
|
|
878
|
+
|
|
879
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
765
880
|
|
|
766
881
|
client = AsyncLabelStudio(
|
|
767
882
|
api_key="YOUR_API_KEY",
|
|
768
883
|
)
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
)
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
async def main() -> None:
|
|
887
|
+
await client.import_storage.s3s.delete(
|
|
888
|
+
id=1,
|
|
889
|
+
)
|
|
890
|
+
|
|
891
|
+
|
|
892
|
+
asyncio.run(main())
|
|
772
893
|
"""
|
|
773
894
|
_response = await self._client_wrapper.httpx_client.request(
|
|
774
|
-
f"api/storages/s3s/{jsonable_encoder(id)}",
|
|
895
|
+
f"api/storages/s3s/{jsonable_encoder(id)}",
|
|
896
|
+
method="DELETE",
|
|
897
|
+
request_options=request_options,
|
|
775
898
|
)
|
|
776
899
|
try:
|
|
777
900
|
if 200 <= _response.status_code < 300:
|
|
@@ -802,6 +925,7 @@ class AsyncS3SClient:
|
|
|
802
925
|
request_options: typing.Optional[RequestOptions] = None,
|
|
803
926
|
) -> S3SImportStorage:
|
|
804
927
|
"""
|
|
928
|
+
|
|
805
929
|
Update a specific S3 import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
|
|
806
930
|
|
|
807
931
|
For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
|
|
@@ -863,14 +987,22 @@ class AsyncS3SClient:
|
|
|
863
987
|
|
|
864
988
|
Examples
|
|
865
989
|
--------
|
|
866
|
-
|
|
990
|
+
import asyncio
|
|
991
|
+
|
|
992
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
867
993
|
|
|
868
994
|
client = AsyncLabelStudio(
|
|
869
995
|
api_key="YOUR_API_KEY",
|
|
870
996
|
)
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
)
|
|
997
|
+
|
|
998
|
+
|
|
999
|
+
async def main() -> None:
|
|
1000
|
+
await client.import_storage.s3s.update(
|
|
1001
|
+
id=1,
|
|
1002
|
+
)
|
|
1003
|
+
|
|
1004
|
+
|
|
1005
|
+
asyncio.run(main())
|
|
874
1006
|
"""
|
|
875
1007
|
_response = await self._client_wrapper.httpx_client.request(
|
|
876
1008
|
f"api/storages/s3s/{jsonable_encoder(id)}",
|
|
@@ -891,12 +1023,21 @@ class AsyncS3SClient:
|
|
|
891
1023
|
"region_name": region_name,
|
|
892
1024
|
"s3_endpoint": s3endpoint,
|
|
893
1025
|
},
|
|
1026
|
+
headers={
|
|
1027
|
+
"content-type": "application/json",
|
|
1028
|
+
},
|
|
894
1029
|
request_options=request_options,
|
|
895
1030
|
omit=OMIT,
|
|
896
1031
|
)
|
|
897
1032
|
try:
|
|
898
1033
|
if 200 <= _response.status_code < 300:
|
|
899
|
-
return
|
|
1034
|
+
return typing.cast(
|
|
1035
|
+
S3SImportStorage,
|
|
1036
|
+
parse_obj_as(
|
|
1037
|
+
type_=S3SImportStorage, # type: ignore
|
|
1038
|
+
object_=_response.json(),
|
|
1039
|
+
),
|
|
1040
|
+
)
|
|
900
1041
|
_response_json = _response.json()
|
|
901
1042
|
except JSONDecodeError:
|
|
902
1043
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -922,6 +1063,7 @@ class AsyncS3SClient:
|
|
|
922
1063
|
request_options: typing.Optional[RequestOptions] = None,
|
|
923
1064
|
) -> None:
|
|
924
1065
|
"""
|
|
1066
|
+
|
|
925
1067
|
Validate a specific S3 import storage connection. This is useful to ensure that the storage configuration settings are correct and operational before attempting to import data.
|
|
926
1068
|
|
|
927
1069
|
Parameters
|
|
@@ -977,12 +1119,20 @@ class AsyncS3SClient:
|
|
|
977
1119
|
|
|
978
1120
|
Examples
|
|
979
1121
|
--------
|
|
980
|
-
|
|
1122
|
+
import asyncio
|
|
1123
|
+
|
|
1124
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
981
1125
|
|
|
982
1126
|
client = AsyncLabelStudio(
|
|
983
1127
|
api_key="YOUR_API_KEY",
|
|
984
1128
|
)
|
|
985
|
-
|
|
1129
|
+
|
|
1130
|
+
|
|
1131
|
+
async def main() -> None:
|
|
1132
|
+
await client.import_storage.s3s.validate()
|
|
1133
|
+
|
|
1134
|
+
|
|
1135
|
+
asyncio.run(main())
|
|
986
1136
|
"""
|
|
987
1137
|
_response = await self._client_wrapper.httpx_client.request(
|
|
988
1138
|
"api/storages/s3s/validate",
|
|
@@ -1003,6 +1153,9 @@ class AsyncS3SClient:
|
|
|
1003
1153
|
"region_name": region_name,
|
|
1004
1154
|
"s3_endpoint": s3endpoint,
|
|
1005
1155
|
},
|
|
1156
|
+
headers={
|
|
1157
|
+
"content-type": "application/json",
|
|
1158
|
+
},
|
|
1006
1159
|
request_options=request_options,
|
|
1007
1160
|
omit=OMIT,
|
|
1008
1161
|
)
|
|
@@ -1016,6 +1169,7 @@ class AsyncS3SClient:
|
|
|
1016
1169
|
|
|
1017
1170
|
async def sync(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> S3SImportStorage:
|
|
1018
1171
|
"""
|
|
1172
|
+
|
|
1019
1173
|
Sync tasks from an S3 import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
|
|
1020
1174
|
|
|
1021
1175
|
Parameters
|
|
@@ -1033,21 +1187,37 @@ class AsyncS3SClient:
|
|
|
1033
1187
|
|
|
1034
1188
|
Examples
|
|
1035
1189
|
--------
|
|
1036
|
-
|
|
1190
|
+
import asyncio
|
|
1191
|
+
|
|
1192
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
1037
1193
|
|
|
1038
1194
|
client = AsyncLabelStudio(
|
|
1039
1195
|
api_key="YOUR_API_KEY",
|
|
1040
1196
|
)
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
)
|
|
1197
|
+
|
|
1198
|
+
|
|
1199
|
+
async def main() -> None:
|
|
1200
|
+
await client.import_storage.s3s.sync(
|
|
1201
|
+
id=1,
|
|
1202
|
+
)
|
|
1203
|
+
|
|
1204
|
+
|
|
1205
|
+
asyncio.run(main())
|
|
1044
1206
|
"""
|
|
1045
1207
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1046
|
-
f"api/storages/s3s/{jsonable_encoder(id)}/sync",
|
|
1208
|
+
f"api/storages/s3s/{jsonable_encoder(id)}/sync",
|
|
1209
|
+
method="POST",
|
|
1210
|
+
request_options=request_options,
|
|
1047
1211
|
)
|
|
1048
1212
|
try:
|
|
1049
1213
|
if 200 <= _response.status_code < 300:
|
|
1050
|
-
return
|
|
1214
|
+
return typing.cast(
|
|
1215
|
+
S3SImportStorage,
|
|
1216
|
+
parse_obj_as(
|
|
1217
|
+
type_=S3SImportStorage, # type: ignore
|
|
1218
|
+
object_=_response.json(),
|
|
1219
|
+
),
|
|
1220
|
+
)
|
|
1051
1221
|
_response_json = _response.json()
|
|
1052
1222
|
except JSONDecodeError:
|
|
1053
1223
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -1,30 +1,20 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
from ...core.pydantic_utilities import UniversalBaseModel
|
|
4
4
|
import typing
|
|
5
|
+
from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
|
6
|
+
import pydantic
|
|
5
7
|
|
|
6
|
-
from ...core.datetime_utils import serialize_datetime
|
|
7
|
-
from ...core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
class ImportStorageListTypesResponseItem(pydantic_v1.BaseModel):
|
|
9
|
+
class ImportStorageListTypesResponseItem(UniversalBaseModel):
|
|
11
10
|
name: typing.Optional[str] = None
|
|
12
11
|
title: typing.Optional[str] = None
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
|
|
19
|
-
kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
|
20
|
-
kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
|
|
21
|
-
|
|
22
|
-
return deep_union_pydantic_dicts(
|
|
23
|
-
super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
|
|
24
|
-
)
|
|
13
|
+
if IS_PYDANTIC_V2:
|
|
14
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
15
|
+
else:
|
|
25
16
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
json_encoders = {dt.datetime: serialize_datetime}
|
|
17
|
+
class Config:
|
|
18
|
+
frozen = True
|
|
19
|
+
smart_union = True
|
|
20
|
+
extra = pydantic.Extra.allow
|