label-studio-sdk 1.0.0__py3-none-any.whl → 1.0.1__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 +30 -4
- label_studio_sdk/_extensions/pager_ext.py +49 -0
- label_studio_sdk/_legacy/objects.py +46 -7
- label_studio_sdk/_legacy/schema/label_config_schema.json +14 -14
- label_studio_sdk/actions/__init__.py +25 -0
- label_studio_sdk/actions/client.py +79 -6
- label_studio_sdk/actions/types/__init__.py +25 -0
- label_studio_sdk/actions/types/actions_create_request_filters.py +43 -0
- label_studio_sdk/actions/types/actions_create_request_filters_conjunction.py +5 -0
- label_studio_sdk/actions/types/actions_create_request_filters_items_item.py +49 -0
- label_studio_sdk/actions/types/actions_create_request_filters_items_item_filter.py +31 -0
- label_studio_sdk/actions/types/actions_create_request_filters_items_item_operator.py +23 -0
- label_studio_sdk/actions/types/actions_create_request_id.py +19 -0
- label_studio_sdk/actions/types/actions_create_request_ordering_item.py +31 -0
- label_studio_sdk/actions/types/actions_create_request_selected_items.py +10 -0
- label_studio_sdk/actions/types/actions_create_request_selected_items_excluded.py +39 -0
- label_studio_sdk/actions/types/actions_create_request_selected_items_included.py +39 -0
- label_studio_sdk/base_client.py +183 -0
- label_studio_sdk/client.py +17 -175
- label_studio_sdk/core/client_wrapper.py +1 -1
- label_studio_sdk/core/http_client.py +5 -1
- label_studio_sdk/export_storage/azure/client.py +176 -10
- label_studio_sdk/export_storage/azure/types/azure_create_response.py +15 -0
- label_studio_sdk/export_storage/azure/types/azure_update_response.py +15 -0
- label_studio_sdk/export_storage/gcs/client.py +180 -14
- label_studio_sdk/export_storage/gcs/types/gcs_create_response.py +16 -1
- label_studio_sdk/export_storage/gcs/types/gcs_update_response.py +16 -1
- label_studio_sdk/export_storage/local/client.py +168 -22
- label_studio_sdk/export_storage/local/types/local_create_response.py +12 -2
- label_studio_sdk/export_storage/local/types/local_update_response.py +12 -2
- label_studio_sdk/export_storage/redis/client.py +234 -30
- label_studio_sdk/export_storage/redis/types/redis_create_response.py +20 -5
- label_studio_sdk/export_storage/redis/types/redis_update_response.py +20 -5
- label_studio_sdk/export_storage/s3/client.py +214 -26
- label_studio_sdk/export_storage/s3/types/s3create_response.py +15 -0
- label_studio_sdk/export_storage/s3/types/s3update_response.py +15 -0
- label_studio_sdk/import_storage/azure/client.py +266 -90
- label_studio_sdk/import_storage/azure/types/azure_create_response.py +28 -18
- label_studio_sdk/import_storage/azure/types/azure_update_response.py +28 -18
- label_studio_sdk/import_storage/gcs/client.py +270 -94
- label_studio_sdk/import_storage/gcs/types/gcs_create_response.py +28 -18
- label_studio_sdk/import_storage/gcs/types/gcs_update_response.py +28 -18
- label_studio_sdk/import_storage/local/client.py +168 -22
- label_studio_sdk/import_storage/local/types/local_create_response.py +12 -2
- label_studio_sdk/import_storage/local/types/local_update_response.py +12 -2
- label_studio_sdk/import_storage/redis/client.py +206 -50
- label_studio_sdk/import_storage/redis/types/redis_create_response.py +20 -10
- label_studio_sdk/import_storage/redis/types/redis_update_response.py +20 -10
- label_studio_sdk/import_storage/s3/client.py +336 -110
- label_studio_sdk/import_storage/s3/types/s3create_response.py +35 -25
- label_studio_sdk/import_storage/s3/types/s3update_response.py +35 -25
- label_studio_sdk/{_legacy/label_interface → label_interface}/base.py +10 -0
- label_studio_sdk/{_legacy/label_interface → label_interface}/control_tags.py +109 -71
- label_studio_sdk/{_legacy/label_interface → label_interface}/interface.py +96 -50
- label_studio_sdk/{_legacy/label_interface → label_interface}/object_tags.py +8 -13
- label_studio_sdk/label_interface/region.py +75 -0
- label_studio_sdk/projects/client.py +4 -2
- label_studio_sdk/projects/client_ext.py +19 -0
- label_studio_sdk/tasks/client.py +26 -2
- label_studio_sdk/tasks/client_ext.py +18 -0
- label_studio_sdk/types/annotation.py +5 -5
- label_studio_sdk/types/task.py +1 -1
- label_studio_sdk/views/__init__.py +8 -4
- label_studio_sdk/views/types/__init__.py +8 -4
- label_studio_sdk/views/types/views_create_request_data.py +2 -2
- label_studio_sdk/views/types/views_create_request_data_filters.py +5 -5
- label_studio_sdk/views/types/views_create_request_data_filters_conjunction.py +1 -1
- label_studio_sdk/views/types/views_create_request_data_filters_items_item.py +10 -8
- label_studio_sdk/views/types/views_create_request_data_filters_items_item_filter.py +31 -0
- label_studio_sdk/views/types/views_create_request_data_filters_items_item_operator.py +23 -0
- label_studio_sdk/views/types/views_create_request_data_ordering_item.py +27 -34
- label_studio_sdk/views/types/views_update_request_data.py +2 -2
- label_studio_sdk/views/types/views_update_request_data_filters.py +5 -5
- label_studio_sdk/views/types/views_update_request_data_filters_conjunction.py +1 -1
- label_studio_sdk/views/types/views_update_request_data_filters_items_item.py +10 -8
- label_studio_sdk/views/types/views_update_request_data_filters_items_item_filter.py +31 -0
- label_studio_sdk/views/types/views_update_request_data_filters_items_item_operator.py +23 -0
- label_studio_sdk/views/types/views_update_request_data_ordering_item.py +27 -34
- {label_studio_sdk-1.0.0.dist-info → label_studio_sdk-1.0.1.dist-info}/METADATA +17 -161
- {label_studio_sdk-1.0.0.dist-info → label_studio_sdk-1.0.1.dist-info}/RECORD +84 -67
- label_studio_sdk/_legacy/label_interface/region.py +0 -43
- label_studio_sdk/views/types/views_create_request_data_ordering_item_direction.py +0 -5
- label_studio_sdk/views/types/views_update_request_data_ordering_item_direction.py +0 -5
- /label_studio_sdk/{_legacy/label_interface → label_interface}/__init__.py +0 -0
- /label_studio_sdk/{_legacy/label_interface → label_interface}/data_examples.json +0 -0
- /label_studio_sdk/{_legacy/label_interface → label_interface}/label_tags.py +0 -0
- {label_studio_sdk-1.0.0.dist-info → label_studio_sdk-1.0.1.dist-info}/WHEEL +0 -0
label_studio_sdk/__init__.py
CHANGED
|
@@ -73,6 +73,18 @@ from . import (
|
|
|
73
73
|
webhooks,
|
|
74
74
|
)
|
|
75
75
|
from ._legacy import Client
|
|
76
|
+
from .actions import (
|
|
77
|
+
ActionsCreateRequestFilters,
|
|
78
|
+
ActionsCreateRequestFiltersConjunction,
|
|
79
|
+
ActionsCreateRequestFiltersItemsItem,
|
|
80
|
+
ActionsCreateRequestFiltersItemsItemFilter,
|
|
81
|
+
ActionsCreateRequestFiltersItemsItemOperator,
|
|
82
|
+
ActionsCreateRequestId,
|
|
83
|
+
ActionsCreateRequestOrderingItem,
|
|
84
|
+
ActionsCreateRequestSelectedItems,
|
|
85
|
+
ActionsCreateRequestSelectedItemsExcluded,
|
|
86
|
+
ActionsCreateRequestSelectedItemsIncluded,
|
|
87
|
+
)
|
|
76
88
|
from .environment import LabelStudioEnvironment
|
|
77
89
|
from .export_storage import ExportStorageListTypesResponseItem
|
|
78
90
|
from .import_storage import ImportStorageListTypesResponseItem
|
|
@@ -93,18 +105,30 @@ from .views import (
|
|
|
93
105
|
ViewsCreateRequestDataFilters,
|
|
94
106
|
ViewsCreateRequestDataFiltersConjunction,
|
|
95
107
|
ViewsCreateRequestDataFiltersItemsItem,
|
|
108
|
+
ViewsCreateRequestDataFiltersItemsItemFilter,
|
|
109
|
+
ViewsCreateRequestDataFiltersItemsItemOperator,
|
|
96
110
|
ViewsCreateRequestDataOrderingItem,
|
|
97
|
-
ViewsCreateRequestDataOrderingItemDirection,
|
|
98
111
|
ViewsUpdateRequestData,
|
|
99
112
|
ViewsUpdateRequestDataFilters,
|
|
100
113
|
ViewsUpdateRequestDataFiltersConjunction,
|
|
101
114
|
ViewsUpdateRequestDataFiltersItemsItem,
|
|
115
|
+
ViewsUpdateRequestDataFiltersItemsItemFilter,
|
|
116
|
+
ViewsUpdateRequestDataFiltersItemsItemOperator,
|
|
102
117
|
ViewsUpdateRequestDataOrderingItem,
|
|
103
|
-
ViewsUpdateRequestDataOrderingItemDirection,
|
|
104
118
|
)
|
|
105
119
|
from .webhooks import WebhooksUpdateRequestActionsItem
|
|
106
120
|
|
|
107
121
|
__all__ = [
|
|
122
|
+
"ActionsCreateRequestFilters",
|
|
123
|
+
"ActionsCreateRequestFiltersConjunction",
|
|
124
|
+
"ActionsCreateRequestFiltersItemsItem",
|
|
125
|
+
"ActionsCreateRequestFiltersItemsItemFilter",
|
|
126
|
+
"ActionsCreateRequestFiltersItemsItemOperator",
|
|
127
|
+
"ActionsCreateRequestId",
|
|
128
|
+
"ActionsCreateRequestOrderingItem",
|
|
129
|
+
"ActionsCreateRequestSelectedItems",
|
|
130
|
+
"ActionsCreateRequestSelectedItemsExcluded",
|
|
131
|
+
"ActionsCreateRequestSelectedItemsIncluded",
|
|
108
132
|
"Annotation",
|
|
109
133
|
"AnnotationFilterOptions",
|
|
110
134
|
"AnnotationLastAction",
|
|
@@ -179,14 +203,16 @@ __all__ = [
|
|
|
179
203
|
"ViewsCreateRequestDataFilters",
|
|
180
204
|
"ViewsCreateRequestDataFiltersConjunction",
|
|
181
205
|
"ViewsCreateRequestDataFiltersItemsItem",
|
|
206
|
+
"ViewsCreateRequestDataFiltersItemsItemFilter",
|
|
207
|
+
"ViewsCreateRequestDataFiltersItemsItemOperator",
|
|
182
208
|
"ViewsCreateRequestDataOrderingItem",
|
|
183
|
-
"ViewsCreateRequestDataOrderingItemDirection",
|
|
184
209
|
"ViewsUpdateRequestData",
|
|
185
210
|
"ViewsUpdateRequestDataFilters",
|
|
186
211
|
"ViewsUpdateRequestDataFiltersConjunction",
|
|
187
212
|
"ViewsUpdateRequestDataFiltersItemsItem",
|
|
213
|
+
"ViewsUpdateRequestDataFiltersItemsItemFilter",
|
|
214
|
+
"ViewsUpdateRequestDataFiltersItemsItemOperator",
|
|
188
215
|
"ViewsUpdateRequestDataOrderingItem",
|
|
189
|
-
"ViewsUpdateRequestDataOrderingItemDirection",
|
|
190
216
|
"Webhook",
|
|
191
217
|
"WebhookActionsItem",
|
|
192
218
|
"WebhookSerializerForUpdate",
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import typing
|
|
2
|
+
from label_studio_sdk.core.pagination import SyncPager, AsyncPager, T
|
|
3
|
+
from label_studio_sdk.core.api_error import ApiError
|
|
4
|
+
|
|
5
|
+
# This is a custom extension of the autogenerated SyncPager and AsyncPager classes
|
|
6
|
+
# that works with the Label Studio SDK's default pagination behavior
|
|
7
|
+
# that throws 404 errors at the end of the pagination.
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class SyncPagerExt(SyncPager, typing.Generic[T]):
|
|
11
|
+
|
|
12
|
+
@classmethod
|
|
13
|
+
def from_sync_pager(cls, sync_pager: SyncPager) -> 'SyncPagerExt':
|
|
14
|
+
return cls(
|
|
15
|
+
get_next=sync_pager.get_next,
|
|
16
|
+
has_next=sync_pager.has_next,
|
|
17
|
+
items=sync_pager.items
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
def __iter__(self) -> typing.Iterator[T]: # type: ignore
|
|
21
|
+
# Extends the iterator to catch 404 errors at the end of the pagination
|
|
22
|
+
try:
|
|
23
|
+
for item in super().__iter__():
|
|
24
|
+
yield item
|
|
25
|
+
except ApiError as exc:
|
|
26
|
+
if exc.status_code == 404:
|
|
27
|
+
return
|
|
28
|
+
raise
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class AsyncPagerExt(AsyncPager, typing.Generic[T]):
|
|
32
|
+
|
|
33
|
+
@classmethod
|
|
34
|
+
async def from_async_pager(cls, async_pager: AsyncPager) -> 'AsyncPagerExt':
|
|
35
|
+
return cls(
|
|
36
|
+
get_next=async_pager.get_next,
|
|
37
|
+
has_next=async_pager.has_next,
|
|
38
|
+
items=async_pager.items
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
async def __aiter__(self) -> typing.AsyncIterator[T]: # type: ignore
|
|
42
|
+
# Extends the iterator to catch 404 errors at the end of the pagination
|
|
43
|
+
try:
|
|
44
|
+
async for item in super().__aiter__():
|
|
45
|
+
yield item
|
|
46
|
+
except ApiError as exc:
|
|
47
|
+
if exc.status_code == 404:
|
|
48
|
+
return
|
|
49
|
+
raise
|
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
from typing import Type, Dict, Optional, List, Tuple, Any, Union
|
|
2
|
-
from pydantic import BaseModel, confloat
|
|
2
|
+
from pydantic import BaseModel, Field, confloat
|
|
3
|
+
|
|
4
|
+
from label_studio_sdk.label_interface.region import Region
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def serialize_regions(result):
|
|
8
|
+
""" """
|
|
9
|
+
res = []
|
|
10
|
+
relations = []
|
|
11
|
+
for r in result:
|
|
12
|
+
if isinstance(r, Region):
|
|
13
|
+
res.append(r._dict())
|
|
14
|
+
if r.has_relations:
|
|
15
|
+
relations.append(r._dict_relations())
|
|
16
|
+
else:
|
|
17
|
+
res.append(r)
|
|
18
|
+
|
|
19
|
+
return res + relations
|
|
3
20
|
|
|
4
21
|
|
|
5
22
|
class PredictionValue(BaseModel):
|
|
@@ -7,29 +24,51 @@ class PredictionValue(BaseModel):
|
|
|
7
24
|
|
|
8
25
|
model_version: Optional[Any] = None
|
|
9
26
|
score: Optional[float] = 0.00
|
|
10
|
-
result: Optional[List[Any]
|
|
27
|
+
result: Optional[List[Union[Dict[str, Any], Region]]]
|
|
11
28
|
# cluster: Optional[Any] = None
|
|
12
29
|
# neighbors: Optional[Any] = None
|
|
13
30
|
|
|
14
|
-
|
|
15
|
-
|
|
31
|
+
class Config:
|
|
32
|
+
allow_population_by_field_name = True
|
|
16
33
|
|
|
34
|
+
def serialize(self):
|
|
35
|
+
""" """
|
|
17
36
|
return {
|
|
18
37
|
"model_version": self.model_version,
|
|
19
38
|
"score": self.score,
|
|
20
|
-
"result":
|
|
39
|
+
"result": serialize_regions(self.result),
|
|
21
40
|
}
|
|
22
41
|
|
|
23
42
|
|
|
24
43
|
class AnnotationValue(BaseModel):
|
|
25
44
|
""" """
|
|
45
|
+
|
|
46
|
+
was_cancelled: Optional[bool] = False
|
|
47
|
+
ground_truth: Optional[bool] = False
|
|
48
|
+
lead_time: Optional[float] = 0.0
|
|
49
|
+
result_count: Optional[int] = 0
|
|
50
|
+
completed_by: int
|
|
51
|
+
|
|
52
|
+
result: Optional[List[Union[Dict[str, Any], Region]]]
|
|
53
|
+
|
|
54
|
+
class Config:
|
|
55
|
+
allow_population_by_field_name = True
|
|
26
56
|
|
|
27
|
-
|
|
57
|
+
def serialize(self):
|
|
58
|
+
""" """
|
|
59
|
+
return {
|
|
60
|
+
"was_cancelled": self.was_cancelled,
|
|
61
|
+
"ground_truth": self.ground_truth,
|
|
62
|
+
"lead_time": self.lead_time,
|
|
63
|
+
"result_count": self.result_count,
|
|
64
|
+
"completed_by": self.completed_by,
|
|
65
|
+
"result": serialize_regions(self.result),
|
|
66
|
+
}
|
|
28
67
|
|
|
29
68
|
|
|
30
69
|
class TaskValue(BaseModel):
|
|
31
70
|
""" """
|
|
32
|
-
|
|
71
|
+
|
|
33
72
|
data: Optional[dict]
|
|
34
73
|
annotations: Optional[List[AnnotationValue]]
|
|
35
74
|
predictions: Optional[List[PredictionValue]]
|
|
@@ -37,19 +37,19 @@
|
|
|
37
37
|
},
|
|
38
38
|
"tag_with_value_required_name": {
|
|
39
39
|
"type": "object",
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
40
|
+
"anyOf": [
|
|
41
|
+
{
|
|
42
|
+
"required": [
|
|
43
|
+
"@name",
|
|
44
|
+
"@valueList"
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"required": [
|
|
49
|
+
"@name",
|
|
50
|
+
"@value"
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
53
|
],
|
|
54
54
|
"properties": {
|
|
55
55
|
"@value": {
|
|
@@ -223,4 +223,4 @@
|
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
|
-
}
|
|
226
|
+
}
|
|
@@ -1,2 +1,27 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
+
from .types import (
|
|
4
|
+
ActionsCreateRequestFilters,
|
|
5
|
+
ActionsCreateRequestFiltersConjunction,
|
|
6
|
+
ActionsCreateRequestFiltersItemsItem,
|
|
7
|
+
ActionsCreateRequestFiltersItemsItemFilter,
|
|
8
|
+
ActionsCreateRequestFiltersItemsItemOperator,
|
|
9
|
+
ActionsCreateRequestId,
|
|
10
|
+
ActionsCreateRequestOrderingItem,
|
|
11
|
+
ActionsCreateRequestSelectedItems,
|
|
12
|
+
ActionsCreateRequestSelectedItemsExcluded,
|
|
13
|
+
ActionsCreateRequestSelectedItemsIncluded,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
"ActionsCreateRequestFilters",
|
|
18
|
+
"ActionsCreateRequestFiltersConjunction",
|
|
19
|
+
"ActionsCreateRequestFiltersItemsItem",
|
|
20
|
+
"ActionsCreateRequestFiltersItemsItemFilter",
|
|
21
|
+
"ActionsCreateRequestFiltersItemsItemOperator",
|
|
22
|
+
"ActionsCreateRequestId",
|
|
23
|
+
"ActionsCreateRequestOrderingItem",
|
|
24
|
+
"ActionsCreateRequestSelectedItems",
|
|
25
|
+
"ActionsCreateRequestSelectedItemsExcluded",
|
|
26
|
+
"ActionsCreateRequestSelectedItemsIncluded",
|
|
27
|
+
]
|
|
@@ -6,6 +6,13 @@ from json.decoder import JSONDecodeError
|
|
|
6
6
|
from ..core.api_error import ApiError
|
|
7
7
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
8
8
|
from ..core.request_options import RequestOptions
|
|
9
|
+
from .types.actions_create_request_filters import ActionsCreateRequestFilters
|
|
10
|
+
from .types.actions_create_request_id import ActionsCreateRequestId
|
|
11
|
+
from .types.actions_create_request_ordering_item import ActionsCreateRequestOrderingItem
|
|
12
|
+
from .types.actions_create_request_selected_items import ActionsCreateRequestSelectedItems
|
|
13
|
+
|
|
14
|
+
# this is used as the default value for optional parameters
|
|
15
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
9
16
|
|
|
10
17
|
|
|
11
18
|
class ActionsClient:
|
|
@@ -45,12 +52,40 @@ class ActionsClient:
|
|
|
45
52
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
46
53
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
47
54
|
|
|
48
|
-
def create(
|
|
55
|
+
def create(
|
|
56
|
+
self,
|
|
57
|
+
*,
|
|
58
|
+
id: typing.Optional[ActionsCreateRequestId] = None,
|
|
59
|
+
project: typing.Optional[int] = None,
|
|
60
|
+
view: typing.Optional[int] = None,
|
|
61
|
+
filters: typing.Optional[ActionsCreateRequestFilters] = OMIT,
|
|
62
|
+
selected_items: typing.Optional[ActionsCreateRequestSelectedItems] = OMIT,
|
|
63
|
+
ordering: typing.Optional[typing.Sequence[ActionsCreateRequestOrderingItem]] = OMIT,
|
|
64
|
+
request_options: typing.Optional[RequestOptions] = None
|
|
65
|
+
) -> None:
|
|
49
66
|
"""
|
|
50
|
-
Perform
|
|
67
|
+
Perform a Data Manager action with the selected tasks and filters.
|
|
51
68
|
|
|
52
69
|
Parameters
|
|
53
70
|
----------
|
|
71
|
+
id : typing.Optional[ActionsCreateRequestId]
|
|
72
|
+
Action name ID, the full list of actions can be retrieved with a GET request
|
|
73
|
+
|
|
74
|
+
project : typing.Optional[int]
|
|
75
|
+
Project ID
|
|
76
|
+
|
|
77
|
+
view : typing.Optional[int]
|
|
78
|
+
View ID (optional, it has higher priority than filters, selectedItems and ordering from the request body payload)
|
|
79
|
+
|
|
80
|
+
filters : typing.Optional[ActionsCreateRequestFilters]
|
|
81
|
+
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"}]}`
|
|
82
|
+
|
|
83
|
+
selected_items : typing.Optional[ActionsCreateRequestSelectedItems]
|
|
84
|
+
Task selection by IDs. If filters are applied, the selection will be applied to the filtered tasks.If "all" is `false`, `"included"` must be used. If "all" is `true`, `"excluded"` must be used.<br>Examples: `{"all": false, "included": [1, 2, 3]}` or `{"all": true, "excluded": [4, 5]}`
|
|
85
|
+
|
|
86
|
+
ordering : typing.Optional[typing.Sequence[ActionsCreateRequestOrderingItem]]
|
|
87
|
+
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`.
|
|
88
|
+
|
|
54
89
|
request_options : typing.Optional[RequestOptions]
|
|
55
90
|
Request-specific configuration.
|
|
56
91
|
|
|
@@ -68,7 +103,12 @@ class ActionsClient:
|
|
|
68
103
|
client.actions.create()
|
|
69
104
|
"""
|
|
70
105
|
_response = self._client_wrapper.httpx_client.request(
|
|
71
|
-
"api/dm/actions/",
|
|
106
|
+
"api/dm/actions/",
|
|
107
|
+
method="POST",
|
|
108
|
+
params={"id": id, "project": project, "view": view},
|
|
109
|
+
json={"filters": filters, "selectedItems": selected_items, "ordering": ordering},
|
|
110
|
+
request_options=request_options,
|
|
111
|
+
omit=OMIT,
|
|
72
112
|
)
|
|
73
113
|
if 200 <= _response.status_code < 300:
|
|
74
114
|
return
|
|
@@ -116,12 +156,40 @@ class AsyncActionsClient:
|
|
|
116
156
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
117
157
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
118
158
|
|
|
119
|
-
async def create(
|
|
159
|
+
async def create(
|
|
160
|
+
self,
|
|
161
|
+
*,
|
|
162
|
+
id: typing.Optional[ActionsCreateRequestId] = None,
|
|
163
|
+
project: typing.Optional[int] = None,
|
|
164
|
+
view: typing.Optional[int] = None,
|
|
165
|
+
filters: typing.Optional[ActionsCreateRequestFilters] = OMIT,
|
|
166
|
+
selected_items: typing.Optional[ActionsCreateRequestSelectedItems] = OMIT,
|
|
167
|
+
ordering: typing.Optional[typing.Sequence[ActionsCreateRequestOrderingItem]] = OMIT,
|
|
168
|
+
request_options: typing.Optional[RequestOptions] = None
|
|
169
|
+
) -> None:
|
|
120
170
|
"""
|
|
121
|
-
Perform
|
|
171
|
+
Perform a Data Manager action with the selected tasks and filters.
|
|
122
172
|
|
|
123
173
|
Parameters
|
|
124
174
|
----------
|
|
175
|
+
id : typing.Optional[ActionsCreateRequestId]
|
|
176
|
+
Action name ID, the full list of actions can be retrieved with a GET request
|
|
177
|
+
|
|
178
|
+
project : typing.Optional[int]
|
|
179
|
+
Project ID
|
|
180
|
+
|
|
181
|
+
view : typing.Optional[int]
|
|
182
|
+
View ID (optional, it has higher priority than filters, selectedItems and ordering from the request body payload)
|
|
183
|
+
|
|
184
|
+
filters : typing.Optional[ActionsCreateRequestFilters]
|
|
185
|
+
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"}]}`
|
|
186
|
+
|
|
187
|
+
selected_items : typing.Optional[ActionsCreateRequestSelectedItems]
|
|
188
|
+
Task selection by IDs. If filters are applied, the selection will be applied to the filtered tasks.If "all" is `false`, `"included"` must be used. If "all" is `true`, `"excluded"` must be used.<br>Examples: `{"all": false, "included": [1, 2, 3]}` or `{"all": true, "excluded": [4, 5]}`
|
|
189
|
+
|
|
190
|
+
ordering : typing.Optional[typing.Sequence[ActionsCreateRequestOrderingItem]]
|
|
191
|
+
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`.
|
|
192
|
+
|
|
125
193
|
request_options : typing.Optional[RequestOptions]
|
|
126
194
|
Request-specific configuration.
|
|
127
195
|
|
|
@@ -139,7 +207,12 @@ class AsyncActionsClient:
|
|
|
139
207
|
await client.actions.create()
|
|
140
208
|
"""
|
|
141
209
|
_response = await self._client_wrapper.httpx_client.request(
|
|
142
|
-
"api/dm/actions/",
|
|
210
|
+
"api/dm/actions/",
|
|
211
|
+
method="POST",
|
|
212
|
+
params={"id": id, "project": project, "view": view},
|
|
213
|
+
json={"filters": filters, "selectedItems": selected_items, "ordering": ordering},
|
|
214
|
+
request_options=request_options,
|
|
215
|
+
omit=OMIT,
|
|
143
216
|
)
|
|
144
217
|
if 200 <= _response.status_code < 300:
|
|
145
218
|
return
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from .actions_create_request_filters import ActionsCreateRequestFilters
|
|
4
|
+
from .actions_create_request_filters_conjunction import ActionsCreateRequestFiltersConjunction
|
|
5
|
+
from .actions_create_request_filters_items_item import ActionsCreateRequestFiltersItemsItem
|
|
6
|
+
from .actions_create_request_filters_items_item_filter import ActionsCreateRequestFiltersItemsItemFilter
|
|
7
|
+
from .actions_create_request_filters_items_item_operator import ActionsCreateRequestFiltersItemsItemOperator
|
|
8
|
+
from .actions_create_request_id import ActionsCreateRequestId
|
|
9
|
+
from .actions_create_request_ordering_item import ActionsCreateRequestOrderingItem
|
|
10
|
+
from .actions_create_request_selected_items import ActionsCreateRequestSelectedItems
|
|
11
|
+
from .actions_create_request_selected_items_excluded import ActionsCreateRequestSelectedItemsExcluded
|
|
12
|
+
from .actions_create_request_selected_items_included import ActionsCreateRequestSelectedItemsIncluded
|
|
13
|
+
|
|
14
|
+
__all__ = [
|
|
15
|
+
"ActionsCreateRequestFilters",
|
|
16
|
+
"ActionsCreateRequestFiltersConjunction",
|
|
17
|
+
"ActionsCreateRequestFiltersItemsItem",
|
|
18
|
+
"ActionsCreateRequestFiltersItemsItemFilter",
|
|
19
|
+
"ActionsCreateRequestFiltersItemsItemOperator",
|
|
20
|
+
"ActionsCreateRequestId",
|
|
21
|
+
"ActionsCreateRequestOrderingItem",
|
|
22
|
+
"ActionsCreateRequestSelectedItems",
|
|
23
|
+
"ActionsCreateRequestSelectedItemsExcluded",
|
|
24
|
+
"ActionsCreateRequestSelectedItemsIncluded",
|
|
25
|
+
]
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import datetime as dt
|
|
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
|
+
from .actions_create_request_filters_conjunction import ActionsCreateRequestFiltersConjunction
|
|
9
|
+
from .actions_create_request_filters_items_item import ActionsCreateRequestFiltersItemsItem
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ActionsCreateRequestFilters(pydantic_v1.BaseModel):
|
|
13
|
+
"""
|
|
14
|
+
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
|
+
"""
|
|
16
|
+
|
|
17
|
+
conjunction: ActionsCreateRequestFiltersConjunction = pydantic_v1.Field()
|
|
18
|
+
"""
|
|
19
|
+
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
|
+
"""
|
|
21
|
+
|
|
22
|
+
items: typing.List[ActionsCreateRequestFiltersItemsItem] = pydantic_v1.Field()
|
|
23
|
+
"""
|
|
24
|
+
List of filter items
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
def json(self, **kwargs: typing.Any) -> str:
|
|
28
|
+
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
|
29
|
+
return super().json(**kwargs_with_defaults)
|
|
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
|
+
)
|
|
38
|
+
|
|
39
|
+
class Config:
|
|
40
|
+
frozen = True
|
|
41
|
+
smart_union = True
|
|
42
|
+
extra = pydantic_v1.Extra.allow
|
|
43
|
+
json_encoders = {dt.datetime: serialize_datetime}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import datetime as dt
|
|
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
|
+
from .actions_create_request_filters_items_item_filter import ActionsCreateRequestFiltersItemsItemFilter
|
|
9
|
+
from .actions_create_request_filters_items_item_operator import ActionsCreateRequestFiltersItemsItemOperator
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ActionsCreateRequestFiltersItemsItem(pydantic_v1.BaseModel):
|
|
13
|
+
filter: ActionsCreateRequestFiltersItemsItemFilter = pydantic_v1.Field()
|
|
14
|
+
"""
|
|
15
|
+
Filter identifier, it should start with `filter:tasks:` prefix, e.g. `filter:tasks:agreement`. For `task.data` fields it may look like `filter:tasks:data.field_name`. Possible values:<br><li>`filter:tasks:agreement`<br> (Number) Agreement for annotation results for a specific task (Enterprise only)</li><br><li>`filter:tasks:annotations_results`<br> (String) Annotation results for the tasks</li><br><li>`filter:tasks:annotators`<br> (List) Annotators that completed the task (Community). Can include assigned annotators (Enterprise only). Important note: the filter `type` should be List, but the filter `value` is integer</li><br><li>`filter:tasks:cancelled_annotations`<br> (Number) Number of cancelled or skipped annotations for the task</li><br><li>`filter:tasks:comments`<br> (Number) Number of comments in a task</li><br><li>`filter:tasks:completed_at`<br> (Datetime) Time when a task was fully annotated</li><br><li>`filter:tasks:created_at`<br> (Datetime) Time the task was created at</li><br><li>`filter:tasks:file_upload`<br> (String) Name of the file uploaded to create the tasks</li><br><li>`filter:tasks:ground_truth`<br> (Boolean) Ground truth status of the tasks</li><br><li>`filter:tasks:id`<br> (Number) Task ID</li><br><li>`filter:tasks:inner_id`<br> (Number) Task Inner ID, it starts from 1 for all projects</li><br><li>`filter:tasks:predictions_model_versions`<br> (String) Model version used for the predictions</li><br><li>`filter:tasks:predictions_results`<br> (String) Prediction results for the tasks</li><br><li>`filter:tasks:predictions_score`<br> (Number) Prediction score for the task</li><br><li>`filter:tasks:reviewed`<br> (Boolean) Whether the tasks have been reviewed (Enterprise only)</li><br><li>`filter:tasks:reviewers`<br> (String) Reviewers that reviewed the task, or assigned reviewers (Enterprise only). Important note: the filter `type` should be List, but the filter `value` is integer</li><br><li>`filter:tasks:reviews_accepted`<br> (Number) Number of annotations accepted for a task in review (Enterprise only)</li><br><li>`filter:tasks:reviews_rejected`<br> (Number) Number of annotations rejected for a task in review (Enterprise only)</li><br><li>`filter:tasks:total_annotations`<br> (Number) Total number of annotations on a task</li><br><li>`filter:tasks:total_predictions`<br> (Number) Total number of predictions for the task</li><br><li>`filter:tasks:unresolved_comment_count`<br> (Number) Number of unresolved comments in a task</li><br><li>`filter:tasks:updated_at`<br> (Datetime) Time the task was updated at (e.g. new annotation was created, review added, etc)</li>
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
operator: ActionsCreateRequestFiltersItemsItemOperator = pydantic_v1.Field()
|
|
19
|
+
"""
|
|
20
|
+
Filter operator. Possible values:<br><li>`contains`<br> Contains</li><br><li>`ends_with`<br> Ends with</li><br><li>`equal`<br> Equal to</li><br><li>`exists`<br> Exists</li><br><li>`greater`<br> Greater than</li><br><li>`greater_or_equal`<br> Greater than or equal to</li><br><li>`in`<br> Is between min and max values, so the filter `value` should be e.g. `{"min": 1, "max": 7}`</li><br><li>`less`<br> Less than</li><br><li>`less_or_equal`<br> Less than or equal to</li><br><li>`not_contains`<br> Does not contain</li><br><li>`not_equal`<br> Not equal to</li><br><li>`not_exists`<br> Does not exist</li><br><li>`not_in`<br> Is not between min and max values, so the filter `value` should be e.g. `{"min": 1, "max": 7}`</li><br><li>`starts_with`<br> Starts with</li>
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
type: str = pydantic_v1.Field()
|
|
24
|
+
"""
|
|
25
|
+
Type of the filter value. Possible values:<br><li>`Boolean`<br> Boolean</li><br><li>`Datetime`<br> Datetime string in `strftime('%Y-%m-%dT%H:%M:%S.%fZ')` format</li><br><li>`List`<br> List of items</li><br><li>`Number`<br> Float or Integer</li><br><li>`String`<br> String</li><br><li>`Unknown`<br> Unknown is explicitly converted to string format</li>
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
value: str = pydantic_v1.Field()
|
|
29
|
+
"""
|
|
30
|
+
Value to filter by
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
def json(self, **kwargs: typing.Any) -> str:
|
|
34
|
+
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
|
35
|
+
return super().json(**kwargs_with_defaults)
|
|
36
|
+
|
|
37
|
+
def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
|
|
38
|
+
kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
|
39
|
+
kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
|
|
40
|
+
|
|
41
|
+
return deep_union_pydantic_dicts(
|
|
42
|
+
super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
class Config:
|
|
46
|
+
frozen = True
|
|
47
|
+
smart_union = True
|
|
48
|
+
extra = pydantic_v1.Extra.allow
|
|
49
|
+
json_encoders = {dt.datetime: serialize_datetime}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
ActionsCreateRequestFiltersItemsItemFilter = typing.Union[
|
|
6
|
+
typing.Literal[
|
|
7
|
+
"filter:tasks:agreement",
|
|
8
|
+
"filter:tasks:annotations_results",
|
|
9
|
+
"filter:tasks:annotators",
|
|
10
|
+
"filter:tasks:cancelled_annotations",
|
|
11
|
+
"filter:tasks:comments",
|
|
12
|
+
"filter:tasks:completed_at",
|
|
13
|
+
"filter:tasks:created_at",
|
|
14
|
+
"filter:tasks:file_upload",
|
|
15
|
+
"filter:tasks:ground_truth",
|
|
16
|
+
"filter:tasks:id",
|
|
17
|
+
"filter:tasks:inner_id",
|
|
18
|
+
"filter:tasks:predictions_model_versions",
|
|
19
|
+
"filter:tasks:predictions_results",
|
|
20
|
+
"filter:tasks:predictions_score",
|
|
21
|
+
"filter:tasks:reviewed",
|
|
22
|
+
"filter:tasks:reviewers",
|
|
23
|
+
"filter:tasks:reviews_accepted",
|
|
24
|
+
"filter:tasks:reviews_rejected",
|
|
25
|
+
"filter:tasks:total_annotations",
|
|
26
|
+
"filter:tasks:total_predictions",
|
|
27
|
+
"filter:tasks:unresolved_comment_count",
|
|
28
|
+
"filter:tasks:updated_at",
|
|
29
|
+
],
|
|
30
|
+
typing.Any,
|
|
31
|
+
]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
ActionsCreateRequestFiltersItemsItemOperator = typing.Union[
|
|
6
|
+
typing.Literal[
|
|
7
|
+
"contains",
|
|
8
|
+
"ends_with",
|
|
9
|
+
"equal",
|
|
10
|
+
"exists",
|
|
11
|
+
"greater",
|
|
12
|
+
"greater_or_equal",
|
|
13
|
+
"in",
|
|
14
|
+
"less",
|
|
15
|
+
"less_or_equal",
|
|
16
|
+
"not_contains",
|
|
17
|
+
"not_equal",
|
|
18
|
+
"not_exists",
|
|
19
|
+
"not_in",
|
|
20
|
+
"starts_with",
|
|
21
|
+
],
|
|
22
|
+
typing.Any,
|
|
23
|
+
]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
ActionsCreateRequestId = typing.Union[
|
|
6
|
+
typing.Literal[
|
|
7
|
+
"retrieve_tasks_predictions",
|
|
8
|
+
"predictions_to_annotations",
|
|
9
|
+
"remove_duplicates",
|
|
10
|
+
"delete_tasks",
|
|
11
|
+
"delete_ground_truths",
|
|
12
|
+
"delete_tasks_annotations",
|
|
13
|
+
"delete_tasks_reviews",
|
|
14
|
+
"delete_tasks_predictions",
|
|
15
|
+
"delete_reviewers",
|
|
16
|
+
"delete_annotators",
|
|
17
|
+
],
|
|
18
|
+
typing.Any,
|
|
19
|
+
]
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
ActionsCreateRequestOrderingItem = typing.Union[
|
|
6
|
+
typing.Literal[
|
|
7
|
+
"tasks:agreement",
|
|
8
|
+
"tasks:annotations_results",
|
|
9
|
+
"tasks:annotators",
|
|
10
|
+
"tasks:cancelled_annotations",
|
|
11
|
+
"tasks:comments",
|
|
12
|
+
"tasks:completed_at",
|
|
13
|
+
"tasks:created_at",
|
|
14
|
+
"tasks:file_upload",
|
|
15
|
+
"tasks:ground_truth",
|
|
16
|
+
"tasks:id",
|
|
17
|
+
"tasks:inner_id",
|
|
18
|
+
"tasks:predictions_model_versions",
|
|
19
|
+
"tasks:predictions_results",
|
|
20
|
+
"tasks:predictions_score",
|
|
21
|
+
"tasks:reviewed",
|
|
22
|
+
"tasks:reviewers",
|
|
23
|
+
"tasks:reviews_accepted",
|
|
24
|
+
"tasks:reviews_rejected",
|
|
25
|
+
"tasks:total_annotations",
|
|
26
|
+
"tasks:total_predictions",
|
|
27
|
+
"tasks:unresolved_comment_count",
|
|
28
|
+
"tasks:updated_at",
|
|
29
|
+
],
|
|
30
|
+
typing.Any,
|
|
31
|
+
]
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
from .actions_create_request_selected_items_excluded import ActionsCreateRequestSelectedItemsExcluded
|
|
6
|
+
from .actions_create_request_selected_items_included import ActionsCreateRequestSelectedItemsIncluded
|
|
7
|
+
|
|
8
|
+
ActionsCreateRequestSelectedItems = typing.Union[
|
|
9
|
+
ActionsCreateRequestSelectedItemsIncluded, ActionsCreateRequestSelectedItemsExcluded
|
|
10
|
+
]
|