label-studio-sdk 1.0.5__py3-none-any.whl → 1.0.8__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 +76 -0
- label_studio_sdk/_extensions/eval/categorical.py +83 -0
- label_studio_sdk/_extensions/label_studio_tools/core/label_config.py +13 -4
- label_studio_sdk/_extensions/label_studio_tools/core/utils/io.py +35 -17
- label_studio_sdk/_extensions/label_studio_tools/core/utils/json_schema.py +86 -0
- label_studio_sdk/_legacy/schema/label_config_schema.json +42 -11
- 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 +11 -4
- 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/control_tags.py +205 -10
- label_studio_sdk/label_interface/interface.py +117 -10
- label_studio_sdk/label_interface/region.py +1 -10
- label_studio_sdk/model_providers/__init__.py +2 -0
- label_studio_sdk/model_providers/client.py +708 -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 +1046 -0
- label_studio_sdk/types/__init__.py +58 -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_cost_estimate.py +57 -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 +71 -0
- label_studio_sdk/types/model_provider_connection_budget_reset_period.py +5 -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/types/task.py +3 -2
- label_studio_sdk/types/task_comment_authors_item.py +5 -0
- label_studio_sdk/webhooks/client.py +245 -36
- label_studio_sdk/workspaces/client.py +20 -20
- label_studio_sdk-1.0.8.dist-info/LICENSE +201 -0
- {label_studio_sdk-1.0.5.dist-info → label_studio_sdk-1.0.8.dist-info}/METADATA +19 -3
- {label_studio_sdk-1.0.5.dist-info → label_studio_sdk-1.0.8.dist-info}/RECORD +77 -24
- {label_studio_sdk-1.0.5.dist-info → label_studio_sdk-1.0.8.dist-info}/WHEEL +1 -1
|
@@ -9,6 +9,7 @@ from ..core.jsonable_encoder import jsonable_encoder
|
|
|
9
9
|
from ..core.pydantic_utilities import pydantic_v1
|
|
10
10
|
from ..core.request_options import RequestOptions
|
|
11
11
|
from ..types.annotation import Annotation
|
|
12
|
+
from .types.annotations_create_bulk_response_item import AnnotationsCreateBulkResponseItem
|
|
12
13
|
|
|
13
14
|
# this is used as the default value for optional parameters
|
|
14
15
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -380,6 +381,60 @@ class AnnotationsClient:
|
|
|
380
381
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
381
382
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
382
383
|
|
|
384
|
+
def create_bulk(
|
|
385
|
+
self,
|
|
386
|
+
*,
|
|
387
|
+
tasks: typing.Optional[typing.Sequence[int]] = OMIT,
|
|
388
|
+
lead_time: typing.Optional[float] = OMIT,
|
|
389
|
+
project: typing.Optional[int] = OMIT,
|
|
390
|
+
result: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
|
391
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
392
|
+
) -> typing.List[AnnotationsCreateBulkResponseItem]:
|
|
393
|
+
"""
|
|
394
|
+
Create multiple annotations for specific tasks in a bulk operation.
|
|
395
|
+
|
|
396
|
+
Parameters
|
|
397
|
+
----------
|
|
398
|
+
tasks : typing.Optional[typing.Sequence[int]]
|
|
399
|
+
|
|
400
|
+
lead_time : typing.Optional[float]
|
|
401
|
+
|
|
402
|
+
project : typing.Optional[int]
|
|
403
|
+
|
|
404
|
+
result : typing.Optional[typing.Dict[str, typing.Any]]
|
|
405
|
+
|
|
406
|
+
request_options : typing.Optional[RequestOptions]
|
|
407
|
+
Request-specific configuration.
|
|
408
|
+
|
|
409
|
+
Returns
|
|
410
|
+
-------
|
|
411
|
+
typing.List[AnnotationsCreateBulkResponseItem]
|
|
412
|
+
Annotations created successfully
|
|
413
|
+
|
|
414
|
+
Examples
|
|
415
|
+
--------
|
|
416
|
+
from label_studio_sdk.client import LabelStudio
|
|
417
|
+
|
|
418
|
+
client = LabelStudio(
|
|
419
|
+
api_key="YOUR_API_KEY",
|
|
420
|
+
)
|
|
421
|
+
client.annotations.create_bulk()
|
|
422
|
+
"""
|
|
423
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
424
|
+
"api/annotations/bulk",
|
|
425
|
+
method="POST",
|
|
426
|
+
json={"tasks": tasks, "lead_time": lead_time, "project": project, "result": result},
|
|
427
|
+
request_options=request_options,
|
|
428
|
+
omit=OMIT,
|
|
429
|
+
)
|
|
430
|
+
try:
|
|
431
|
+
if 200 <= _response.status_code < 300:
|
|
432
|
+
return pydantic_v1.parse_obj_as(typing.List[AnnotationsCreateBulkResponseItem], _response.json()) # type: ignore
|
|
433
|
+
_response_json = _response.json()
|
|
434
|
+
except JSONDecodeError:
|
|
435
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
436
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
437
|
+
|
|
383
438
|
|
|
384
439
|
class AsyncAnnotationsClient:
|
|
385
440
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
@@ -748,3 +803,57 @@ class AsyncAnnotationsClient:
|
|
|
748
803
|
except JSONDecodeError:
|
|
749
804
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
750
805
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
806
|
+
|
|
807
|
+
async def create_bulk(
|
|
808
|
+
self,
|
|
809
|
+
*,
|
|
810
|
+
tasks: typing.Optional[typing.Sequence[int]] = OMIT,
|
|
811
|
+
lead_time: typing.Optional[float] = OMIT,
|
|
812
|
+
project: typing.Optional[int] = OMIT,
|
|
813
|
+
result: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
|
814
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
815
|
+
) -> typing.List[AnnotationsCreateBulkResponseItem]:
|
|
816
|
+
"""
|
|
817
|
+
Create multiple annotations for specific tasks in a bulk operation.
|
|
818
|
+
|
|
819
|
+
Parameters
|
|
820
|
+
----------
|
|
821
|
+
tasks : typing.Optional[typing.Sequence[int]]
|
|
822
|
+
|
|
823
|
+
lead_time : typing.Optional[float]
|
|
824
|
+
|
|
825
|
+
project : typing.Optional[int]
|
|
826
|
+
|
|
827
|
+
result : typing.Optional[typing.Dict[str, typing.Any]]
|
|
828
|
+
|
|
829
|
+
request_options : typing.Optional[RequestOptions]
|
|
830
|
+
Request-specific configuration.
|
|
831
|
+
|
|
832
|
+
Returns
|
|
833
|
+
-------
|
|
834
|
+
typing.List[AnnotationsCreateBulkResponseItem]
|
|
835
|
+
Annotations created successfully
|
|
836
|
+
|
|
837
|
+
Examples
|
|
838
|
+
--------
|
|
839
|
+
from label_studio_sdk.client import AsyncLabelStudio
|
|
840
|
+
|
|
841
|
+
client = AsyncLabelStudio(
|
|
842
|
+
api_key="YOUR_API_KEY",
|
|
843
|
+
)
|
|
844
|
+
await client.annotations.create_bulk()
|
|
845
|
+
"""
|
|
846
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
847
|
+
"api/annotations/bulk",
|
|
848
|
+
method="POST",
|
|
849
|
+
json={"tasks": tasks, "lead_time": lead_time, "project": project, "result": result},
|
|
850
|
+
request_options=request_options,
|
|
851
|
+
omit=OMIT,
|
|
852
|
+
)
|
|
853
|
+
try:
|
|
854
|
+
if 200 <= _response.status_code < 300:
|
|
855
|
+
return pydantic_v1.parse_obj_as(typing.List[AnnotationsCreateBulkResponseItem], _response.json()) # type: ignore
|
|
856
|
+
_response_json = _response.json()
|
|
857
|
+
except JSONDecodeError:
|
|
858
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
859
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
|
|
9
|
+
|
|
10
|
+
class AnnotationsCreateBulkResponseItem(pydantic_v1.BaseModel):
|
|
11
|
+
id: typing.Optional[int] = None
|
|
12
|
+
|
|
13
|
+
def json(self, **kwargs: typing.Any) -> str:
|
|
14
|
+
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
|
15
|
+
return super().json(**kwargs_with_defaults)
|
|
16
|
+
|
|
17
|
+
def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
|
|
18
|
+
kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
|
19
|
+
kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
|
|
20
|
+
|
|
21
|
+
return deep_union_pydantic_dicts(
|
|
22
|
+
super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
class Config:
|
|
26
|
+
frozen = True
|
|
27
|
+
smart_union = True
|
|
28
|
+
extra = pydantic_v1.Extra.allow
|
|
29
|
+
json_encoders = {dt.datetime: serialize_datetime}
|
label_studio_sdk/base_client.py
CHANGED
|
@@ -7,6 +7,7 @@ import httpx
|
|
|
7
7
|
|
|
8
8
|
from .actions.client import ActionsClient, AsyncActionsClient
|
|
9
9
|
from .annotations.client import AnnotationsClient, AsyncAnnotationsClient
|
|
10
|
+
from .comments.client import AsyncCommentsClient, CommentsClient
|
|
10
11
|
from .core.api_error import ApiError
|
|
11
12
|
from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
12
13
|
from .environment import LabelStudioEnvironment
|
|
@@ -14,8 +15,10 @@ from .export_storage.client import AsyncExportStorageClient, ExportStorageClient
|
|
|
14
15
|
from .files.client import AsyncFilesClient, FilesClient
|
|
15
16
|
from .import_storage.client import AsyncImportStorageClient, ImportStorageClient
|
|
16
17
|
from .ml.client import AsyncMlClient, MlClient
|
|
18
|
+
from .model_providers.client import AsyncModelProvidersClient, ModelProvidersClient
|
|
17
19
|
from .predictions.client import AsyncPredictionsClient, PredictionsClient
|
|
18
20
|
from .projects.client import AsyncProjectsClient, ProjectsClient
|
|
21
|
+
from .prompts.client import AsyncPromptsClient, PromptsClient
|
|
19
22
|
from .tasks.client import AsyncTasksClient, TasksClient
|
|
20
23
|
from .users.client import AsyncUsersClient, UsersClient
|
|
21
24
|
from .views.client import AsyncViewsClient, ViewsClient
|
|
@@ -97,6 +100,9 @@ class LabelStudioBase:
|
|
|
97
100
|
self.import_storage = ImportStorageClient(client_wrapper=self._client_wrapper)
|
|
98
101
|
self.export_storage = ExportStorageClient(client_wrapper=self._client_wrapper)
|
|
99
102
|
self.webhooks = WebhooksClient(client_wrapper=self._client_wrapper)
|
|
103
|
+
self.prompts = PromptsClient(client_wrapper=self._client_wrapper)
|
|
104
|
+
self.model_providers = ModelProvidersClient(client_wrapper=self._client_wrapper)
|
|
105
|
+
self.comments = CommentsClient(client_wrapper=self._client_wrapper)
|
|
100
106
|
self.workspaces = WorkspacesClient(client_wrapper=self._client_wrapper)
|
|
101
107
|
|
|
102
108
|
|
|
@@ -174,6 +180,9 @@ class AsyncLabelStudioBase:
|
|
|
174
180
|
self.import_storage = AsyncImportStorageClient(client_wrapper=self._client_wrapper)
|
|
175
181
|
self.export_storage = AsyncExportStorageClient(client_wrapper=self._client_wrapper)
|
|
176
182
|
self.webhooks = AsyncWebhooksClient(client_wrapper=self._client_wrapper)
|
|
183
|
+
self.prompts = AsyncPromptsClient(client_wrapper=self._client_wrapper)
|
|
184
|
+
self.model_providers = AsyncModelProvidersClient(client_wrapper=self._client_wrapper)
|
|
185
|
+
self.comments = AsyncCommentsClient(client_wrapper=self._client_wrapper)
|
|
177
186
|
self.workspaces = AsyncWorkspacesClient(client_wrapper=self._client_wrapper)
|
|
178
187
|
|
|
179
188
|
|