label-studio-sdk 1.0.8__py3-none-any.whl → 1.0.11__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 +37 -8
- 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 +5 -0
- label_studio_sdk/_extensions/pager_ext.py +8 -0
- 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 +54 -27
- label_studio_sdk/client.py +1 -0
- label_studio_sdk/comments/client.py +190 -44
- label_studio_sdk/converter/converter.py +56 -13
- 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 +37 -19
- 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/__init__.py +3 -1
- label_studio_sdk/errors/bad_request_error.py +2 -3
- label_studio_sdk/errors/not_found_error.py +9 -0
- label_studio_sdk/errors/unauthorized_error.py +9 -0
- 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/jwt_settings/__init__.py +2 -0
- label_studio_sdk/jwt_settings/client.py +259 -0
- label_studio_sdk/label_interface/control_tags.py +16 -3
- label_studio_sdk/label_interface/interface.py +80 -1
- label_studio_sdk/label_interface/object_tags.py +2 -2
- 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 +173 -56
- label_studio_sdk/predictions/client.py +247 -101
- label_studio_sdk/projects/__init__.py +5 -1
- label_studio_sdk/projects/client.py +313 -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 +200 -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/pauses/__init__.py +2 -0
- label_studio_sdk/projects/pauses/client.py +704 -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 +34 -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 +277 -88
- label_studio_sdk/tasks/client.py +263 -90
- label_studio_sdk/tasks/types/tasks_list_response.py +15 -25
- label_studio_sdk/tokens/__init__.py +2 -0
- label_studio_sdk/tokens/client.py +470 -0
- label_studio_sdk/tokens/client_ext.py +94 -0
- label_studio_sdk/types/__init__.py +20 -6
- label_studio_sdk/types/access_token_response.py +22 -0
- 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/api_token_response.py +32 -0
- 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 +17 -27
- 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/jwt_settings_response.py +32 -0
- 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 +22 -31
- 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/pause.py +34 -0
- label_studio_sdk/types/pause_paused_by.py +5 -0
- label_studio_sdk/types/prediction.py +21 -30
- label_studio_sdk/types/project.py +58 -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 +44 -47
- label_studio_sdk/types/task_annotators_item.py +1 -1
- label_studio_sdk/types/task_comment_authors_item.py +1 -1
- 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.8.dist-info → label_studio_sdk-1.0.11.dist-info}/METADATA +8 -5
- {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.11.dist-info}/RECORD +215 -188
- {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.11.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.8.dist-info → label_studio_sdk-1.0.11.dist-info}/LICENSE +0 -0
label_studio_sdk/views/client.py
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
3
|
import typing
|
|
4
|
-
from
|
|
5
|
-
|
|
6
|
-
from ..core.api_error import ApiError
|
|
7
|
-
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
8
|
-
from ..core.jsonable_encoder import jsonable_encoder
|
|
9
|
-
from ..core.pydantic_utilities import pydantic_v1
|
|
4
|
+
from ..core.client_wrapper import SyncClientWrapper
|
|
10
5
|
from ..core.request_options import RequestOptions
|
|
11
6
|
from ..types.view import View
|
|
7
|
+
from ..core.pydantic_utilities import parse_obj_as
|
|
8
|
+
from json.decoder import JSONDecodeError
|
|
9
|
+
from ..core.api_error import ApiError
|
|
12
10
|
from .types.views_create_request_data import ViewsCreateRequestData
|
|
11
|
+
from ..core.serialization import convert_and_respect_annotation_metadata
|
|
12
|
+
from ..core.jsonable_encoder import jsonable_encoder
|
|
13
13
|
from .types.views_update_request_data import ViewsUpdateRequestData
|
|
14
|
+
from ..core.client_wrapper import AsyncClientWrapper
|
|
14
15
|
|
|
15
16
|
# this is used as the default value for optional parameters
|
|
16
17
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -24,6 +25,7 @@ class ViewsClient:
|
|
|
24
25
|
self, *, project: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
|
|
25
26
|
) -> typing.List[View]:
|
|
26
27
|
"""
|
|
28
|
+
|
|
27
29
|
List all views for a specific project. A view is a tab in the Data Manager where you can set filters and customize which tasks and information appears.
|
|
28
30
|
|
|
29
31
|
You will need to provide the project ID. You can find this in the URL when viewing the project in Label Studio, or you can use [List all projects](../projects/list).
|
|
@@ -43,7 +45,7 @@ class ViewsClient:
|
|
|
43
45
|
|
|
44
46
|
Examples
|
|
45
47
|
--------
|
|
46
|
-
from label_studio_sdk
|
|
48
|
+
from label_studio_sdk import LabelStudio
|
|
47
49
|
|
|
48
50
|
client = LabelStudio(
|
|
49
51
|
api_key="YOUR_API_KEY",
|
|
@@ -51,11 +53,22 @@ class ViewsClient:
|
|
|
51
53
|
client.views.list()
|
|
52
54
|
"""
|
|
53
55
|
_response = self._client_wrapper.httpx_client.request(
|
|
54
|
-
"api/dm/views/",
|
|
56
|
+
"api/dm/views/",
|
|
57
|
+
method="GET",
|
|
58
|
+
params={
|
|
59
|
+
"project": project,
|
|
60
|
+
},
|
|
61
|
+
request_options=request_options,
|
|
55
62
|
)
|
|
56
63
|
try:
|
|
57
64
|
if 200 <= _response.status_code < 300:
|
|
58
|
-
return
|
|
65
|
+
return typing.cast(
|
|
66
|
+
typing.List[View],
|
|
67
|
+
parse_obj_as(
|
|
68
|
+
type_=typing.List[View], # type: ignore
|
|
69
|
+
object_=_response.json(),
|
|
70
|
+
),
|
|
71
|
+
)
|
|
59
72
|
_response_json = _response.json()
|
|
60
73
|
except JSONDecodeError:
|
|
61
74
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -69,6 +82,7 @@ class ViewsClient:
|
|
|
69
82
|
request_options: typing.Optional[RequestOptions] = None,
|
|
70
83
|
) -> View:
|
|
71
84
|
"""
|
|
85
|
+
|
|
72
86
|
Create a new Data Manager view for a specific project. A view is a tab in the Data Manager where you can set filters and customize what tasks and information appears.
|
|
73
87
|
|
|
74
88
|
You will need to provide the project ID. You can find this in the URL when viewing the project in Label Studio, or you can use [List all projects](../projects/list).
|
|
@@ -91,7 +105,7 @@ class ViewsClient:
|
|
|
91
105
|
|
|
92
106
|
Examples
|
|
93
107
|
--------
|
|
94
|
-
from label_studio_sdk
|
|
108
|
+
from label_studio_sdk import LabelStudio
|
|
95
109
|
|
|
96
110
|
client = LabelStudio(
|
|
97
111
|
api_key="YOUR_API_KEY",
|
|
@@ -101,13 +115,27 @@ class ViewsClient:
|
|
|
101
115
|
_response = self._client_wrapper.httpx_client.request(
|
|
102
116
|
"api/dm/views/",
|
|
103
117
|
method="POST",
|
|
104
|
-
json={
|
|
118
|
+
json={
|
|
119
|
+
"data": convert_and_respect_annotation_metadata(
|
|
120
|
+
object_=data, annotation=ViewsCreateRequestData, direction="write"
|
|
121
|
+
),
|
|
122
|
+
"project": project,
|
|
123
|
+
},
|
|
124
|
+
headers={
|
|
125
|
+
"content-type": "application/json",
|
|
126
|
+
},
|
|
105
127
|
request_options=request_options,
|
|
106
128
|
omit=OMIT,
|
|
107
129
|
)
|
|
108
130
|
try:
|
|
109
131
|
if 200 <= _response.status_code < 300:
|
|
110
|
-
return
|
|
132
|
+
return typing.cast(
|
|
133
|
+
View,
|
|
134
|
+
parse_obj_as(
|
|
135
|
+
type_=View, # type: ignore
|
|
136
|
+
object_=_response.json(),
|
|
137
|
+
),
|
|
138
|
+
)
|
|
111
139
|
_response_json = _response.json()
|
|
112
140
|
except JSONDecodeError:
|
|
113
141
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -115,6 +143,7 @@ class ViewsClient:
|
|
|
115
143
|
|
|
116
144
|
def delete_all(self, *, project: int, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
117
145
|
"""
|
|
146
|
+
|
|
118
147
|
Delete all views for a specific project. A view is a tab in the Data Manager where you can set filters and customize what tasks appear.
|
|
119
148
|
|
|
120
149
|
You will need to provide the project ID. You can find this in the URL when viewing the project in Label Studio, or you can use [List all projects](../projects/list).
|
|
@@ -132,7 +161,7 @@ class ViewsClient:
|
|
|
132
161
|
|
|
133
162
|
Examples
|
|
134
163
|
--------
|
|
135
|
-
from label_studio_sdk
|
|
164
|
+
from label_studio_sdk import LabelStudio
|
|
136
165
|
|
|
137
166
|
client = LabelStudio(
|
|
138
167
|
api_key="YOUR_API_KEY",
|
|
@@ -144,7 +173,12 @@ class ViewsClient:
|
|
|
144
173
|
_response = self._client_wrapper.httpx_client.request(
|
|
145
174
|
"api/dm/views/reset/",
|
|
146
175
|
method="DELETE",
|
|
147
|
-
json={
|
|
176
|
+
json={
|
|
177
|
+
"project": project,
|
|
178
|
+
},
|
|
179
|
+
headers={
|
|
180
|
+
"content-type": "application/json",
|
|
181
|
+
},
|
|
148
182
|
request_options=request_options,
|
|
149
183
|
omit=OMIT,
|
|
150
184
|
)
|
|
@@ -158,6 +192,7 @@ class ViewsClient:
|
|
|
158
192
|
|
|
159
193
|
def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> View:
|
|
160
194
|
"""
|
|
195
|
+
|
|
161
196
|
Get the details about a specific Data Manager view (tab). You will need to supply the view ID. You can find this using [List views](list).
|
|
162
197
|
|
|
163
198
|
Parameters
|
|
@@ -175,7 +210,7 @@ class ViewsClient:
|
|
|
175
210
|
|
|
176
211
|
Examples
|
|
177
212
|
--------
|
|
178
|
-
from label_studio_sdk
|
|
213
|
+
from label_studio_sdk import LabelStudio
|
|
179
214
|
|
|
180
215
|
client = LabelStudio(
|
|
181
216
|
api_key="YOUR_API_KEY",
|
|
@@ -185,11 +220,19 @@ class ViewsClient:
|
|
|
185
220
|
)
|
|
186
221
|
"""
|
|
187
222
|
_response = self._client_wrapper.httpx_client.request(
|
|
188
|
-
f"api/dm/views/{jsonable_encoder(id)}/",
|
|
223
|
+
f"api/dm/views/{jsonable_encoder(id)}/",
|
|
224
|
+
method="GET",
|
|
225
|
+
request_options=request_options,
|
|
189
226
|
)
|
|
190
227
|
try:
|
|
191
228
|
if 200 <= _response.status_code < 300:
|
|
192
|
-
return
|
|
229
|
+
return typing.cast(
|
|
230
|
+
View,
|
|
231
|
+
parse_obj_as(
|
|
232
|
+
type_=View, # type: ignore
|
|
233
|
+
object_=_response.json(),
|
|
234
|
+
),
|
|
235
|
+
)
|
|
193
236
|
_response_json = _response.json()
|
|
194
237
|
except JSONDecodeError:
|
|
195
238
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -213,7 +256,7 @@ class ViewsClient:
|
|
|
213
256
|
|
|
214
257
|
Examples
|
|
215
258
|
--------
|
|
216
|
-
from label_studio_sdk
|
|
259
|
+
from label_studio_sdk import LabelStudio
|
|
217
260
|
|
|
218
261
|
client = LabelStudio(
|
|
219
262
|
api_key="YOUR_API_KEY",
|
|
@@ -223,7 +266,9 @@ class ViewsClient:
|
|
|
223
266
|
)
|
|
224
267
|
"""
|
|
225
268
|
_response = self._client_wrapper.httpx_client.request(
|
|
226
|
-
f"api/dm/views/{jsonable_encoder(id)}/",
|
|
269
|
+
f"api/dm/views/{jsonable_encoder(id)}/",
|
|
270
|
+
method="DELETE",
|
|
271
|
+
request_options=request_options,
|
|
227
272
|
)
|
|
228
273
|
try:
|
|
229
274
|
if 200 <= _response.status_code < 300:
|
|
@@ -242,6 +287,7 @@ class ViewsClient:
|
|
|
242
287
|
request_options: typing.Optional[RequestOptions] = None,
|
|
243
288
|
) -> View:
|
|
244
289
|
"""
|
|
290
|
+
|
|
245
291
|
You can update a specific Data Manager view (tab) with additional filters and other customizations. You will need to supply the view ID. You can find this using [List views](list).
|
|
246
292
|
|
|
247
293
|
Parameters
|
|
@@ -265,7 +311,7 @@ class ViewsClient:
|
|
|
265
311
|
|
|
266
312
|
Examples
|
|
267
313
|
--------
|
|
268
|
-
from label_studio_sdk
|
|
314
|
+
from label_studio_sdk import LabelStudio
|
|
269
315
|
|
|
270
316
|
client = LabelStudio(
|
|
271
317
|
api_key="YOUR_API_KEY",
|
|
@@ -277,13 +323,27 @@ class ViewsClient:
|
|
|
277
323
|
_response = self._client_wrapper.httpx_client.request(
|
|
278
324
|
f"api/dm/views/{jsonable_encoder(id)}/",
|
|
279
325
|
method="PATCH",
|
|
280
|
-
json={
|
|
326
|
+
json={
|
|
327
|
+
"data": convert_and_respect_annotation_metadata(
|
|
328
|
+
object_=data, annotation=ViewsUpdateRequestData, direction="write"
|
|
329
|
+
),
|
|
330
|
+
"project": project,
|
|
331
|
+
},
|
|
332
|
+
headers={
|
|
333
|
+
"content-type": "application/json",
|
|
334
|
+
},
|
|
281
335
|
request_options=request_options,
|
|
282
336
|
omit=OMIT,
|
|
283
337
|
)
|
|
284
338
|
try:
|
|
285
339
|
if 200 <= _response.status_code < 300:
|
|
286
|
-
return
|
|
340
|
+
return typing.cast(
|
|
341
|
+
View,
|
|
342
|
+
parse_obj_as(
|
|
343
|
+
type_=View, # type: ignore
|
|
344
|
+
object_=_response.json(),
|
|
345
|
+
),
|
|
346
|
+
)
|
|
287
347
|
_response_json = _response.json()
|
|
288
348
|
except JSONDecodeError:
|
|
289
349
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -298,6 +358,7 @@ class AsyncViewsClient:
|
|
|
298
358
|
self, *, project: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
|
|
299
359
|
) -> typing.List[View]:
|
|
300
360
|
"""
|
|
361
|
+
|
|
301
362
|
List all views for a specific project. A view is a tab in the Data Manager where you can set filters and customize which tasks and information appears.
|
|
302
363
|
|
|
303
364
|
You will need to provide the project ID. You can find this in the URL when viewing the project in Label Studio, or you can use [List all projects](../projects/list).
|
|
@@ -317,19 +378,38 @@ class AsyncViewsClient:
|
|
|
317
378
|
|
|
318
379
|
Examples
|
|
319
380
|
--------
|
|
320
|
-
|
|
381
|
+
import asyncio
|
|
382
|
+
|
|
383
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
321
384
|
|
|
322
385
|
client = AsyncLabelStudio(
|
|
323
386
|
api_key="YOUR_API_KEY",
|
|
324
387
|
)
|
|
325
|
-
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
async def main() -> None:
|
|
391
|
+
await client.views.list()
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
asyncio.run(main())
|
|
326
395
|
"""
|
|
327
396
|
_response = await self._client_wrapper.httpx_client.request(
|
|
328
|
-
"api/dm/views/",
|
|
397
|
+
"api/dm/views/",
|
|
398
|
+
method="GET",
|
|
399
|
+
params={
|
|
400
|
+
"project": project,
|
|
401
|
+
},
|
|
402
|
+
request_options=request_options,
|
|
329
403
|
)
|
|
330
404
|
try:
|
|
331
405
|
if 200 <= _response.status_code < 300:
|
|
332
|
-
return
|
|
406
|
+
return typing.cast(
|
|
407
|
+
typing.List[View],
|
|
408
|
+
parse_obj_as(
|
|
409
|
+
type_=typing.List[View], # type: ignore
|
|
410
|
+
object_=_response.json(),
|
|
411
|
+
),
|
|
412
|
+
)
|
|
333
413
|
_response_json = _response.json()
|
|
334
414
|
except JSONDecodeError:
|
|
335
415
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -343,6 +423,7 @@ class AsyncViewsClient:
|
|
|
343
423
|
request_options: typing.Optional[RequestOptions] = None,
|
|
344
424
|
) -> View:
|
|
345
425
|
"""
|
|
426
|
+
|
|
346
427
|
Create a new Data Manager view for a specific project. A view is a tab in the Data Manager where you can set filters and customize what tasks and information appears.
|
|
347
428
|
|
|
348
429
|
You will need to provide the project ID. You can find this in the URL when viewing the project in Label Studio, or you can use [List all projects](../projects/list).
|
|
@@ -365,23 +446,45 @@ class AsyncViewsClient:
|
|
|
365
446
|
|
|
366
447
|
Examples
|
|
367
448
|
--------
|
|
368
|
-
|
|
449
|
+
import asyncio
|
|
450
|
+
|
|
451
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
369
452
|
|
|
370
453
|
client = AsyncLabelStudio(
|
|
371
454
|
api_key="YOUR_API_KEY",
|
|
372
455
|
)
|
|
373
|
-
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
async def main() -> None:
|
|
459
|
+
await client.views.create()
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
asyncio.run(main())
|
|
374
463
|
"""
|
|
375
464
|
_response = await self._client_wrapper.httpx_client.request(
|
|
376
465
|
"api/dm/views/",
|
|
377
466
|
method="POST",
|
|
378
|
-
json={
|
|
467
|
+
json={
|
|
468
|
+
"data": convert_and_respect_annotation_metadata(
|
|
469
|
+
object_=data, annotation=ViewsCreateRequestData, direction="write"
|
|
470
|
+
),
|
|
471
|
+
"project": project,
|
|
472
|
+
},
|
|
473
|
+
headers={
|
|
474
|
+
"content-type": "application/json",
|
|
475
|
+
},
|
|
379
476
|
request_options=request_options,
|
|
380
477
|
omit=OMIT,
|
|
381
478
|
)
|
|
382
479
|
try:
|
|
383
480
|
if 200 <= _response.status_code < 300:
|
|
384
|
-
return
|
|
481
|
+
return typing.cast(
|
|
482
|
+
View,
|
|
483
|
+
parse_obj_as(
|
|
484
|
+
type_=View, # type: ignore
|
|
485
|
+
object_=_response.json(),
|
|
486
|
+
),
|
|
487
|
+
)
|
|
385
488
|
_response_json = _response.json()
|
|
386
489
|
except JSONDecodeError:
|
|
387
490
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -389,6 +492,7 @@ class AsyncViewsClient:
|
|
|
389
492
|
|
|
390
493
|
async def delete_all(self, *, project: int, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
391
494
|
"""
|
|
495
|
+
|
|
392
496
|
Delete all views for a specific project. A view is a tab in the Data Manager where you can set filters and customize what tasks appear.
|
|
393
497
|
|
|
394
498
|
You will need to provide the project ID. You can find this in the URL when viewing the project in Label Studio, or you can use [List all projects](../projects/list).
|
|
@@ -406,19 +510,32 @@ class AsyncViewsClient:
|
|
|
406
510
|
|
|
407
511
|
Examples
|
|
408
512
|
--------
|
|
409
|
-
|
|
513
|
+
import asyncio
|
|
514
|
+
|
|
515
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
410
516
|
|
|
411
517
|
client = AsyncLabelStudio(
|
|
412
518
|
api_key="YOUR_API_KEY",
|
|
413
519
|
)
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
)
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
async def main() -> None:
|
|
523
|
+
await client.views.delete_all(
|
|
524
|
+
project=1,
|
|
525
|
+
)
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
asyncio.run(main())
|
|
417
529
|
"""
|
|
418
530
|
_response = await self._client_wrapper.httpx_client.request(
|
|
419
531
|
"api/dm/views/reset/",
|
|
420
532
|
method="DELETE",
|
|
421
|
-
json={
|
|
533
|
+
json={
|
|
534
|
+
"project": project,
|
|
535
|
+
},
|
|
536
|
+
headers={
|
|
537
|
+
"content-type": "application/json",
|
|
538
|
+
},
|
|
422
539
|
request_options=request_options,
|
|
423
540
|
omit=OMIT,
|
|
424
541
|
)
|
|
@@ -432,6 +549,7 @@ class AsyncViewsClient:
|
|
|
432
549
|
|
|
433
550
|
async def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> View:
|
|
434
551
|
"""
|
|
552
|
+
|
|
435
553
|
Get the details about a specific Data Manager view (tab). You will need to supply the view ID. You can find this using [List views](list).
|
|
436
554
|
|
|
437
555
|
Parameters
|
|
@@ -449,21 +567,37 @@ class AsyncViewsClient:
|
|
|
449
567
|
|
|
450
568
|
Examples
|
|
451
569
|
--------
|
|
452
|
-
|
|
570
|
+
import asyncio
|
|
571
|
+
|
|
572
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
453
573
|
|
|
454
574
|
client = AsyncLabelStudio(
|
|
455
575
|
api_key="YOUR_API_KEY",
|
|
456
576
|
)
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
)
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
async def main() -> None:
|
|
580
|
+
await client.views.get(
|
|
581
|
+
id="id",
|
|
582
|
+
)
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
asyncio.run(main())
|
|
460
586
|
"""
|
|
461
587
|
_response = await self._client_wrapper.httpx_client.request(
|
|
462
|
-
f"api/dm/views/{jsonable_encoder(id)}/",
|
|
588
|
+
f"api/dm/views/{jsonable_encoder(id)}/",
|
|
589
|
+
method="GET",
|
|
590
|
+
request_options=request_options,
|
|
463
591
|
)
|
|
464
592
|
try:
|
|
465
593
|
if 200 <= _response.status_code < 300:
|
|
466
|
-
return
|
|
594
|
+
return typing.cast(
|
|
595
|
+
View,
|
|
596
|
+
parse_obj_as(
|
|
597
|
+
type_=View, # type: ignore
|
|
598
|
+
object_=_response.json(),
|
|
599
|
+
),
|
|
600
|
+
)
|
|
467
601
|
_response_json = _response.json()
|
|
468
602
|
except JSONDecodeError:
|
|
469
603
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -487,17 +621,27 @@ class AsyncViewsClient:
|
|
|
487
621
|
|
|
488
622
|
Examples
|
|
489
623
|
--------
|
|
490
|
-
|
|
624
|
+
import asyncio
|
|
625
|
+
|
|
626
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
491
627
|
|
|
492
628
|
client = AsyncLabelStudio(
|
|
493
629
|
api_key="YOUR_API_KEY",
|
|
494
630
|
)
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
)
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
async def main() -> None:
|
|
634
|
+
await client.views.delete(
|
|
635
|
+
id="id",
|
|
636
|
+
)
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
asyncio.run(main())
|
|
498
640
|
"""
|
|
499
641
|
_response = await self._client_wrapper.httpx_client.request(
|
|
500
|
-
f"api/dm/views/{jsonable_encoder(id)}/",
|
|
642
|
+
f"api/dm/views/{jsonable_encoder(id)}/",
|
|
643
|
+
method="DELETE",
|
|
644
|
+
request_options=request_options,
|
|
501
645
|
)
|
|
502
646
|
try:
|
|
503
647
|
if 200 <= _response.status_code < 300:
|
|
@@ -516,6 +660,7 @@ class AsyncViewsClient:
|
|
|
516
660
|
request_options: typing.Optional[RequestOptions] = None,
|
|
517
661
|
) -> View:
|
|
518
662
|
"""
|
|
663
|
+
|
|
519
664
|
You can update a specific Data Manager view (tab) with additional filters and other customizations. You will need to supply the view ID. You can find this using [List views](list).
|
|
520
665
|
|
|
521
666
|
Parameters
|
|
@@ -539,25 +684,47 @@ class AsyncViewsClient:
|
|
|
539
684
|
|
|
540
685
|
Examples
|
|
541
686
|
--------
|
|
542
|
-
|
|
687
|
+
import asyncio
|
|
688
|
+
|
|
689
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
543
690
|
|
|
544
691
|
client = AsyncLabelStudio(
|
|
545
692
|
api_key="YOUR_API_KEY",
|
|
546
693
|
)
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
)
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
async def main() -> None:
|
|
697
|
+
await client.views.update(
|
|
698
|
+
id="id",
|
|
699
|
+
)
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
asyncio.run(main())
|
|
550
703
|
"""
|
|
551
704
|
_response = await self._client_wrapper.httpx_client.request(
|
|
552
705
|
f"api/dm/views/{jsonable_encoder(id)}/",
|
|
553
706
|
method="PATCH",
|
|
554
|
-
json={
|
|
707
|
+
json={
|
|
708
|
+
"data": convert_and_respect_annotation_metadata(
|
|
709
|
+
object_=data, annotation=ViewsUpdateRequestData, direction="write"
|
|
710
|
+
),
|
|
711
|
+
"project": project,
|
|
712
|
+
},
|
|
713
|
+
headers={
|
|
714
|
+
"content-type": "application/json",
|
|
715
|
+
},
|
|
555
716
|
request_options=request_options,
|
|
556
717
|
omit=OMIT,
|
|
557
718
|
)
|
|
558
719
|
try:
|
|
559
720
|
if 200 <= _response.status_code < 300:
|
|
560
|
-
return
|
|
721
|
+
return typing.cast(
|
|
722
|
+
View,
|
|
723
|
+
parse_obj_as(
|
|
724
|
+
type_=View, # type: ignore
|
|
725
|
+
object_=_response.json(),
|
|
726
|
+
),
|
|
727
|
+
)
|
|
561
728
|
_response_json = _response.json()
|
|
562
729
|
except JSONDecodeError:
|
|
563
730
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -1,43 +1,33 @@
|
|
|
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
|
-
|
|
6
|
-
from ...core.datetime_utils import serialize_datetime
|
|
7
|
-
from ...core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
|
|
8
5
|
from .views_create_request_data_filters import ViewsCreateRequestDataFilters
|
|
6
|
+
import pydantic
|
|
9
7
|
from .views_create_request_data_ordering_item import ViewsCreateRequestDataOrderingItem
|
|
8
|
+
from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
|
10
9
|
|
|
11
10
|
|
|
12
|
-
class ViewsCreateRequestData(
|
|
11
|
+
class ViewsCreateRequestData(UniversalBaseModel):
|
|
13
12
|
"""
|
|
14
13
|
Custom view data
|
|
15
14
|
"""
|
|
16
15
|
|
|
17
|
-
filters: typing.Optional[ViewsCreateRequestDataFilters] =
|
|
16
|
+
filters: typing.Optional[ViewsCreateRequestDataFilters] = pydantic.Field(default=None)
|
|
18
17
|
"""
|
|
19
18
|
Filters to apply on tasks. You can use [the helper class `Filters` from this page](https://labelstud.io/sdk/data_manager.html) to create Data Manager Filters.<br>Example: `{"conjunction": "or", "items": [{"filter": "filter:tasks:completed_at", "operator": "greater", "type": "Datetime", "value": "2021-01-01T00:00:00.000Z"}]}`
|
|
20
19
|
"""
|
|
21
20
|
|
|
22
|
-
ordering: typing.Optional[typing.List[ViewsCreateRequestDataOrderingItem]] =
|
|
21
|
+
ordering: typing.Optional[typing.List[ViewsCreateRequestDataOrderingItem]] = pydantic.Field(default=None)
|
|
23
22
|
"""
|
|
24
23
|
List of fields to order by. Fields are similar to filters but without the `filter:` prefix. To reverse the order, add a minus sign before the field name, e.g. `-tasks:created_at`.
|
|
25
24
|
"""
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
|
|
32
|
-
kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
|
33
|
-
kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
|
|
34
|
-
|
|
35
|
-
return deep_union_pydantic_dicts(
|
|
36
|
-
super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
|
|
37
|
-
)
|
|
26
|
+
if IS_PYDANTIC_V2:
|
|
27
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
28
|
+
else:
|
|
38
29
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
json_encoders = {dt.datetime: serialize_datetime}
|
|
30
|
+
class Config:
|
|
31
|
+
frozen = True
|
|
32
|
+
smart_union = True
|
|
33
|
+
extra = pydantic.Extra.allow
|
|
@@ -1,43 +1,33 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
import typing
|
|
5
|
-
|
|
6
|
-
from ...core.datetime_utils import serialize_datetime
|
|
7
|
-
from ...core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
|
|
3
|
+
from ...core.pydantic_utilities import UniversalBaseModel
|
|
8
4
|
from .views_create_request_data_filters_conjunction import ViewsCreateRequestDataFiltersConjunction
|
|
5
|
+
import pydantic
|
|
6
|
+
import typing
|
|
9
7
|
from .views_create_request_data_filters_items_item import ViewsCreateRequestDataFiltersItemsItem
|
|
8
|
+
from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
|
10
9
|
|
|
11
10
|
|
|
12
|
-
class ViewsCreateRequestDataFilters(
|
|
11
|
+
class ViewsCreateRequestDataFilters(UniversalBaseModel):
|
|
13
12
|
"""
|
|
14
13
|
Filters to apply on tasks. You can use [the helper class `Filters` from this page](https://labelstud.io/sdk/data_manager.html) to create Data Manager Filters.<br>Example: `{"conjunction": "or", "items": [{"filter": "filter:tasks:completed_at", "operator": "greater", "type": "Datetime", "value": "2021-01-01T00:00:00.000Z"}]}`
|
|
15
14
|
"""
|
|
16
15
|
|
|
17
|
-
conjunction: ViewsCreateRequestDataFiltersConjunction =
|
|
16
|
+
conjunction: ViewsCreateRequestDataFiltersConjunction = pydantic.Field()
|
|
18
17
|
"""
|
|
19
18
|
Logical conjunction for the filters. This conjunction (either "or" or "and") will be applied to all items in the filters list. It is not possible to combine "or" and "and" within one list of filters. All filters will be either combined with "or" or with "and", but not a mix of both.
|
|
20
19
|
"""
|
|
21
20
|
|
|
22
|
-
items: typing.List[ViewsCreateRequestDataFiltersItemsItem] =
|
|
21
|
+
items: typing.List[ViewsCreateRequestDataFiltersItemsItem] = pydantic.Field()
|
|
23
22
|
"""
|
|
24
23
|
List of filter items
|
|
25
24
|
"""
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
|
|
32
|
-
kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
|
33
|
-
kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
|
|
34
|
-
|
|
35
|
-
return deep_union_pydantic_dicts(
|
|
36
|
-
super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
|
|
37
|
-
)
|
|
26
|
+
if IS_PYDANTIC_V2:
|
|
27
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
28
|
+
else:
|
|
38
29
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
json_encoders = {dt.datetime: serialize_datetime}
|
|
30
|
+
class Config:
|
|
31
|
+
frozen = True
|
|
32
|
+
smart_union = True
|
|
33
|
+
extra = pydantic.Extra.allow
|