label-studio-sdk 1.0.5__py3-none-any.whl → 1.0.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- label_studio_sdk/__init__.py +70 -0
- label_studio_sdk/_extensions/eval/categorical.py +83 -0
- label_studio_sdk/_extensions/label_studio_tools/core/utils/io.py +35 -17
- label_studio_sdk/annotations/__init__.py +3 -0
- label_studio_sdk/annotations/client.py +109 -0
- label_studio_sdk/annotations/types/__init__.py +5 -0
- label_studio_sdk/annotations/types/annotations_create_bulk_response_item.py +29 -0
- label_studio_sdk/base_client.py +9 -0
- label_studio_sdk/comments/__init__.py +2 -0
- label_studio_sdk/comments/client.py +512 -0
- label_studio_sdk/converter/converter.py +2 -0
- label_studio_sdk/converter/imports/coco.py +14 -13
- label_studio_sdk/converter/utils.py +72 -3
- label_studio_sdk/core/client_wrapper.py +1 -1
- label_studio_sdk/files/client.py +26 -16
- label_studio_sdk/label_interface/interface.py +38 -5
- label_studio_sdk/model_providers/__init__.py +2 -0
- label_studio_sdk/model_providers/client.py +190 -0
- label_studio_sdk/projects/client.py +32 -16
- label_studio_sdk/projects/exports/client.py +133 -40
- label_studio_sdk/prompts/__init__.py +21 -0
- label_studio_sdk/prompts/client.py +862 -0
- label_studio_sdk/prompts/indicators/__init__.py +2 -0
- label_studio_sdk/prompts/indicators/client.py +194 -0
- label_studio_sdk/prompts/runs/__init__.py +5 -0
- label_studio_sdk/prompts/runs/client.py +354 -0
- label_studio_sdk/prompts/runs/types/__init__.py +5 -0
- label_studio_sdk/prompts/runs/types/runs_list_request_project_subset.py +5 -0
- label_studio_sdk/prompts/types/__init__.py +15 -0
- label_studio_sdk/prompts/types/prompts_batch_failed_predictions_request_failed_predictions_item.py +42 -0
- label_studio_sdk/prompts/types/prompts_batch_failed_predictions_response.py +29 -0
- label_studio_sdk/prompts/types/prompts_batch_predictions_request_results_item.py +62 -0
- label_studio_sdk/prompts/types/prompts_batch_predictions_response.py +29 -0
- label_studio_sdk/prompts/versions/__init__.py +2 -0
- label_studio_sdk/prompts/versions/client.py +921 -0
- label_studio_sdk/types/__init__.py +52 -0
- label_studio_sdk/types/comment.py +39 -0
- label_studio_sdk/types/comment_created_by.py +5 -0
- label_studio_sdk/types/inference_run.py +43 -0
- label_studio_sdk/types/inference_run_created_by.py +5 -0
- label_studio_sdk/types/inference_run_organization.py +5 -0
- label_studio_sdk/types/inference_run_project_subset.py +5 -0
- label_studio_sdk/types/inference_run_status.py +7 -0
- label_studio_sdk/types/key_indicator_value.py +30 -0
- label_studio_sdk/types/key_indicators.py +7 -0
- label_studio_sdk/types/key_indicators_item.py +51 -0
- label_studio_sdk/types/key_indicators_item_additional_kpis_item.py +37 -0
- label_studio_sdk/types/key_indicators_item_extra_kpis_item.py +37 -0
- label_studio_sdk/types/model_provider_connection.py +41 -0
- label_studio_sdk/types/model_provider_connection_created_by.py +5 -0
- label_studio_sdk/types/model_provider_connection_organization.py +5 -0
- label_studio_sdk/types/model_provider_connection_provider.py +5 -0
- label_studio_sdk/types/model_provider_connection_scope.py +5 -0
- label_studio_sdk/types/prompt.py +79 -0
- label_studio_sdk/types/prompt_created_by.py +5 -0
- label_studio_sdk/types/prompt_organization.py +5 -0
- label_studio_sdk/types/prompt_version.py +41 -0
- label_studio_sdk/types/prompt_version_created_by.py +5 -0
- label_studio_sdk/types/prompt_version_organization.py +5 -0
- label_studio_sdk/types/prompt_version_provider.py +5 -0
- label_studio_sdk/types/refined_prompt_response.py +64 -0
- label_studio_sdk/types/refined_prompt_response_refinement_status.py +7 -0
- label_studio_sdk/webhooks/client.py +245 -36
- label_studio_sdk/workspaces/client.py +20 -20
- label_studio_sdk-1.0.7.dist-info/LICENSE +201 -0
- {label_studio_sdk-1.0.5.dist-info → label_studio_sdk-1.0.7.dist-info}/METADATA +17 -3
- {label_studio_sdk-1.0.5.dist-info → label_studio_sdk-1.0.7.dist-info}/RECORD +68 -19
- {label_studio_sdk-1.0.5.dist-info → label_studio_sdk-1.0.7.dist-info}/WHEEL +1 -1
label_studio_sdk/files/client.py
CHANGED
|
@@ -96,7 +96,12 @@ class FilesClient:
|
|
|
96
96
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
97
97
|
|
|
98
98
|
def update(
|
|
99
|
-
self,
|
|
99
|
+
self,
|
|
100
|
+
id_: int,
|
|
101
|
+
*,
|
|
102
|
+
id: typing.Optional[int] = OMIT,
|
|
103
|
+
file: typing.Optional[str] = OMIT,
|
|
104
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
100
105
|
) -> FileUpload:
|
|
101
106
|
"""
|
|
102
107
|
Update a specific uploaded file. To get the file upload ID, use [Get files list](list).
|
|
@@ -109,10 +114,12 @@ class FilesClient:
|
|
|
109
114
|
|
|
110
115
|
Parameters
|
|
111
116
|
----------
|
|
112
|
-
|
|
117
|
+
id_ : int
|
|
113
118
|
A unique integer value identifying this file upload.
|
|
114
119
|
|
|
115
|
-
|
|
120
|
+
id : typing.Optional[int]
|
|
121
|
+
|
|
122
|
+
file : typing.Optional[str]
|
|
116
123
|
|
|
117
124
|
request_options : typing.Optional[RequestOptions]
|
|
118
125
|
Request-specific configuration.
|
|
@@ -124,21 +131,19 @@ class FilesClient:
|
|
|
124
131
|
|
|
125
132
|
Examples
|
|
126
133
|
--------
|
|
127
|
-
from label_studio_sdk import FileUpload
|
|
128
134
|
from label_studio_sdk.client import LabelStudio
|
|
129
135
|
|
|
130
136
|
client = LabelStudio(
|
|
131
137
|
api_key="YOUR_API_KEY",
|
|
132
138
|
)
|
|
133
139
|
client.files.update(
|
|
134
|
-
|
|
135
|
-
request=FileUpload(),
|
|
140
|
+
id_=1,
|
|
136
141
|
)
|
|
137
142
|
"""
|
|
138
143
|
_response = self._client_wrapper.httpx_client.request(
|
|
139
|
-
f"api/import/file-upload/{jsonable_encoder(
|
|
144
|
+
f"api/import/file-upload/{jsonable_encoder(id_)}",
|
|
140
145
|
method="PATCH",
|
|
141
|
-
json=
|
|
146
|
+
json={"id": id, "file": file},
|
|
142
147
|
request_options=request_options,
|
|
143
148
|
omit=OMIT,
|
|
144
149
|
)
|
|
@@ -367,7 +372,12 @@ class AsyncFilesClient:
|
|
|
367
372
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
368
373
|
|
|
369
374
|
async def update(
|
|
370
|
-
self,
|
|
375
|
+
self,
|
|
376
|
+
id_: int,
|
|
377
|
+
*,
|
|
378
|
+
id: typing.Optional[int] = OMIT,
|
|
379
|
+
file: typing.Optional[str] = OMIT,
|
|
380
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
371
381
|
) -> FileUpload:
|
|
372
382
|
"""
|
|
373
383
|
Update a specific uploaded file. To get the file upload ID, use [Get files list](list).
|
|
@@ -380,10 +390,12 @@ class AsyncFilesClient:
|
|
|
380
390
|
|
|
381
391
|
Parameters
|
|
382
392
|
----------
|
|
383
|
-
|
|
393
|
+
id_ : int
|
|
384
394
|
A unique integer value identifying this file upload.
|
|
385
395
|
|
|
386
|
-
|
|
396
|
+
id : typing.Optional[int]
|
|
397
|
+
|
|
398
|
+
file : typing.Optional[str]
|
|
387
399
|
|
|
388
400
|
request_options : typing.Optional[RequestOptions]
|
|
389
401
|
Request-specific configuration.
|
|
@@ -395,21 +407,19 @@ class AsyncFilesClient:
|
|
|
395
407
|
|
|
396
408
|
Examples
|
|
397
409
|
--------
|
|
398
|
-
from label_studio_sdk import FileUpload
|
|
399
410
|
from label_studio_sdk.client import AsyncLabelStudio
|
|
400
411
|
|
|
401
412
|
client = AsyncLabelStudio(
|
|
402
413
|
api_key="YOUR_API_KEY",
|
|
403
414
|
)
|
|
404
415
|
await client.files.update(
|
|
405
|
-
|
|
406
|
-
request=FileUpload(),
|
|
416
|
+
id_=1,
|
|
407
417
|
)
|
|
408
418
|
"""
|
|
409
419
|
_response = await self._client_wrapper.httpx_client.request(
|
|
410
|
-
f"api/import/file-upload/{jsonable_encoder(
|
|
420
|
+
f"api/import/file-upload/{jsonable_encoder(id_)}",
|
|
411
421
|
method="PATCH",
|
|
412
|
-
json=
|
|
422
|
+
json={"id": id, "file": file},
|
|
413
423
|
request_options=request_options,
|
|
414
424
|
omit=OMIT,
|
|
415
425
|
)
|
|
@@ -30,9 +30,11 @@ from .control_tags import (
|
|
|
30
30
|
)
|
|
31
31
|
from .object_tags import ObjectTag
|
|
32
32
|
from .label_tags import LabelTag
|
|
33
|
-
from .objects import AnnotationValue, TaskValue, PredictionValue
|
|
33
|
+
from .objects import AnnotationValue, TaskValue, PredictionValue, Region
|
|
34
34
|
from . import create as CE
|
|
35
35
|
|
|
36
|
+
logger = logging.getLogger(__name__)
|
|
37
|
+
|
|
36
38
|
|
|
37
39
|
dir_path = os.path.dirname(os.path.realpath(__file__))
|
|
38
40
|
file_path = os.path.join(dir_path, "..", "_legacy", "schema", "label_config_schema.json")
|
|
@@ -250,8 +252,7 @@ class LabelInterface:
|
|
|
250
252
|
"""
|
|
251
253
|
config = cls.create(*args, **kwargs)
|
|
252
254
|
return cls(config=config, **kwargs)
|
|
253
|
-
|
|
254
|
-
|
|
255
|
+
|
|
255
256
|
def __init__(self, config: str, tags_mapping=None, *args, **kwargs):
|
|
256
257
|
"""
|
|
257
258
|
Initialize a LabelInterface instance using a config string.
|
|
@@ -299,9 +300,41 @@ class LabelInterface:
|
|
|
299
300
|
self._labels = labels
|
|
300
301
|
self._tree = tree
|
|
301
302
|
|
|
302
|
-
|
|
303
|
+
def create_regions(self, data: Dict[str, Union[str, Dict, List[str], List[Dict]]]) -> List[Region]:
|
|
304
|
+
"""
|
|
305
|
+
Takes raw data representation and maps keys to control tag names.
|
|
306
|
+
If name is not found, it will be skipped
|
|
307
|
+
|
|
308
|
+
Args:
|
|
309
|
+
data (Dict): Raw data representation. Example: {"choices_name": "Positive", "labels_name": [{"start": 0, "end": 10, "label": "person"}]}
|
|
310
|
+
raise_if_control_not_found (bool): Raise an exception if control tag is not found.
|
|
311
|
+
"""
|
|
312
|
+
regions = []
|
|
313
|
+
for control_tag_name, payload in data.items():
|
|
314
|
+
if control_tag_name not in self._controls:
|
|
315
|
+
logger.info(f"Control tag '{control_tag_name}' not found in the config")
|
|
316
|
+
continue
|
|
303
317
|
|
|
304
|
-
|
|
318
|
+
control = self._controls[control_tag_name]
|
|
319
|
+
# TODO: I don't really like this part, looks like a workaround
|
|
320
|
+
# 1. we should allow control.label to process custom payload outside of those strictly containing "label"
|
|
321
|
+
# 2. we should be less open regarding the payload type and defining the strict typing elsewhere,
|
|
322
|
+
# but likely that requires rewriting of how ControlTag.label() is working now
|
|
323
|
+
if isinstance(payload, str):
|
|
324
|
+
payload = {'label': payload}
|
|
325
|
+
elif isinstance(payload, list):
|
|
326
|
+
if len(payload) > 0:
|
|
327
|
+
if isinstance(payload[0], str):
|
|
328
|
+
payload = {'label': payload}
|
|
329
|
+
else:
|
|
330
|
+
pass
|
|
331
|
+
|
|
332
|
+
if isinstance(payload, Dict):
|
|
333
|
+
payload = [payload]
|
|
334
|
+
for item in payload:
|
|
335
|
+
regions.append(control.label(**item))
|
|
336
|
+
|
|
337
|
+
return regions
|
|
305
338
|
|
|
306
339
|
@property
|
|
307
340
|
def config(self):
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import datetime as dt
|
|
4
|
+
import typing
|
|
5
|
+
from json.decoder import JSONDecodeError
|
|
6
|
+
|
|
7
|
+
from ..core.api_error import ApiError
|
|
8
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
9
|
+
from ..core.pydantic_utilities import pydantic_v1
|
|
10
|
+
from ..core.request_options import RequestOptions
|
|
11
|
+
from ..types.model_provider_connection import ModelProviderConnection
|
|
12
|
+
from ..types.model_provider_connection_created_by import ModelProviderConnectionCreatedBy
|
|
13
|
+
from ..types.model_provider_connection_organization import ModelProviderConnectionOrganization
|
|
14
|
+
from ..types.model_provider_connection_provider import ModelProviderConnectionProvider
|
|
15
|
+
from ..types.model_provider_connection_scope import ModelProviderConnectionScope
|
|
16
|
+
|
|
17
|
+
# this is used as the default value for optional parameters
|
|
18
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class ModelProvidersClient:
|
|
22
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
23
|
+
self._client_wrapper = client_wrapper
|
|
24
|
+
|
|
25
|
+
def create(
|
|
26
|
+
self,
|
|
27
|
+
*,
|
|
28
|
+
provider: ModelProviderConnectionProvider,
|
|
29
|
+
api_key: typing.Optional[str] = OMIT,
|
|
30
|
+
deployment_name: typing.Optional[str] = OMIT,
|
|
31
|
+
endpoint: typing.Optional[str] = OMIT,
|
|
32
|
+
scope: typing.Optional[ModelProviderConnectionScope] = OMIT,
|
|
33
|
+
organization: typing.Optional[ModelProviderConnectionOrganization] = OMIT,
|
|
34
|
+
created_by: typing.Optional[ModelProviderConnectionCreatedBy] = OMIT,
|
|
35
|
+
created_at: typing.Optional[dt.datetime] = OMIT,
|
|
36
|
+
updated_at: typing.Optional[dt.datetime] = OMIT,
|
|
37
|
+
request_options: typing.Optional[RequestOptions] = None
|
|
38
|
+
) -> ModelProviderConnection:
|
|
39
|
+
"""
|
|
40
|
+
Create a new model provider connection.
|
|
41
|
+
|
|
42
|
+
Parameters
|
|
43
|
+
----------
|
|
44
|
+
provider : ModelProviderConnectionProvider
|
|
45
|
+
|
|
46
|
+
api_key : typing.Optional[str]
|
|
47
|
+
|
|
48
|
+
deployment_name : typing.Optional[str]
|
|
49
|
+
|
|
50
|
+
endpoint : typing.Optional[str]
|
|
51
|
+
|
|
52
|
+
scope : typing.Optional[ModelProviderConnectionScope]
|
|
53
|
+
|
|
54
|
+
organization : typing.Optional[ModelProviderConnectionOrganization]
|
|
55
|
+
|
|
56
|
+
created_by : typing.Optional[ModelProviderConnectionCreatedBy]
|
|
57
|
+
|
|
58
|
+
created_at : typing.Optional[dt.datetime]
|
|
59
|
+
|
|
60
|
+
updated_at : typing.Optional[dt.datetime]
|
|
61
|
+
|
|
62
|
+
request_options : typing.Optional[RequestOptions]
|
|
63
|
+
Request-specific configuration.
|
|
64
|
+
|
|
65
|
+
Returns
|
|
66
|
+
-------
|
|
67
|
+
ModelProviderConnection
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
Examples
|
|
71
|
+
--------
|
|
72
|
+
from label_studio_sdk.client import LabelStudio
|
|
73
|
+
|
|
74
|
+
client = LabelStudio(
|
|
75
|
+
api_key="YOUR_API_KEY",
|
|
76
|
+
)
|
|
77
|
+
client.model_providers.create(
|
|
78
|
+
provider="OpenAI",
|
|
79
|
+
)
|
|
80
|
+
"""
|
|
81
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
82
|
+
"api/model-provider-connections/",
|
|
83
|
+
method="POST",
|
|
84
|
+
json={
|
|
85
|
+
"provider": provider,
|
|
86
|
+
"api_key": api_key,
|
|
87
|
+
"deployment_name": deployment_name,
|
|
88
|
+
"endpoint": endpoint,
|
|
89
|
+
"scope": scope,
|
|
90
|
+
"organization": organization,
|
|
91
|
+
"created_by": created_by,
|
|
92
|
+
"created_at": created_at,
|
|
93
|
+
"updated_at": updated_at,
|
|
94
|
+
},
|
|
95
|
+
request_options=request_options,
|
|
96
|
+
omit=OMIT,
|
|
97
|
+
)
|
|
98
|
+
try:
|
|
99
|
+
if 200 <= _response.status_code < 300:
|
|
100
|
+
return pydantic_v1.parse_obj_as(ModelProviderConnection, _response.json()) # type: ignore
|
|
101
|
+
_response_json = _response.json()
|
|
102
|
+
except JSONDecodeError:
|
|
103
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
104
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
class AsyncModelProvidersClient:
|
|
108
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
109
|
+
self._client_wrapper = client_wrapper
|
|
110
|
+
|
|
111
|
+
async def create(
|
|
112
|
+
self,
|
|
113
|
+
*,
|
|
114
|
+
provider: ModelProviderConnectionProvider,
|
|
115
|
+
api_key: typing.Optional[str] = OMIT,
|
|
116
|
+
deployment_name: typing.Optional[str] = OMIT,
|
|
117
|
+
endpoint: typing.Optional[str] = OMIT,
|
|
118
|
+
scope: typing.Optional[ModelProviderConnectionScope] = OMIT,
|
|
119
|
+
organization: typing.Optional[ModelProviderConnectionOrganization] = OMIT,
|
|
120
|
+
created_by: typing.Optional[ModelProviderConnectionCreatedBy] = OMIT,
|
|
121
|
+
created_at: typing.Optional[dt.datetime] = OMIT,
|
|
122
|
+
updated_at: typing.Optional[dt.datetime] = OMIT,
|
|
123
|
+
request_options: typing.Optional[RequestOptions] = None
|
|
124
|
+
) -> ModelProviderConnection:
|
|
125
|
+
"""
|
|
126
|
+
Create a new model provider connection.
|
|
127
|
+
|
|
128
|
+
Parameters
|
|
129
|
+
----------
|
|
130
|
+
provider : ModelProviderConnectionProvider
|
|
131
|
+
|
|
132
|
+
api_key : typing.Optional[str]
|
|
133
|
+
|
|
134
|
+
deployment_name : typing.Optional[str]
|
|
135
|
+
|
|
136
|
+
endpoint : typing.Optional[str]
|
|
137
|
+
|
|
138
|
+
scope : typing.Optional[ModelProviderConnectionScope]
|
|
139
|
+
|
|
140
|
+
organization : typing.Optional[ModelProviderConnectionOrganization]
|
|
141
|
+
|
|
142
|
+
created_by : typing.Optional[ModelProviderConnectionCreatedBy]
|
|
143
|
+
|
|
144
|
+
created_at : typing.Optional[dt.datetime]
|
|
145
|
+
|
|
146
|
+
updated_at : typing.Optional[dt.datetime]
|
|
147
|
+
|
|
148
|
+
request_options : typing.Optional[RequestOptions]
|
|
149
|
+
Request-specific configuration.
|
|
150
|
+
|
|
151
|
+
Returns
|
|
152
|
+
-------
|
|
153
|
+
ModelProviderConnection
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
Examples
|
|
157
|
+
--------
|
|
158
|
+
from label_studio_sdk.client import AsyncLabelStudio
|
|
159
|
+
|
|
160
|
+
client = AsyncLabelStudio(
|
|
161
|
+
api_key="YOUR_API_KEY",
|
|
162
|
+
)
|
|
163
|
+
await client.model_providers.create(
|
|
164
|
+
provider="OpenAI",
|
|
165
|
+
)
|
|
166
|
+
"""
|
|
167
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
168
|
+
"api/model-provider-connections/",
|
|
169
|
+
method="POST",
|
|
170
|
+
json={
|
|
171
|
+
"provider": provider,
|
|
172
|
+
"api_key": api_key,
|
|
173
|
+
"deployment_name": deployment_name,
|
|
174
|
+
"endpoint": endpoint,
|
|
175
|
+
"scope": scope,
|
|
176
|
+
"organization": organization,
|
|
177
|
+
"created_by": created_by,
|
|
178
|
+
"created_at": created_at,
|
|
179
|
+
"updated_at": updated_at,
|
|
180
|
+
},
|
|
181
|
+
request_options=request_options,
|
|
182
|
+
omit=OMIT,
|
|
183
|
+
)
|
|
184
|
+
try:
|
|
185
|
+
if 200 <= _response.status_code < 300:
|
|
186
|
+
return pydantic_v1.parse_obj_as(ModelProviderConnection, _response.json()) # type: ignore
|
|
187
|
+
_response_json = _response.json()
|
|
188
|
+
except JSONDecodeError:
|
|
189
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
190
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
@@ -131,6 +131,7 @@ class ProjectsClient:
|
|
|
131
131
|
color: typing.Optional[str] = OMIT,
|
|
132
132
|
control_weights: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
|
133
133
|
workspace: typing.Optional[int] = OMIT,
|
|
134
|
+
model_version: typing.Optional[str] = OMIT,
|
|
134
135
|
request_options: typing.Optional[RequestOptions] = None,
|
|
135
136
|
) -> ProjectsCreateResponse:
|
|
136
137
|
"""
|
|
@@ -188,6 +189,9 @@ class ProjectsClient:
|
|
|
188
189
|
workspace : typing.Optional[int]
|
|
189
190
|
Workspace ID
|
|
190
191
|
|
|
192
|
+
model_version : typing.Optional[str]
|
|
193
|
+
Model version
|
|
194
|
+
|
|
191
195
|
request_options : typing.Optional[RequestOptions]
|
|
192
196
|
Request-specific configuration.
|
|
193
197
|
|
|
@@ -223,6 +227,7 @@ class ProjectsClient:
|
|
|
223
227
|
"color": color,
|
|
224
228
|
"control_weights": control_weights,
|
|
225
229
|
"workspace": workspace,
|
|
230
|
+
"model_version": model_version,
|
|
226
231
|
},
|
|
227
232
|
request_options=request_options,
|
|
228
233
|
omit=OMIT,
|
|
@@ -332,6 +337,7 @@ class ProjectsClient:
|
|
|
332
337
|
color: typing.Optional[str] = OMIT,
|
|
333
338
|
control_weights: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
|
334
339
|
workspace: typing.Optional[int] = OMIT,
|
|
340
|
+
model_version: typing.Optional[str] = OMIT,
|
|
335
341
|
request_options: typing.Optional[RequestOptions] = None,
|
|
336
342
|
) -> ProjectsUpdateResponse:
|
|
337
343
|
"""
|
|
@@ -396,6 +402,9 @@ class ProjectsClient:
|
|
|
396
402
|
workspace : typing.Optional[int]
|
|
397
403
|
Workspace ID
|
|
398
404
|
|
|
405
|
+
model_version : typing.Optional[str]
|
|
406
|
+
Model version
|
|
407
|
+
|
|
399
408
|
request_options : typing.Optional[RequestOptions]
|
|
400
409
|
Request-specific configuration.
|
|
401
410
|
|
|
@@ -433,6 +442,7 @@ class ProjectsClient:
|
|
|
433
442
|
"color": color,
|
|
434
443
|
"control_weights": control_weights,
|
|
435
444
|
"workspace": workspace,
|
|
445
|
+
"model_version": model_version,
|
|
436
446
|
},
|
|
437
447
|
request_options=request_options,
|
|
438
448
|
omit=OMIT,
|
|
@@ -541,7 +551,7 @@ class ProjectsClient:
|
|
|
541
551
|
)
|
|
542
552
|
client.projects.import_tasks(
|
|
543
553
|
id=1,
|
|
544
|
-
request=[{}],
|
|
554
|
+
request=[{"key": "value"}],
|
|
545
555
|
)
|
|
546
556
|
"""
|
|
547
557
|
_response = self._client_wrapper.httpx_client.request(
|
|
@@ -567,7 +577,7 @@ class ProjectsClient:
|
|
|
567
577
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
568
578
|
|
|
569
579
|
def validate_config(
|
|
570
|
-
self, id: int, *,
|
|
580
|
+
self, id: int, *, label_config: str, request_options: typing.Optional[RequestOptions] = None
|
|
571
581
|
) -> ProjectLabelConfig:
|
|
572
582
|
"""
|
|
573
583
|
Determine whether the label configuration for a specific project is valid. For more information about setting up labeling configs, see [Configure labeling interface](https://labelstud.io/guide/setup) and our [Tags reference](https://labelstud.io/tags/).
|
|
@@ -579,7 +589,8 @@ class ProjectsClient:
|
|
|
579
589
|
id : int
|
|
580
590
|
A unique integer value identifying this project.
|
|
581
591
|
|
|
582
|
-
|
|
592
|
+
label_config : str
|
|
593
|
+
Label config in XML format. See more about it in documentation
|
|
583
594
|
|
|
584
595
|
request_options : typing.Optional[RequestOptions]
|
|
585
596
|
Request-specific configuration.
|
|
@@ -591,7 +602,6 @@ class ProjectsClient:
|
|
|
591
602
|
|
|
592
603
|
Examples
|
|
593
604
|
--------
|
|
594
|
-
from label_studio_sdk import ProjectLabelConfig
|
|
595
605
|
from label_studio_sdk.client import LabelStudio
|
|
596
606
|
|
|
597
607
|
client = LabelStudio(
|
|
@@ -599,15 +609,13 @@ class ProjectsClient:
|
|
|
599
609
|
)
|
|
600
610
|
client.projects.validate_config(
|
|
601
611
|
id=1,
|
|
602
|
-
|
|
603
|
-
label_config="label_config",
|
|
604
|
-
),
|
|
612
|
+
label_config="label_config",
|
|
605
613
|
)
|
|
606
614
|
"""
|
|
607
615
|
_response = self._client_wrapper.httpx_client.request(
|
|
608
616
|
f"api/projects/{jsonable_encoder(id)}/validate/",
|
|
609
617
|
method="POST",
|
|
610
|
-
json=
|
|
618
|
+
json={"label_config": label_config},
|
|
611
619
|
request_options=request_options,
|
|
612
620
|
omit=OMIT,
|
|
613
621
|
)
|
|
@@ -729,6 +737,7 @@ class AsyncProjectsClient:
|
|
|
729
737
|
color: typing.Optional[str] = OMIT,
|
|
730
738
|
control_weights: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
|
731
739
|
workspace: typing.Optional[int] = OMIT,
|
|
740
|
+
model_version: typing.Optional[str] = OMIT,
|
|
732
741
|
request_options: typing.Optional[RequestOptions] = None,
|
|
733
742
|
) -> ProjectsCreateResponse:
|
|
734
743
|
"""
|
|
@@ -786,6 +795,9 @@ class AsyncProjectsClient:
|
|
|
786
795
|
workspace : typing.Optional[int]
|
|
787
796
|
Workspace ID
|
|
788
797
|
|
|
798
|
+
model_version : typing.Optional[str]
|
|
799
|
+
Model version
|
|
800
|
+
|
|
789
801
|
request_options : typing.Optional[RequestOptions]
|
|
790
802
|
Request-specific configuration.
|
|
791
803
|
|
|
@@ -821,6 +833,7 @@ class AsyncProjectsClient:
|
|
|
821
833
|
"color": color,
|
|
822
834
|
"control_weights": control_weights,
|
|
823
835
|
"workspace": workspace,
|
|
836
|
+
"model_version": model_version,
|
|
824
837
|
},
|
|
825
838
|
request_options=request_options,
|
|
826
839
|
omit=OMIT,
|
|
@@ -930,6 +943,7 @@ class AsyncProjectsClient:
|
|
|
930
943
|
color: typing.Optional[str] = OMIT,
|
|
931
944
|
control_weights: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
|
932
945
|
workspace: typing.Optional[int] = OMIT,
|
|
946
|
+
model_version: typing.Optional[str] = OMIT,
|
|
933
947
|
request_options: typing.Optional[RequestOptions] = None,
|
|
934
948
|
) -> ProjectsUpdateResponse:
|
|
935
949
|
"""
|
|
@@ -994,6 +1008,9 @@ class AsyncProjectsClient:
|
|
|
994
1008
|
workspace : typing.Optional[int]
|
|
995
1009
|
Workspace ID
|
|
996
1010
|
|
|
1011
|
+
model_version : typing.Optional[str]
|
|
1012
|
+
Model version
|
|
1013
|
+
|
|
997
1014
|
request_options : typing.Optional[RequestOptions]
|
|
998
1015
|
Request-specific configuration.
|
|
999
1016
|
|
|
@@ -1031,6 +1048,7 @@ class AsyncProjectsClient:
|
|
|
1031
1048
|
"color": color,
|
|
1032
1049
|
"control_weights": control_weights,
|
|
1033
1050
|
"workspace": workspace,
|
|
1051
|
+
"model_version": model_version,
|
|
1034
1052
|
},
|
|
1035
1053
|
request_options=request_options,
|
|
1036
1054
|
omit=OMIT,
|
|
@@ -1139,7 +1157,7 @@ class AsyncProjectsClient:
|
|
|
1139
1157
|
)
|
|
1140
1158
|
await client.projects.import_tasks(
|
|
1141
1159
|
id=1,
|
|
1142
|
-
request=[{}],
|
|
1160
|
+
request=[{"key": "value"}],
|
|
1143
1161
|
)
|
|
1144
1162
|
"""
|
|
1145
1163
|
_response = await self._client_wrapper.httpx_client.request(
|
|
@@ -1165,7 +1183,7 @@ class AsyncProjectsClient:
|
|
|
1165
1183
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1166
1184
|
|
|
1167
1185
|
async def validate_config(
|
|
1168
|
-
self, id: int, *,
|
|
1186
|
+
self, id: int, *, label_config: str, request_options: typing.Optional[RequestOptions] = None
|
|
1169
1187
|
) -> ProjectLabelConfig:
|
|
1170
1188
|
"""
|
|
1171
1189
|
Determine whether the label configuration for a specific project is valid. For more information about setting up labeling configs, see [Configure labeling interface](https://labelstud.io/guide/setup) and our [Tags reference](https://labelstud.io/tags/).
|
|
@@ -1177,7 +1195,8 @@ class AsyncProjectsClient:
|
|
|
1177
1195
|
id : int
|
|
1178
1196
|
A unique integer value identifying this project.
|
|
1179
1197
|
|
|
1180
|
-
|
|
1198
|
+
label_config : str
|
|
1199
|
+
Label config in XML format. See more about it in documentation
|
|
1181
1200
|
|
|
1182
1201
|
request_options : typing.Optional[RequestOptions]
|
|
1183
1202
|
Request-specific configuration.
|
|
@@ -1189,7 +1208,6 @@ class AsyncProjectsClient:
|
|
|
1189
1208
|
|
|
1190
1209
|
Examples
|
|
1191
1210
|
--------
|
|
1192
|
-
from label_studio_sdk import ProjectLabelConfig
|
|
1193
1211
|
from label_studio_sdk.client import AsyncLabelStudio
|
|
1194
1212
|
|
|
1195
1213
|
client = AsyncLabelStudio(
|
|
@@ -1197,15 +1215,13 @@ class AsyncProjectsClient:
|
|
|
1197
1215
|
)
|
|
1198
1216
|
await client.projects.validate_config(
|
|
1199
1217
|
id=1,
|
|
1200
|
-
|
|
1201
|
-
label_config="label_config",
|
|
1202
|
-
),
|
|
1218
|
+
label_config="label_config",
|
|
1203
1219
|
)
|
|
1204
1220
|
"""
|
|
1205
1221
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1206
1222
|
f"api/projects/{jsonable_encoder(id)}/validate/",
|
|
1207
1223
|
method="POST",
|
|
1208
|
-
json=
|
|
1224
|
+
json={"label_config": label_config},
|
|
1209
1225
|
request_options=request_options,
|
|
1210
1226
|
omit=OMIT,
|
|
1211
1227
|
)
|