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
|
@@ -0,0 +1,64 @@
|
|
|
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 .prompt_version import PromptVersion
|
|
9
|
+
from .refined_prompt_response_refinement_status import RefinedPromptResponseRefinementStatus
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class RefinedPromptResponse(pydantic_v1.BaseModel):
|
|
13
|
+
title: typing.Optional[str] = pydantic_v1.Field(default=None)
|
|
14
|
+
"""
|
|
15
|
+
Title of the refined prompt
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
reasoning: typing.Optional[str] = pydantic_v1.Field(default=None)
|
|
19
|
+
"""
|
|
20
|
+
Reasoning behind the refinement
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
prompt: str = pydantic_v1.Field()
|
|
24
|
+
"""
|
|
25
|
+
The refined prompt text
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
refinement_job_id: typing.Optional[str] = pydantic_v1.Field(default=None)
|
|
29
|
+
"""
|
|
30
|
+
Unique identifier for the refinement job
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
refinement_status: typing.Optional[RefinedPromptResponseRefinementStatus] = pydantic_v1.Field(default=None)
|
|
34
|
+
"""
|
|
35
|
+
Status of the refinement job
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
total_cost: typing.Optional[float] = pydantic_v1.Field(default=None)
|
|
39
|
+
"""
|
|
40
|
+
Total cost of the refinement job (in USD)
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
previous_version: typing.Optional[PromptVersion] = pydantic_v1.Field(default=None)
|
|
44
|
+
"""
|
|
45
|
+
Previous version of the prompt
|
|
46
|
+
"""
|
|
47
|
+
|
|
48
|
+
def json(self, **kwargs: typing.Any) -> str:
|
|
49
|
+
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
|
50
|
+
return super().json(**kwargs_with_defaults)
|
|
51
|
+
|
|
52
|
+
def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
|
|
53
|
+
kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
|
54
|
+
kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
|
|
55
|
+
|
|
56
|
+
return deep_union_pydantic_dicts(
|
|
57
|
+
super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
class Config:
|
|
61
|
+
frozen = True
|
|
62
|
+
smart_union = True
|
|
63
|
+
extra = pydantic_v1.Extra.allow
|
|
64
|
+
json_encoders = {dt.datetime: serialize_datetime}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
+
import datetime as dt
|
|
3
4
|
import typing
|
|
4
5
|
from json.decoder import JSONDecodeError
|
|
5
6
|
|
|
@@ -9,7 +10,9 @@ from ..core.jsonable_encoder import jsonable_encoder
|
|
|
9
10
|
from ..core.pydantic_utilities import pydantic_v1
|
|
10
11
|
from ..core.request_options import RequestOptions
|
|
11
12
|
from ..types.webhook import Webhook
|
|
13
|
+
from ..types.webhook_actions_item import WebhookActionsItem
|
|
12
14
|
from ..types.webhook_serializer_for_update import WebhookSerializerForUpdate
|
|
15
|
+
from ..types.webhook_serializer_for_update_actions_item import WebhookSerializerForUpdateActionsItem
|
|
13
16
|
from .types.webhooks_update_request_actions_item import WebhooksUpdateRequestActionsItem
|
|
14
17
|
|
|
15
18
|
# this is used as the default value for optional parameters
|
|
@@ -63,7 +66,22 @@ class WebhooksClient:
|
|
|
63
66
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
64
67
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
65
68
|
|
|
66
|
-
def create(
|
|
69
|
+
def create(
|
|
70
|
+
self,
|
|
71
|
+
*,
|
|
72
|
+
url: str,
|
|
73
|
+
id: typing.Optional[int] = OMIT,
|
|
74
|
+
organization: typing.Optional[int] = OMIT,
|
|
75
|
+
project: typing.Optional[int] = OMIT,
|
|
76
|
+
send_payload: typing.Optional[bool] = OMIT,
|
|
77
|
+
send_for_all_actions: typing.Optional[bool] = OMIT,
|
|
78
|
+
headers: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
|
79
|
+
is_active: typing.Optional[bool] = OMIT,
|
|
80
|
+
actions: typing.Optional[typing.Sequence[WebhookActionsItem]] = OMIT,
|
|
81
|
+
created_at: typing.Optional[dt.datetime] = OMIT,
|
|
82
|
+
updated_at: typing.Optional[dt.datetime] = OMIT,
|
|
83
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
84
|
+
) -> Webhook:
|
|
67
85
|
"""
|
|
68
86
|
Create a webhook.
|
|
69
87
|
Label Studio provides several out-of-the box webhook events, which you can find listed here: [Available Label Studio webhooks](https://labelstud.io/guide/webhooks#Available-Label-Studio-webhooks).
|
|
@@ -74,7 +92,34 @@ class WebhooksClient:
|
|
|
74
92
|
|
|
75
93
|
Parameters
|
|
76
94
|
----------
|
|
77
|
-
|
|
95
|
+
url : str
|
|
96
|
+
URL of webhook
|
|
97
|
+
|
|
98
|
+
id : typing.Optional[int]
|
|
99
|
+
|
|
100
|
+
organization : typing.Optional[int]
|
|
101
|
+
|
|
102
|
+
project : typing.Optional[int]
|
|
103
|
+
|
|
104
|
+
send_payload : typing.Optional[bool]
|
|
105
|
+
If value is False send only action
|
|
106
|
+
|
|
107
|
+
send_for_all_actions : typing.Optional[bool]
|
|
108
|
+
If value is False - used only for actions from WebhookAction
|
|
109
|
+
|
|
110
|
+
headers : typing.Optional[typing.Dict[str, typing.Any]]
|
|
111
|
+
Key Value Json of headers
|
|
112
|
+
|
|
113
|
+
is_active : typing.Optional[bool]
|
|
114
|
+
If value is False the webhook is disabled
|
|
115
|
+
|
|
116
|
+
actions : typing.Optional[typing.Sequence[WebhookActionsItem]]
|
|
117
|
+
|
|
118
|
+
created_at : typing.Optional[dt.datetime]
|
|
119
|
+
Creation time
|
|
120
|
+
|
|
121
|
+
updated_at : typing.Optional[dt.datetime]
|
|
122
|
+
Last update time
|
|
78
123
|
|
|
79
124
|
request_options : typing.Optional[RequestOptions]
|
|
80
125
|
Request-specific configuration.
|
|
@@ -86,20 +131,33 @@ class WebhooksClient:
|
|
|
86
131
|
|
|
87
132
|
Examples
|
|
88
133
|
--------
|
|
89
|
-
from label_studio_sdk import Webhook
|
|
90
134
|
from label_studio_sdk.client import LabelStudio
|
|
91
135
|
|
|
92
136
|
client = LabelStudio(
|
|
93
137
|
api_key="YOUR_API_KEY",
|
|
94
138
|
)
|
|
95
139
|
client.webhooks.create(
|
|
96
|
-
|
|
97
|
-
url="url",
|
|
98
|
-
),
|
|
140
|
+
url="url",
|
|
99
141
|
)
|
|
100
142
|
"""
|
|
101
143
|
_response = self._client_wrapper.httpx_client.request(
|
|
102
|
-
"api/webhooks/",
|
|
144
|
+
"api/webhooks/",
|
|
145
|
+
method="POST",
|
|
146
|
+
json={
|
|
147
|
+
"id": id,
|
|
148
|
+
"organization": organization,
|
|
149
|
+
"project": project,
|
|
150
|
+
"url": url,
|
|
151
|
+
"send_payload": send_payload,
|
|
152
|
+
"send_for_all_actions": send_for_all_actions,
|
|
153
|
+
"headers": headers,
|
|
154
|
+
"is_active": is_active,
|
|
155
|
+
"actions": actions,
|
|
156
|
+
"created_at": created_at,
|
|
157
|
+
"updated_at": updated_at,
|
|
158
|
+
},
|
|
159
|
+
request_options=request_options,
|
|
160
|
+
omit=OMIT,
|
|
103
161
|
)
|
|
104
162
|
try:
|
|
105
163
|
if 200 <= _response.status_code < 300:
|
|
@@ -236,10 +294,10 @@ class WebhooksClient:
|
|
|
236
294
|
|
|
237
295
|
def update(
|
|
238
296
|
self,
|
|
239
|
-
|
|
297
|
+
id_: int,
|
|
240
298
|
*,
|
|
241
299
|
url: str,
|
|
242
|
-
|
|
300
|
+
webhook_serializer_for_update_url: str,
|
|
243
301
|
send_payload: typing.Optional[bool] = None,
|
|
244
302
|
send_for_all_actions: typing.Optional[bool] = None,
|
|
245
303
|
headers: typing.Optional[str] = None,
|
|
@@ -247,6 +305,18 @@ class WebhooksClient:
|
|
|
247
305
|
actions: typing.Optional[
|
|
248
306
|
typing.Union[WebhooksUpdateRequestActionsItem, typing.Sequence[WebhooksUpdateRequestActionsItem]]
|
|
249
307
|
] = None,
|
|
308
|
+
id: typing.Optional[int] = OMIT,
|
|
309
|
+
organization: typing.Optional[int] = OMIT,
|
|
310
|
+
project: typing.Optional[int] = OMIT,
|
|
311
|
+
webhook_serializer_for_update_send_payload: typing.Optional[bool] = OMIT,
|
|
312
|
+
webhook_serializer_for_update_send_for_all_actions: typing.Optional[bool] = OMIT,
|
|
313
|
+
webhook_serializer_for_update_headers: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
|
314
|
+
webhook_serializer_for_update_is_active: typing.Optional[bool] = OMIT,
|
|
315
|
+
webhook_serializer_for_update_actions: typing.Optional[
|
|
316
|
+
typing.Sequence[WebhookSerializerForUpdateActionsItem]
|
|
317
|
+
] = OMIT,
|
|
318
|
+
created_at: typing.Optional[dt.datetime] = OMIT,
|
|
319
|
+
updated_at: typing.Optional[dt.datetime] = OMIT,
|
|
250
320
|
request_options: typing.Optional[RequestOptions] = None,
|
|
251
321
|
) -> WebhookSerializerForUpdate:
|
|
252
322
|
"""
|
|
@@ -256,13 +326,14 @@ class WebhooksClient:
|
|
|
256
326
|
|
|
257
327
|
Parameters
|
|
258
328
|
----------
|
|
259
|
-
|
|
329
|
+
id_ : int
|
|
260
330
|
A unique integer value identifying this webhook.
|
|
261
331
|
|
|
262
332
|
url : str
|
|
263
333
|
URL of webhook
|
|
264
334
|
|
|
265
|
-
|
|
335
|
+
webhook_serializer_for_update_url : str
|
|
336
|
+
URL of webhook
|
|
266
337
|
|
|
267
338
|
send_payload : typing.Optional[bool]
|
|
268
339
|
If value is False send only action
|
|
@@ -278,6 +349,32 @@ class WebhooksClient:
|
|
|
278
349
|
|
|
279
350
|
actions : typing.Optional[typing.Union[WebhooksUpdateRequestActionsItem, typing.Sequence[WebhooksUpdateRequestActionsItem]]]
|
|
280
351
|
|
|
352
|
+
id : typing.Optional[int]
|
|
353
|
+
|
|
354
|
+
organization : typing.Optional[int]
|
|
355
|
+
|
|
356
|
+
project : typing.Optional[int]
|
|
357
|
+
|
|
358
|
+
webhook_serializer_for_update_send_payload : typing.Optional[bool]
|
|
359
|
+
If value is False send only action
|
|
360
|
+
|
|
361
|
+
webhook_serializer_for_update_send_for_all_actions : typing.Optional[bool]
|
|
362
|
+
If value is False - used only for actions from WebhookAction
|
|
363
|
+
|
|
364
|
+
webhook_serializer_for_update_headers : typing.Optional[typing.Dict[str, typing.Any]]
|
|
365
|
+
Key Value Json of headers
|
|
366
|
+
|
|
367
|
+
webhook_serializer_for_update_is_active : typing.Optional[bool]
|
|
368
|
+
If value is False the webhook is disabled
|
|
369
|
+
|
|
370
|
+
webhook_serializer_for_update_actions : typing.Optional[typing.Sequence[WebhookSerializerForUpdateActionsItem]]
|
|
371
|
+
|
|
372
|
+
created_at : typing.Optional[dt.datetime]
|
|
373
|
+
Creation time
|
|
374
|
+
|
|
375
|
+
updated_at : typing.Optional[dt.datetime]
|
|
376
|
+
Last update time
|
|
377
|
+
|
|
281
378
|
request_options : typing.Optional[RequestOptions]
|
|
282
379
|
Request-specific configuration.
|
|
283
380
|
|
|
@@ -288,22 +385,19 @@ class WebhooksClient:
|
|
|
288
385
|
|
|
289
386
|
Examples
|
|
290
387
|
--------
|
|
291
|
-
from label_studio_sdk import WebhookSerializerForUpdate
|
|
292
388
|
from label_studio_sdk.client import LabelStudio
|
|
293
389
|
|
|
294
390
|
client = LabelStudio(
|
|
295
391
|
api_key="YOUR_API_KEY",
|
|
296
392
|
)
|
|
297
393
|
client.webhooks.update(
|
|
298
|
-
|
|
394
|
+
id_=1,
|
|
299
395
|
url="url",
|
|
300
|
-
|
|
301
|
-
url="url",
|
|
302
|
-
),
|
|
396
|
+
webhook_serializer_for_update_url="url",
|
|
303
397
|
)
|
|
304
398
|
"""
|
|
305
399
|
_response = self._client_wrapper.httpx_client.request(
|
|
306
|
-
f"api/webhooks/{jsonable_encoder(
|
|
400
|
+
f"api/webhooks/{jsonable_encoder(id_)}/",
|
|
307
401
|
method="PATCH",
|
|
308
402
|
params={
|
|
309
403
|
"url": url,
|
|
@@ -313,7 +407,19 @@ class WebhooksClient:
|
|
|
313
407
|
"is_active": is_active,
|
|
314
408
|
"actions": actions,
|
|
315
409
|
},
|
|
316
|
-
json=
|
|
410
|
+
json={
|
|
411
|
+
"id": id,
|
|
412
|
+
"organization": organization,
|
|
413
|
+
"project": project,
|
|
414
|
+
"url": url,
|
|
415
|
+
"send_payload": send_payload,
|
|
416
|
+
"send_for_all_actions": send_for_all_actions,
|
|
417
|
+
"headers": headers,
|
|
418
|
+
"is_active": is_active,
|
|
419
|
+
"actions": actions,
|
|
420
|
+
"created_at": created_at,
|
|
421
|
+
"updated_at": updated_at,
|
|
422
|
+
},
|
|
317
423
|
request_options=request_options,
|
|
318
424
|
omit=OMIT,
|
|
319
425
|
)
|
|
@@ -373,7 +479,22 @@ class AsyncWebhooksClient:
|
|
|
373
479
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
374
480
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
375
481
|
|
|
376
|
-
async def create(
|
|
482
|
+
async def create(
|
|
483
|
+
self,
|
|
484
|
+
*,
|
|
485
|
+
url: str,
|
|
486
|
+
id: typing.Optional[int] = OMIT,
|
|
487
|
+
organization: typing.Optional[int] = OMIT,
|
|
488
|
+
project: typing.Optional[int] = OMIT,
|
|
489
|
+
send_payload: typing.Optional[bool] = OMIT,
|
|
490
|
+
send_for_all_actions: typing.Optional[bool] = OMIT,
|
|
491
|
+
headers: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
|
492
|
+
is_active: typing.Optional[bool] = OMIT,
|
|
493
|
+
actions: typing.Optional[typing.Sequence[WebhookActionsItem]] = OMIT,
|
|
494
|
+
created_at: typing.Optional[dt.datetime] = OMIT,
|
|
495
|
+
updated_at: typing.Optional[dt.datetime] = OMIT,
|
|
496
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
497
|
+
) -> Webhook:
|
|
377
498
|
"""
|
|
378
499
|
Create a webhook.
|
|
379
500
|
Label Studio provides several out-of-the box webhook events, which you can find listed here: [Available Label Studio webhooks](https://labelstud.io/guide/webhooks#Available-Label-Studio-webhooks).
|
|
@@ -384,7 +505,34 @@ class AsyncWebhooksClient:
|
|
|
384
505
|
|
|
385
506
|
Parameters
|
|
386
507
|
----------
|
|
387
|
-
|
|
508
|
+
url : str
|
|
509
|
+
URL of webhook
|
|
510
|
+
|
|
511
|
+
id : typing.Optional[int]
|
|
512
|
+
|
|
513
|
+
organization : typing.Optional[int]
|
|
514
|
+
|
|
515
|
+
project : typing.Optional[int]
|
|
516
|
+
|
|
517
|
+
send_payload : typing.Optional[bool]
|
|
518
|
+
If value is False send only action
|
|
519
|
+
|
|
520
|
+
send_for_all_actions : typing.Optional[bool]
|
|
521
|
+
If value is False - used only for actions from WebhookAction
|
|
522
|
+
|
|
523
|
+
headers : typing.Optional[typing.Dict[str, typing.Any]]
|
|
524
|
+
Key Value Json of headers
|
|
525
|
+
|
|
526
|
+
is_active : typing.Optional[bool]
|
|
527
|
+
If value is False the webhook is disabled
|
|
528
|
+
|
|
529
|
+
actions : typing.Optional[typing.Sequence[WebhookActionsItem]]
|
|
530
|
+
|
|
531
|
+
created_at : typing.Optional[dt.datetime]
|
|
532
|
+
Creation time
|
|
533
|
+
|
|
534
|
+
updated_at : typing.Optional[dt.datetime]
|
|
535
|
+
Last update time
|
|
388
536
|
|
|
389
537
|
request_options : typing.Optional[RequestOptions]
|
|
390
538
|
Request-specific configuration.
|
|
@@ -396,20 +544,33 @@ class AsyncWebhooksClient:
|
|
|
396
544
|
|
|
397
545
|
Examples
|
|
398
546
|
--------
|
|
399
|
-
from label_studio_sdk import Webhook
|
|
400
547
|
from label_studio_sdk.client import AsyncLabelStudio
|
|
401
548
|
|
|
402
549
|
client = AsyncLabelStudio(
|
|
403
550
|
api_key="YOUR_API_KEY",
|
|
404
551
|
)
|
|
405
552
|
await client.webhooks.create(
|
|
406
|
-
|
|
407
|
-
url="url",
|
|
408
|
-
),
|
|
553
|
+
url="url",
|
|
409
554
|
)
|
|
410
555
|
"""
|
|
411
556
|
_response = await self._client_wrapper.httpx_client.request(
|
|
412
|
-
"api/webhooks/",
|
|
557
|
+
"api/webhooks/",
|
|
558
|
+
method="POST",
|
|
559
|
+
json={
|
|
560
|
+
"id": id,
|
|
561
|
+
"organization": organization,
|
|
562
|
+
"project": project,
|
|
563
|
+
"url": url,
|
|
564
|
+
"send_payload": send_payload,
|
|
565
|
+
"send_for_all_actions": send_for_all_actions,
|
|
566
|
+
"headers": headers,
|
|
567
|
+
"is_active": is_active,
|
|
568
|
+
"actions": actions,
|
|
569
|
+
"created_at": created_at,
|
|
570
|
+
"updated_at": updated_at,
|
|
571
|
+
},
|
|
572
|
+
request_options=request_options,
|
|
573
|
+
omit=OMIT,
|
|
413
574
|
)
|
|
414
575
|
try:
|
|
415
576
|
if 200 <= _response.status_code < 300:
|
|
@@ -546,10 +707,10 @@ class AsyncWebhooksClient:
|
|
|
546
707
|
|
|
547
708
|
async def update(
|
|
548
709
|
self,
|
|
549
|
-
|
|
710
|
+
id_: int,
|
|
550
711
|
*,
|
|
551
712
|
url: str,
|
|
552
|
-
|
|
713
|
+
webhook_serializer_for_update_url: str,
|
|
553
714
|
send_payload: typing.Optional[bool] = None,
|
|
554
715
|
send_for_all_actions: typing.Optional[bool] = None,
|
|
555
716
|
headers: typing.Optional[str] = None,
|
|
@@ -557,6 +718,18 @@ class AsyncWebhooksClient:
|
|
|
557
718
|
actions: typing.Optional[
|
|
558
719
|
typing.Union[WebhooksUpdateRequestActionsItem, typing.Sequence[WebhooksUpdateRequestActionsItem]]
|
|
559
720
|
] = None,
|
|
721
|
+
id: typing.Optional[int] = OMIT,
|
|
722
|
+
organization: typing.Optional[int] = OMIT,
|
|
723
|
+
project: typing.Optional[int] = OMIT,
|
|
724
|
+
webhook_serializer_for_update_send_payload: typing.Optional[bool] = OMIT,
|
|
725
|
+
webhook_serializer_for_update_send_for_all_actions: typing.Optional[bool] = OMIT,
|
|
726
|
+
webhook_serializer_for_update_headers: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
|
727
|
+
webhook_serializer_for_update_is_active: typing.Optional[bool] = OMIT,
|
|
728
|
+
webhook_serializer_for_update_actions: typing.Optional[
|
|
729
|
+
typing.Sequence[WebhookSerializerForUpdateActionsItem]
|
|
730
|
+
] = OMIT,
|
|
731
|
+
created_at: typing.Optional[dt.datetime] = OMIT,
|
|
732
|
+
updated_at: typing.Optional[dt.datetime] = OMIT,
|
|
560
733
|
request_options: typing.Optional[RequestOptions] = None,
|
|
561
734
|
) -> WebhookSerializerForUpdate:
|
|
562
735
|
"""
|
|
@@ -566,13 +739,14 @@ class AsyncWebhooksClient:
|
|
|
566
739
|
|
|
567
740
|
Parameters
|
|
568
741
|
----------
|
|
569
|
-
|
|
742
|
+
id_ : int
|
|
570
743
|
A unique integer value identifying this webhook.
|
|
571
744
|
|
|
572
745
|
url : str
|
|
573
746
|
URL of webhook
|
|
574
747
|
|
|
575
|
-
|
|
748
|
+
webhook_serializer_for_update_url : str
|
|
749
|
+
URL of webhook
|
|
576
750
|
|
|
577
751
|
send_payload : typing.Optional[bool]
|
|
578
752
|
If value is False send only action
|
|
@@ -588,6 +762,32 @@ class AsyncWebhooksClient:
|
|
|
588
762
|
|
|
589
763
|
actions : typing.Optional[typing.Union[WebhooksUpdateRequestActionsItem, typing.Sequence[WebhooksUpdateRequestActionsItem]]]
|
|
590
764
|
|
|
765
|
+
id : typing.Optional[int]
|
|
766
|
+
|
|
767
|
+
organization : typing.Optional[int]
|
|
768
|
+
|
|
769
|
+
project : typing.Optional[int]
|
|
770
|
+
|
|
771
|
+
webhook_serializer_for_update_send_payload : typing.Optional[bool]
|
|
772
|
+
If value is False send only action
|
|
773
|
+
|
|
774
|
+
webhook_serializer_for_update_send_for_all_actions : typing.Optional[bool]
|
|
775
|
+
If value is False - used only for actions from WebhookAction
|
|
776
|
+
|
|
777
|
+
webhook_serializer_for_update_headers : typing.Optional[typing.Dict[str, typing.Any]]
|
|
778
|
+
Key Value Json of headers
|
|
779
|
+
|
|
780
|
+
webhook_serializer_for_update_is_active : typing.Optional[bool]
|
|
781
|
+
If value is False the webhook is disabled
|
|
782
|
+
|
|
783
|
+
webhook_serializer_for_update_actions : typing.Optional[typing.Sequence[WebhookSerializerForUpdateActionsItem]]
|
|
784
|
+
|
|
785
|
+
created_at : typing.Optional[dt.datetime]
|
|
786
|
+
Creation time
|
|
787
|
+
|
|
788
|
+
updated_at : typing.Optional[dt.datetime]
|
|
789
|
+
Last update time
|
|
790
|
+
|
|
591
791
|
request_options : typing.Optional[RequestOptions]
|
|
592
792
|
Request-specific configuration.
|
|
593
793
|
|
|
@@ -598,22 +798,19 @@ class AsyncWebhooksClient:
|
|
|
598
798
|
|
|
599
799
|
Examples
|
|
600
800
|
--------
|
|
601
|
-
from label_studio_sdk import WebhookSerializerForUpdate
|
|
602
801
|
from label_studio_sdk.client import AsyncLabelStudio
|
|
603
802
|
|
|
604
803
|
client = AsyncLabelStudio(
|
|
605
804
|
api_key="YOUR_API_KEY",
|
|
606
805
|
)
|
|
607
806
|
await client.webhooks.update(
|
|
608
|
-
|
|
807
|
+
id_=1,
|
|
609
808
|
url="url",
|
|
610
|
-
|
|
611
|
-
url="url",
|
|
612
|
-
),
|
|
809
|
+
webhook_serializer_for_update_url="url",
|
|
613
810
|
)
|
|
614
811
|
"""
|
|
615
812
|
_response = await self._client_wrapper.httpx_client.request(
|
|
616
|
-
f"api/webhooks/{jsonable_encoder(
|
|
813
|
+
f"api/webhooks/{jsonable_encoder(id_)}/",
|
|
617
814
|
method="PATCH",
|
|
618
815
|
params={
|
|
619
816
|
"url": url,
|
|
@@ -623,7 +820,19 @@ class AsyncWebhooksClient:
|
|
|
623
820
|
"is_active": is_active,
|
|
624
821
|
"actions": actions,
|
|
625
822
|
},
|
|
626
|
-
json=
|
|
823
|
+
json={
|
|
824
|
+
"id": id,
|
|
825
|
+
"organization": organization,
|
|
826
|
+
"project": project,
|
|
827
|
+
"url": url,
|
|
828
|
+
"send_payload": send_payload,
|
|
829
|
+
"send_for_all_actions": send_for_all_actions,
|
|
830
|
+
"headers": headers,
|
|
831
|
+
"is_active": is_active,
|
|
832
|
+
"actions": actions,
|
|
833
|
+
"created_at": created_at,
|
|
834
|
+
"updated_at": updated_at,
|
|
835
|
+
},
|
|
627
836
|
request_options=request_options,
|
|
628
837
|
omit=OMIT,
|
|
629
838
|
)
|
|
@@ -65,8 +65,8 @@ class WorkspacesClient:
|
|
|
65
65
|
description: typing.Optional[str] = OMIT,
|
|
66
66
|
is_public: typing.Optional[bool] = OMIT,
|
|
67
67
|
is_personal: typing.Optional[bool] = OMIT,
|
|
68
|
-
is_archived: typing.Optional[bool] = OMIT,
|
|
69
68
|
color: typing.Optional[str] = OMIT,
|
|
69
|
+
is_archived: typing.Optional[bool] = OMIT,
|
|
70
70
|
request_options: typing.Optional[RequestOptions] = None,
|
|
71
71
|
) -> Workspace:
|
|
72
72
|
"""
|
|
@@ -90,12 +90,12 @@ class WorkspacesClient:
|
|
|
90
90
|
is_personal : typing.Optional[bool]
|
|
91
91
|
Is workspace personal
|
|
92
92
|
|
|
93
|
-
is_archived : typing.Optional[bool]
|
|
94
|
-
Is workspace archived
|
|
95
|
-
|
|
96
93
|
color : typing.Optional[str]
|
|
97
94
|
Workspace color in HEX format
|
|
98
95
|
|
|
96
|
+
is_archived : typing.Optional[bool]
|
|
97
|
+
Is workspace archived
|
|
98
|
+
|
|
99
99
|
request_options : typing.Optional[RequestOptions]
|
|
100
100
|
Request-specific configuration.
|
|
101
101
|
|
|
@@ -121,8 +121,8 @@ class WorkspacesClient:
|
|
|
121
121
|
"description": description,
|
|
122
122
|
"is_public": is_public,
|
|
123
123
|
"is_personal": is_personal,
|
|
124
|
-
"is_archived": is_archived,
|
|
125
124
|
"color": color,
|
|
125
|
+
"is_archived": is_archived,
|
|
126
126
|
},
|
|
127
127
|
request_options=request_options,
|
|
128
128
|
omit=OMIT,
|
|
@@ -220,8 +220,8 @@ class WorkspacesClient:
|
|
|
220
220
|
description: typing.Optional[str] = OMIT,
|
|
221
221
|
is_public: typing.Optional[bool] = OMIT,
|
|
222
222
|
is_personal: typing.Optional[bool] = OMIT,
|
|
223
|
-
is_archived: typing.Optional[bool] = OMIT,
|
|
224
223
|
color: typing.Optional[str] = OMIT,
|
|
224
|
+
is_archived: typing.Optional[bool] = OMIT,
|
|
225
225
|
request_options: typing.Optional[RequestOptions] = None,
|
|
226
226
|
) -> Workspace:
|
|
227
227
|
"""
|
|
@@ -244,12 +244,12 @@ class WorkspacesClient:
|
|
|
244
244
|
is_personal : typing.Optional[bool]
|
|
245
245
|
Is workspace personal
|
|
246
246
|
|
|
247
|
-
is_archived : typing.Optional[bool]
|
|
248
|
-
Is workspace archived
|
|
249
|
-
|
|
250
247
|
color : typing.Optional[str]
|
|
251
248
|
Workspace color in HEX format
|
|
252
249
|
|
|
250
|
+
is_archived : typing.Optional[bool]
|
|
251
|
+
Is workspace archived
|
|
252
|
+
|
|
253
253
|
request_options : typing.Optional[RequestOptions]
|
|
254
254
|
Request-specific configuration.
|
|
255
255
|
|
|
@@ -277,8 +277,8 @@ class WorkspacesClient:
|
|
|
277
277
|
"description": description,
|
|
278
278
|
"is_public": is_public,
|
|
279
279
|
"is_personal": is_personal,
|
|
280
|
-
"is_archived": is_archived,
|
|
281
280
|
"color": color,
|
|
281
|
+
"is_archived": is_archived,
|
|
282
282
|
},
|
|
283
283
|
request_options=request_options,
|
|
284
284
|
omit=OMIT,
|
|
@@ -342,8 +342,8 @@ class AsyncWorkspacesClient:
|
|
|
342
342
|
description: typing.Optional[str] = OMIT,
|
|
343
343
|
is_public: typing.Optional[bool] = OMIT,
|
|
344
344
|
is_personal: typing.Optional[bool] = OMIT,
|
|
345
|
-
is_archived: typing.Optional[bool] = OMIT,
|
|
346
345
|
color: typing.Optional[str] = OMIT,
|
|
346
|
+
is_archived: typing.Optional[bool] = OMIT,
|
|
347
347
|
request_options: typing.Optional[RequestOptions] = None,
|
|
348
348
|
) -> Workspace:
|
|
349
349
|
"""
|
|
@@ -367,12 +367,12 @@ class AsyncWorkspacesClient:
|
|
|
367
367
|
is_personal : typing.Optional[bool]
|
|
368
368
|
Is workspace personal
|
|
369
369
|
|
|
370
|
-
is_archived : typing.Optional[bool]
|
|
371
|
-
Is workspace archived
|
|
372
|
-
|
|
373
370
|
color : typing.Optional[str]
|
|
374
371
|
Workspace color in HEX format
|
|
375
372
|
|
|
373
|
+
is_archived : typing.Optional[bool]
|
|
374
|
+
Is workspace archived
|
|
375
|
+
|
|
376
376
|
request_options : typing.Optional[RequestOptions]
|
|
377
377
|
Request-specific configuration.
|
|
378
378
|
|
|
@@ -398,8 +398,8 @@ class AsyncWorkspacesClient:
|
|
|
398
398
|
"description": description,
|
|
399
399
|
"is_public": is_public,
|
|
400
400
|
"is_personal": is_personal,
|
|
401
|
-
"is_archived": is_archived,
|
|
402
401
|
"color": color,
|
|
402
|
+
"is_archived": is_archived,
|
|
403
403
|
},
|
|
404
404
|
request_options=request_options,
|
|
405
405
|
omit=OMIT,
|
|
@@ -497,8 +497,8 @@ class AsyncWorkspacesClient:
|
|
|
497
497
|
description: typing.Optional[str] = OMIT,
|
|
498
498
|
is_public: typing.Optional[bool] = OMIT,
|
|
499
499
|
is_personal: typing.Optional[bool] = OMIT,
|
|
500
|
-
is_archived: typing.Optional[bool] = OMIT,
|
|
501
500
|
color: typing.Optional[str] = OMIT,
|
|
501
|
+
is_archived: typing.Optional[bool] = OMIT,
|
|
502
502
|
request_options: typing.Optional[RequestOptions] = None,
|
|
503
503
|
) -> Workspace:
|
|
504
504
|
"""
|
|
@@ -521,12 +521,12 @@ class AsyncWorkspacesClient:
|
|
|
521
521
|
is_personal : typing.Optional[bool]
|
|
522
522
|
Is workspace personal
|
|
523
523
|
|
|
524
|
-
is_archived : typing.Optional[bool]
|
|
525
|
-
Is workspace archived
|
|
526
|
-
|
|
527
524
|
color : typing.Optional[str]
|
|
528
525
|
Workspace color in HEX format
|
|
529
526
|
|
|
527
|
+
is_archived : typing.Optional[bool]
|
|
528
|
+
Is workspace archived
|
|
529
|
+
|
|
530
530
|
request_options : typing.Optional[RequestOptions]
|
|
531
531
|
Request-specific configuration.
|
|
532
532
|
|
|
@@ -554,8 +554,8 @@ class AsyncWorkspacesClient:
|
|
|
554
554
|
"description": description,
|
|
555
555
|
"is_public": is_public,
|
|
556
556
|
"is_personal": is_personal,
|
|
557
|
-
"is_archived": is_archived,
|
|
558
557
|
"color": color,
|
|
558
|
+
"is_archived": is_archived,
|
|
559
559
|
},
|
|
560
560
|
request_options=request_options,
|
|
561
561
|
omit=OMIT,
|