label-studio-sdk 2.0.6__py3-none-any.whl → 2.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.
- label_studio_sdk/__init__.py +32 -2
- label_studio_sdk/base_client.py +4 -0
- label_studio_sdk/converter/exports/yolo.py +89 -74
- label_studio_sdk/core/client_wrapper.py +1 -1
- label_studio_sdk/import_storage/azure_spi/client.py +30 -0
- label_studio_sdk/label_interface/control_tags.py +38 -0
- label_studio_sdk/label_interface/data_examples.json +10 -0
- label_studio_sdk/label_interface/interface.py +13 -0
- label_studio_sdk/label_interface/object_tags.py +9 -0
- label_studio_sdk/ml/client.py +124 -0
- label_studio_sdk/organizations/__init__.py +3 -2
- label_studio_sdk/organizations/client.py +540 -1
- label_studio_sdk/organizations/invites/__init__.py +2 -0
- label_studio_sdk/organizations/invites/client.py +368 -0
- label_studio_sdk/organizations/permissions/__init__.py +2 -0
- label_studio_sdk/organizations/permissions/client.py +1129 -0
- label_studio_sdk/organizations/types/__init__.py +5 -0
- label_studio_sdk/organizations/types/patched_default_role_request_custom_scripts_editable_by.py +7 -0
- label_studio_sdk/project_templates/__init__.py +2 -0
- label_studio_sdk/project_templates/client.py +909 -0
- label_studio_sdk/projects/__init__.py +30 -0
- label_studio_sdk/projects/client.py +355 -0
- label_studio_sdk/projects/stats/__init__.py +28 -0
- label_studio_sdk/projects/stats/client.py +1002 -43
- label_studio_sdk/projects/stats/types/__init__.py +30 -0
- label_studio_sdk/projects/stats/types/stats_agreement_annotator_response.py +26 -0
- label_studio_sdk/projects/stats/types/stats_data_filters_response.py +23 -0
- label_studio_sdk/projects/stats/types/stats_data_filters_response_user_filters.py +34 -0
- label_studio_sdk/projects/stats/types/stats_data_filters_response_user_filters_stats_item.py +22 -0
- label_studio_sdk/projects/stats/types/stats_finished_tasks_response.py +32 -0
- label_studio_sdk/projects/stats/types/stats_lead_time_response.py +23 -0
- label_studio_sdk/projects/stats/types/stats_lead_time_response_lead_time_stats_item.py +37 -0
- label_studio_sdk/projects/stats/types/stats_user_ground_truth_agreement_response.py +20 -0
- label_studio_sdk/projects/stats/types/stats_user_ground_truth_agreement_response_agreement.py +5 -0
- label_studio_sdk/projects/stats/types/stats_user_prediction_agreement_response.py +24 -0
- label_studio_sdk/projects/stats/types/stats_user_prediction_agreement_response_average_prediction_agreement_per_user.py +5 -0
- label_studio_sdk/projects/stats/types/stats_user_review_score_response.py +22 -0
- label_studio_sdk/projects/stats/types/stats_user_review_score_response_performance_score.py +5 -0
- label_studio_sdk/projects/stats/types/stats_user_review_score_response_review_score.py +5 -0
- label_studio_sdk/projects/types/__init__.py +2 -0
- label_studio_sdk/projects/types/projects_import_predictions_response.py +26 -0
- label_studio_sdk/prompts/versions/client.py +4 -16
- label_studio_sdk/types/__init__.py +26 -2
- label_studio_sdk/types/azure_service_principal_import_storage.py +5 -0
- label_studio_sdk/types/azure_service_principal_import_storage_request.py +5 -0
- label_studio_sdk/types/configurable_permission_option.py +25 -0
- label_studio_sdk/types/configurable_permission_option_default.py +7 -0
- label_studio_sdk/types/default_role.py +75 -0
- label_studio_sdk/types/default_role_custom_scripts_editable_by.py +7 -0
- label_studio_sdk/types/lse_organization.py +2 -2
- label_studio_sdk/types/lse_project.py +223 -0
- label_studio_sdk/types/lse_project_counts.py +46 -0
- label_studio_sdk/types/lse_project_sampling.py +7 -0
- label_studio_sdk/types/lse_project_skip_queue.py +7 -0
- label_studio_sdk/types/lse_task.py +1 -1
- label_studio_sdk/types/lse_task_serializer_for_reviewers.py +1 -1
- label_studio_sdk/types/organization_permission.py +31 -0
- label_studio_sdk/types/organization_permission_request.py +24 -0
- label_studio_sdk/types/paginated_lse_project_counts_list.py +23 -0
- label_studio_sdk/types/project_template.py +41 -0
- label_studio_sdk/types/project_template_request.py +38 -0
- label_studio_sdk/types/who_am_i_user.py +1 -0
- {label_studio_sdk-2.0.6.dist-info → label_studio_sdk-2.0.8.dist-info}/METADATA +1 -1
- {label_studio_sdk-2.0.6.dist-info → label_studio_sdk-2.0.8.dist-info}/RECORD +66 -31
- label_studio_sdk/types/default_role_enum.py +0 -5
- {label_studio_sdk-2.0.6.dist-info → label_studio_sdk-2.0.8.dist-info}/LICENSE +0 -0
- {label_studio_sdk-2.0.6.dist-info → label_studio_sdk-2.0.8.dist-info}/WHEEL +0 -0
|
@@ -6,6 +6,7 @@ from .types import (
|
|
|
6
6
|
PatchedLseProjectUpdateRequestSampling,
|
|
7
7
|
PatchedLseProjectUpdateRequestSkipQueue,
|
|
8
8
|
ProjectsDuplicateResponse,
|
|
9
|
+
ProjectsImportPredictionsResponse,
|
|
9
10
|
ProjectsImportTasksResponse,
|
|
10
11
|
ProjectsListRequestFilter,
|
|
11
12
|
)
|
|
@@ -28,13 +29,27 @@ from .assignments import (
|
|
|
28
29
|
)
|
|
29
30
|
from .exports import ExportsConvertResponse
|
|
30
31
|
from .stats import (
|
|
32
|
+
StatsAgreementAnnotatorResponse,
|
|
33
|
+
StatsDataFiltersResponse,
|
|
34
|
+
StatsDataFiltersResponseUserFilters,
|
|
35
|
+
StatsDataFiltersResponseUserFiltersStatsItem,
|
|
36
|
+
StatsFinishedTasksResponse,
|
|
31
37
|
StatsIaaResponse,
|
|
32
38
|
StatsIaaResponseCommonTasks,
|
|
33
39
|
StatsIaaResponseIaa,
|
|
34
40
|
StatsIaaResponseStd,
|
|
41
|
+
StatsLeadTimeResponse,
|
|
42
|
+
StatsLeadTimeResponseLeadTimeStatsItem,
|
|
35
43
|
StatsTotalAgreementResponse,
|
|
36
44
|
StatsTotalAgreementResponseOne,
|
|
37
45
|
StatsTotalAgreementResponseZero,
|
|
46
|
+
StatsUserGroundTruthAgreementResponse,
|
|
47
|
+
StatsUserGroundTruthAgreementResponseAgreement,
|
|
48
|
+
StatsUserPredictionAgreementResponse,
|
|
49
|
+
StatsUserPredictionAgreementResponseAveragePredictionAgreementPerUser,
|
|
50
|
+
StatsUserReviewScoreResponse,
|
|
51
|
+
StatsUserReviewScoreResponsePerformanceScore,
|
|
52
|
+
StatsUserReviewScoreResponseReviewScore,
|
|
38
53
|
)
|
|
39
54
|
|
|
40
55
|
__all__ = [
|
|
@@ -58,15 +73,30 @@ __all__ = [
|
|
|
58
73
|
"PatchedLseProjectUpdateRequestSampling",
|
|
59
74
|
"PatchedLseProjectUpdateRequestSkipQueue",
|
|
60
75
|
"ProjectsDuplicateResponse",
|
|
76
|
+
"ProjectsImportPredictionsResponse",
|
|
61
77
|
"ProjectsImportTasksResponse",
|
|
62
78
|
"ProjectsListRequestFilter",
|
|
79
|
+
"StatsAgreementAnnotatorResponse",
|
|
80
|
+
"StatsDataFiltersResponse",
|
|
81
|
+
"StatsDataFiltersResponseUserFilters",
|
|
82
|
+
"StatsDataFiltersResponseUserFiltersStatsItem",
|
|
83
|
+
"StatsFinishedTasksResponse",
|
|
63
84
|
"StatsIaaResponse",
|
|
64
85
|
"StatsIaaResponseCommonTasks",
|
|
65
86
|
"StatsIaaResponseIaa",
|
|
66
87
|
"StatsIaaResponseStd",
|
|
88
|
+
"StatsLeadTimeResponse",
|
|
89
|
+
"StatsLeadTimeResponseLeadTimeStatsItem",
|
|
67
90
|
"StatsTotalAgreementResponse",
|
|
68
91
|
"StatsTotalAgreementResponseOne",
|
|
69
92
|
"StatsTotalAgreementResponseZero",
|
|
93
|
+
"StatsUserGroundTruthAgreementResponse",
|
|
94
|
+
"StatsUserGroundTruthAgreementResponseAgreement",
|
|
95
|
+
"StatsUserPredictionAgreementResponse",
|
|
96
|
+
"StatsUserPredictionAgreementResponseAveragePredictionAgreementPerUser",
|
|
97
|
+
"StatsUserReviewScoreResponse",
|
|
98
|
+
"StatsUserReviewScoreResponsePerformanceScore",
|
|
99
|
+
"StatsUserReviewScoreResponseReviewScore",
|
|
70
100
|
"assignments",
|
|
71
101
|
"exports",
|
|
72
102
|
"members",
|
|
@@ -22,6 +22,7 @@ from .types.lse_project_create_request_sampling import LseProjectCreateRequestSa
|
|
|
22
22
|
from .types.lse_project_create_request_skip_queue import LseProjectCreateRequestSkipQueue
|
|
23
23
|
from ..types.lse_project_create import LseProjectCreate
|
|
24
24
|
from ..core.serialization import convert_and_respect_annotation_metadata
|
|
25
|
+
from ..types.paginated_lse_project_counts_list import PaginatedLseProjectCountsList
|
|
25
26
|
from ..types.project import Project
|
|
26
27
|
from ..core.jsonable_encoder import jsonable_encoder
|
|
27
28
|
from ..types.assignment_settings_request import AssignmentSettingsRequest
|
|
@@ -34,6 +35,8 @@ from .types.projects_duplicate_response import ProjectsDuplicateResponse
|
|
|
34
35
|
from ..types.import_api_request import ImportApiRequest
|
|
35
36
|
from .types.projects_import_tasks_response import ProjectsImportTasksResponse
|
|
36
37
|
from ..errors.bad_request_error import BadRequestError
|
|
38
|
+
from ..types.prediction_request import PredictionRequest
|
|
39
|
+
from .types.projects_import_predictions_response import ProjectsImportPredictionsResponse
|
|
37
40
|
from ..types.project_label_config import ProjectLabelConfig
|
|
38
41
|
from ..core.client_wrapper import AsyncClientWrapper
|
|
39
42
|
from .exports.client import AsyncExportsClient
|
|
@@ -366,6 +369,99 @@ class ProjectsClient:
|
|
|
366
369
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
367
370
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
368
371
|
|
|
372
|
+
def list_counts(
|
|
373
|
+
self,
|
|
374
|
+
*,
|
|
375
|
+
filter: typing.Optional[str] = None,
|
|
376
|
+
ids: typing.Optional[str] = None,
|
|
377
|
+
include: typing.Optional[str] = None,
|
|
378
|
+
ordering: typing.Optional[str] = None,
|
|
379
|
+
page: typing.Optional[int] = None,
|
|
380
|
+
page_size: typing.Optional[int] = None,
|
|
381
|
+
search: typing.Optional[str] = None,
|
|
382
|
+
title: typing.Optional[str] = None,
|
|
383
|
+
workspaces: typing.Optional[float] = None,
|
|
384
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
385
|
+
) -> PaginatedLseProjectCountsList:
|
|
386
|
+
"""
|
|
387
|
+
Returns a list of projects with their counts. For example, task_number which is the total task number in project
|
|
388
|
+
|
|
389
|
+
Parameters
|
|
390
|
+
----------
|
|
391
|
+
filter : typing.Optional[str]
|
|
392
|
+
Project filter setting. One of 'all', 'pinned_only', 'exclude_pinned'.
|
|
393
|
+
|
|
394
|
+
ids : typing.Optional[str]
|
|
395
|
+
Filter id by in list
|
|
396
|
+
|
|
397
|
+
include : typing.Optional[str]
|
|
398
|
+
Comma-separated list of fields to include
|
|
399
|
+
|
|
400
|
+
ordering : typing.Optional[str]
|
|
401
|
+
Which field to use when ordering the results.
|
|
402
|
+
|
|
403
|
+
page : typing.Optional[int]
|
|
404
|
+
A page number within the paginated result set.
|
|
405
|
+
|
|
406
|
+
page_size : typing.Optional[int]
|
|
407
|
+
Number of results to return per page.
|
|
408
|
+
|
|
409
|
+
search : typing.Optional[str]
|
|
410
|
+
Search term for project title and description
|
|
411
|
+
|
|
412
|
+
title : typing.Optional[str]
|
|
413
|
+
Filter title by contains (case-insensitive)
|
|
414
|
+
|
|
415
|
+
workspaces : typing.Optional[float]
|
|
416
|
+
Filter workspaces by exact match
|
|
417
|
+
|
|
418
|
+
request_options : typing.Optional[RequestOptions]
|
|
419
|
+
Request-specific configuration.
|
|
420
|
+
|
|
421
|
+
Returns
|
|
422
|
+
-------
|
|
423
|
+
PaginatedLseProjectCountsList
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
Examples
|
|
427
|
+
--------
|
|
428
|
+
from label_studio_sdk import LabelStudio
|
|
429
|
+
|
|
430
|
+
client = LabelStudio(
|
|
431
|
+
api_key="YOUR_API_KEY",
|
|
432
|
+
)
|
|
433
|
+
client.projects.list_counts()
|
|
434
|
+
"""
|
|
435
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
436
|
+
"api/projects/counts/",
|
|
437
|
+
method="GET",
|
|
438
|
+
params={
|
|
439
|
+
"filter": filter,
|
|
440
|
+
"ids": ids,
|
|
441
|
+
"include": include,
|
|
442
|
+
"ordering": ordering,
|
|
443
|
+
"page": page,
|
|
444
|
+
"page_size": page_size,
|
|
445
|
+
"search": search,
|
|
446
|
+
"title": title,
|
|
447
|
+
"workspaces": workspaces,
|
|
448
|
+
},
|
|
449
|
+
request_options=request_options,
|
|
450
|
+
)
|
|
451
|
+
try:
|
|
452
|
+
if 200 <= _response.status_code < 300:
|
|
453
|
+
return typing.cast(
|
|
454
|
+
PaginatedLseProjectCountsList,
|
|
455
|
+
construct_type(
|
|
456
|
+
type_=PaginatedLseProjectCountsList, # type: ignore
|
|
457
|
+
object_=_response.json(),
|
|
458
|
+
),
|
|
459
|
+
)
|
|
460
|
+
_response_json = _response.json()
|
|
461
|
+
except JSONDecodeError:
|
|
462
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
463
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
464
|
+
|
|
369
465
|
def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> Project:
|
|
370
466
|
"""
|
|
371
467
|
Retrieve information about a project by project ID.
|
|
@@ -924,6 +1020,81 @@ class ProjectsClient:
|
|
|
924
1020
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
925
1021
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
926
1022
|
|
|
1023
|
+
def import_predictions(
|
|
1024
|
+
self,
|
|
1025
|
+
id: int,
|
|
1026
|
+
*,
|
|
1027
|
+
request: typing.Sequence[PredictionRequest],
|
|
1028
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1029
|
+
) -> ProjectsImportPredictionsResponse:
|
|
1030
|
+
"""
|
|
1031
|
+
Import model predictions for tasks in the specified project.
|
|
1032
|
+
|
|
1033
|
+
Parameters
|
|
1034
|
+
----------
|
|
1035
|
+
id : int
|
|
1036
|
+
A unique integer value identifying this project.
|
|
1037
|
+
|
|
1038
|
+
request : typing.Sequence[PredictionRequest]
|
|
1039
|
+
|
|
1040
|
+
request_options : typing.Optional[RequestOptions]
|
|
1041
|
+
Request-specific configuration.
|
|
1042
|
+
|
|
1043
|
+
Returns
|
|
1044
|
+
-------
|
|
1045
|
+
ProjectsImportPredictionsResponse
|
|
1046
|
+
Predictions successfully imported
|
|
1047
|
+
|
|
1048
|
+
Examples
|
|
1049
|
+
--------
|
|
1050
|
+
from label_studio_sdk import LabelStudio, PredictionRequest
|
|
1051
|
+
|
|
1052
|
+
client = LabelStudio(
|
|
1053
|
+
api_key="YOUR_API_KEY",
|
|
1054
|
+
)
|
|
1055
|
+
client.projects.import_predictions(
|
|
1056
|
+
id=1,
|
|
1057
|
+
request=[
|
|
1058
|
+
PredictionRequest(
|
|
1059
|
+
result=[{"key": "value"}],
|
|
1060
|
+
task=1,
|
|
1061
|
+
)
|
|
1062
|
+
],
|
|
1063
|
+
)
|
|
1064
|
+
"""
|
|
1065
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1066
|
+
f"api/projects/{jsonable_encoder(id)}/import/predictions",
|
|
1067
|
+
method="POST",
|
|
1068
|
+
json=convert_and_respect_annotation_metadata(
|
|
1069
|
+
object_=request, annotation=typing.Sequence[PredictionRequest], direction="write"
|
|
1070
|
+
),
|
|
1071
|
+
request_options=request_options,
|
|
1072
|
+
omit=OMIT,
|
|
1073
|
+
)
|
|
1074
|
+
try:
|
|
1075
|
+
if 200 <= _response.status_code < 300:
|
|
1076
|
+
return typing.cast(
|
|
1077
|
+
ProjectsImportPredictionsResponse,
|
|
1078
|
+
construct_type(
|
|
1079
|
+
type_=ProjectsImportPredictionsResponse, # type: ignore
|
|
1080
|
+
object_=_response.json(),
|
|
1081
|
+
),
|
|
1082
|
+
)
|
|
1083
|
+
if _response.status_code == 400:
|
|
1084
|
+
raise BadRequestError(
|
|
1085
|
+
typing.cast(
|
|
1086
|
+
typing.Optional[typing.Any],
|
|
1087
|
+
construct_type(
|
|
1088
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1089
|
+
object_=_response.json(),
|
|
1090
|
+
),
|
|
1091
|
+
)
|
|
1092
|
+
)
|
|
1093
|
+
_response_json = _response.json()
|
|
1094
|
+
except JSONDecodeError:
|
|
1095
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1096
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1097
|
+
|
|
927
1098
|
def validate_label_config(
|
|
928
1099
|
self, id: int, *, label_config: str, request_options: typing.Optional[RequestOptions] = None
|
|
929
1100
|
) -> ProjectLabelConfig:
|
|
@@ -1316,6 +1487,107 @@ class AsyncProjectsClient:
|
|
|
1316
1487
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1317
1488
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1318
1489
|
|
|
1490
|
+
async def list_counts(
|
|
1491
|
+
self,
|
|
1492
|
+
*,
|
|
1493
|
+
filter: typing.Optional[str] = None,
|
|
1494
|
+
ids: typing.Optional[str] = None,
|
|
1495
|
+
include: typing.Optional[str] = None,
|
|
1496
|
+
ordering: typing.Optional[str] = None,
|
|
1497
|
+
page: typing.Optional[int] = None,
|
|
1498
|
+
page_size: typing.Optional[int] = None,
|
|
1499
|
+
search: typing.Optional[str] = None,
|
|
1500
|
+
title: typing.Optional[str] = None,
|
|
1501
|
+
workspaces: typing.Optional[float] = None,
|
|
1502
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1503
|
+
) -> PaginatedLseProjectCountsList:
|
|
1504
|
+
"""
|
|
1505
|
+
Returns a list of projects with their counts. For example, task_number which is the total task number in project
|
|
1506
|
+
|
|
1507
|
+
Parameters
|
|
1508
|
+
----------
|
|
1509
|
+
filter : typing.Optional[str]
|
|
1510
|
+
Project filter setting. One of 'all', 'pinned_only', 'exclude_pinned'.
|
|
1511
|
+
|
|
1512
|
+
ids : typing.Optional[str]
|
|
1513
|
+
Filter id by in list
|
|
1514
|
+
|
|
1515
|
+
include : typing.Optional[str]
|
|
1516
|
+
Comma-separated list of fields to include
|
|
1517
|
+
|
|
1518
|
+
ordering : typing.Optional[str]
|
|
1519
|
+
Which field to use when ordering the results.
|
|
1520
|
+
|
|
1521
|
+
page : typing.Optional[int]
|
|
1522
|
+
A page number within the paginated result set.
|
|
1523
|
+
|
|
1524
|
+
page_size : typing.Optional[int]
|
|
1525
|
+
Number of results to return per page.
|
|
1526
|
+
|
|
1527
|
+
search : typing.Optional[str]
|
|
1528
|
+
Search term for project title and description
|
|
1529
|
+
|
|
1530
|
+
title : typing.Optional[str]
|
|
1531
|
+
Filter title by contains (case-insensitive)
|
|
1532
|
+
|
|
1533
|
+
workspaces : typing.Optional[float]
|
|
1534
|
+
Filter workspaces by exact match
|
|
1535
|
+
|
|
1536
|
+
request_options : typing.Optional[RequestOptions]
|
|
1537
|
+
Request-specific configuration.
|
|
1538
|
+
|
|
1539
|
+
Returns
|
|
1540
|
+
-------
|
|
1541
|
+
PaginatedLseProjectCountsList
|
|
1542
|
+
|
|
1543
|
+
|
|
1544
|
+
Examples
|
|
1545
|
+
--------
|
|
1546
|
+
import asyncio
|
|
1547
|
+
|
|
1548
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
1549
|
+
|
|
1550
|
+
client = AsyncLabelStudio(
|
|
1551
|
+
api_key="YOUR_API_KEY",
|
|
1552
|
+
)
|
|
1553
|
+
|
|
1554
|
+
|
|
1555
|
+
async def main() -> None:
|
|
1556
|
+
await client.projects.list_counts()
|
|
1557
|
+
|
|
1558
|
+
|
|
1559
|
+
asyncio.run(main())
|
|
1560
|
+
"""
|
|
1561
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1562
|
+
"api/projects/counts/",
|
|
1563
|
+
method="GET",
|
|
1564
|
+
params={
|
|
1565
|
+
"filter": filter,
|
|
1566
|
+
"ids": ids,
|
|
1567
|
+
"include": include,
|
|
1568
|
+
"ordering": ordering,
|
|
1569
|
+
"page": page,
|
|
1570
|
+
"page_size": page_size,
|
|
1571
|
+
"search": search,
|
|
1572
|
+
"title": title,
|
|
1573
|
+
"workspaces": workspaces,
|
|
1574
|
+
},
|
|
1575
|
+
request_options=request_options,
|
|
1576
|
+
)
|
|
1577
|
+
try:
|
|
1578
|
+
if 200 <= _response.status_code < 300:
|
|
1579
|
+
return typing.cast(
|
|
1580
|
+
PaginatedLseProjectCountsList,
|
|
1581
|
+
construct_type(
|
|
1582
|
+
type_=PaginatedLseProjectCountsList, # type: ignore
|
|
1583
|
+
object_=_response.json(),
|
|
1584
|
+
),
|
|
1585
|
+
)
|
|
1586
|
+
_response_json = _response.json()
|
|
1587
|
+
except JSONDecodeError:
|
|
1588
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1589
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1590
|
+
|
|
1319
1591
|
async def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> Project:
|
|
1320
1592
|
"""
|
|
1321
1593
|
Retrieve information about a project by project ID.
|
|
@@ -1914,6 +2186,89 @@ class AsyncProjectsClient:
|
|
|
1914
2186
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1915
2187
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1916
2188
|
|
|
2189
|
+
async def import_predictions(
|
|
2190
|
+
self,
|
|
2191
|
+
id: int,
|
|
2192
|
+
*,
|
|
2193
|
+
request: typing.Sequence[PredictionRequest],
|
|
2194
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2195
|
+
) -> ProjectsImportPredictionsResponse:
|
|
2196
|
+
"""
|
|
2197
|
+
Import model predictions for tasks in the specified project.
|
|
2198
|
+
|
|
2199
|
+
Parameters
|
|
2200
|
+
----------
|
|
2201
|
+
id : int
|
|
2202
|
+
A unique integer value identifying this project.
|
|
2203
|
+
|
|
2204
|
+
request : typing.Sequence[PredictionRequest]
|
|
2205
|
+
|
|
2206
|
+
request_options : typing.Optional[RequestOptions]
|
|
2207
|
+
Request-specific configuration.
|
|
2208
|
+
|
|
2209
|
+
Returns
|
|
2210
|
+
-------
|
|
2211
|
+
ProjectsImportPredictionsResponse
|
|
2212
|
+
Predictions successfully imported
|
|
2213
|
+
|
|
2214
|
+
Examples
|
|
2215
|
+
--------
|
|
2216
|
+
import asyncio
|
|
2217
|
+
|
|
2218
|
+
from label_studio_sdk import AsyncLabelStudio, PredictionRequest
|
|
2219
|
+
|
|
2220
|
+
client = AsyncLabelStudio(
|
|
2221
|
+
api_key="YOUR_API_KEY",
|
|
2222
|
+
)
|
|
2223
|
+
|
|
2224
|
+
|
|
2225
|
+
async def main() -> None:
|
|
2226
|
+
await client.projects.import_predictions(
|
|
2227
|
+
id=1,
|
|
2228
|
+
request=[
|
|
2229
|
+
PredictionRequest(
|
|
2230
|
+
result=[{"key": "value"}],
|
|
2231
|
+
task=1,
|
|
2232
|
+
)
|
|
2233
|
+
],
|
|
2234
|
+
)
|
|
2235
|
+
|
|
2236
|
+
|
|
2237
|
+
asyncio.run(main())
|
|
2238
|
+
"""
|
|
2239
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2240
|
+
f"api/projects/{jsonable_encoder(id)}/import/predictions",
|
|
2241
|
+
method="POST",
|
|
2242
|
+
json=convert_and_respect_annotation_metadata(
|
|
2243
|
+
object_=request, annotation=typing.Sequence[PredictionRequest], direction="write"
|
|
2244
|
+
),
|
|
2245
|
+
request_options=request_options,
|
|
2246
|
+
omit=OMIT,
|
|
2247
|
+
)
|
|
2248
|
+
try:
|
|
2249
|
+
if 200 <= _response.status_code < 300:
|
|
2250
|
+
return typing.cast(
|
|
2251
|
+
ProjectsImportPredictionsResponse,
|
|
2252
|
+
construct_type(
|
|
2253
|
+
type_=ProjectsImportPredictionsResponse, # type: ignore
|
|
2254
|
+
object_=_response.json(),
|
|
2255
|
+
),
|
|
2256
|
+
)
|
|
2257
|
+
if _response.status_code == 400:
|
|
2258
|
+
raise BadRequestError(
|
|
2259
|
+
typing.cast(
|
|
2260
|
+
typing.Optional[typing.Any],
|
|
2261
|
+
construct_type(
|
|
2262
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
2263
|
+
object_=_response.json(),
|
|
2264
|
+
),
|
|
2265
|
+
)
|
|
2266
|
+
)
|
|
2267
|
+
_response_json = _response.json()
|
|
2268
|
+
except JSONDecodeError:
|
|
2269
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2270
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
2271
|
+
|
|
1917
2272
|
async def validate_label_config(
|
|
1918
2273
|
self, id: int, *, label_config: str, request_options: typing.Optional[RequestOptions] = None
|
|
1919
2274
|
) -> ProjectLabelConfig:
|
|
@@ -1,21 +1,49 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
3
|
from .types import (
|
|
4
|
+
StatsAgreementAnnotatorResponse,
|
|
5
|
+
StatsDataFiltersResponse,
|
|
6
|
+
StatsDataFiltersResponseUserFilters,
|
|
7
|
+
StatsDataFiltersResponseUserFiltersStatsItem,
|
|
8
|
+
StatsFinishedTasksResponse,
|
|
4
9
|
StatsIaaResponse,
|
|
5
10
|
StatsIaaResponseCommonTasks,
|
|
6
11
|
StatsIaaResponseIaa,
|
|
7
12
|
StatsIaaResponseStd,
|
|
13
|
+
StatsLeadTimeResponse,
|
|
14
|
+
StatsLeadTimeResponseLeadTimeStatsItem,
|
|
8
15
|
StatsTotalAgreementResponse,
|
|
9
16
|
StatsTotalAgreementResponseOne,
|
|
10
17
|
StatsTotalAgreementResponseZero,
|
|
18
|
+
StatsUserGroundTruthAgreementResponse,
|
|
19
|
+
StatsUserGroundTruthAgreementResponseAgreement,
|
|
20
|
+
StatsUserPredictionAgreementResponse,
|
|
21
|
+
StatsUserPredictionAgreementResponseAveragePredictionAgreementPerUser,
|
|
22
|
+
StatsUserReviewScoreResponse,
|
|
23
|
+
StatsUserReviewScoreResponsePerformanceScore,
|
|
24
|
+
StatsUserReviewScoreResponseReviewScore,
|
|
11
25
|
)
|
|
12
26
|
|
|
13
27
|
__all__ = [
|
|
28
|
+
"StatsAgreementAnnotatorResponse",
|
|
29
|
+
"StatsDataFiltersResponse",
|
|
30
|
+
"StatsDataFiltersResponseUserFilters",
|
|
31
|
+
"StatsDataFiltersResponseUserFiltersStatsItem",
|
|
32
|
+
"StatsFinishedTasksResponse",
|
|
14
33
|
"StatsIaaResponse",
|
|
15
34
|
"StatsIaaResponseCommonTasks",
|
|
16
35
|
"StatsIaaResponseIaa",
|
|
17
36
|
"StatsIaaResponseStd",
|
|
37
|
+
"StatsLeadTimeResponse",
|
|
38
|
+
"StatsLeadTimeResponseLeadTimeStatsItem",
|
|
18
39
|
"StatsTotalAgreementResponse",
|
|
19
40
|
"StatsTotalAgreementResponseOne",
|
|
20
41
|
"StatsTotalAgreementResponseZero",
|
|
42
|
+
"StatsUserGroundTruthAgreementResponse",
|
|
43
|
+
"StatsUserGroundTruthAgreementResponseAgreement",
|
|
44
|
+
"StatsUserPredictionAgreementResponse",
|
|
45
|
+
"StatsUserPredictionAgreementResponseAveragePredictionAgreementPerUser",
|
|
46
|
+
"StatsUserReviewScoreResponse",
|
|
47
|
+
"StatsUserReviewScoreResponsePerformanceScore",
|
|
48
|
+
"StatsUserReviewScoreResponseReviewScore",
|
|
21
49
|
]
|