label-studio-sdk 1.0.8__py3-none-any.whl → 1.0.10__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 +20 -7
- label_studio_sdk/_extensions/label_studio_tools/core/utils/io.py +16 -4
- label_studio_sdk/_extensions/pager_ext.py +8 -0
- label_studio_sdk/actions/client.py +91 -40
- label_studio_sdk/actions/types/actions_create_request_filters.py +14 -24
- label_studio_sdk/actions/types/actions_create_request_filters_items_item.py +16 -26
- label_studio_sdk/actions/types/actions_create_request_filters_items_item_value.py +3 -1
- label_studio_sdk/actions/types/actions_create_request_selected_items.py +1 -2
- label_studio_sdk/actions/types/actions_create_request_selected_items_excluded.py +15 -25
- label_studio_sdk/actions/types/actions_create_request_selected_items_included.py +15 -25
- label_studio_sdk/annotations/__init__.py +2 -2
- label_studio_sdk/annotations/client.py +278 -104
- label_studio_sdk/annotations/types/__init__.py +2 -1
- label_studio_sdk/annotations/types/annotations_create_bulk_request_selected_items.py +34 -0
- label_studio_sdk/annotations/types/annotations_create_bulk_response_item.py +11 -21
- label_studio_sdk/base_client.py +46 -27
- label_studio_sdk/client.py +1 -0
- label_studio_sdk/comments/client.py +190 -44
- label_studio_sdk/converter/converter.py +56 -13
- label_studio_sdk/converter/imports/yolo.py +1 -1
- label_studio_sdk/converter/utils.py +3 -2
- label_studio_sdk/core/__init__.py +21 -4
- label_studio_sdk/core/client_wrapper.py +9 -10
- label_studio_sdk/core/file.py +37 -8
- label_studio_sdk/core/http_client.py +52 -28
- label_studio_sdk/core/jsonable_encoder.py +33 -31
- label_studio_sdk/core/pagination.py +5 -4
- label_studio_sdk/core/pydantic_utilities.py +272 -4
- label_studio_sdk/core/query_encoder.py +38 -13
- label_studio_sdk/core/request_options.py +3 -0
- label_studio_sdk/core/serialization.py +272 -0
- label_studio_sdk/errors/bad_request_error.py +2 -3
- label_studio_sdk/export_storage/azure/client.py +228 -58
- label_studio_sdk/export_storage/azure/types/azure_create_response.py +19 -29
- label_studio_sdk/export_storage/azure/types/azure_update_response.py +19 -29
- label_studio_sdk/export_storage/client.py +48 -18
- label_studio_sdk/export_storage/gcs/client.py +228 -58
- label_studio_sdk/export_storage/gcs/types/gcs_create_response.py +19 -29
- label_studio_sdk/export_storage/gcs/types/gcs_update_response.py +19 -29
- label_studio_sdk/export_storage/local/client.py +222 -56
- label_studio_sdk/export_storage/local/types/local_create_response.py +17 -27
- label_studio_sdk/export_storage/local/types/local_update_response.py +17 -27
- label_studio_sdk/export_storage/redis/client.py +228 -58
- label_studio_sdk/export_storage/redis/types/redis_create_response.py +20 -30
- label_studio_sdk/export_storage/redis/types/redis_update_response.py +20 -30
- label_studio_sdk/export_storage/s3/client.py +228 -58
- label_studio_sdk/export_storage/s3/types/s3create_response.py +27 -35
- label_studio_sdk/export_storage/s3/types/s3update_response.py +27 -35
- label_studio_sdk/export_storage/s3s/client.py +187 -43
- label_studio_sdk/export_storage/types/export_storage_list_types_response_item.py +11 -21
- label_studio_sdk/files/client.py +172 -56
- label_studio_sdk/import_storage/azure/client.py +223 -53
- label_studio_sdk/import_storage/azure/types/azure_create_response.py +22 -32
- label_studio_sdk/import_storage/azure/types/azure_update_response.py +22 -32
- label_studio_sdk/import_storage/client.py +48 -18
- label_studio_sdk/import_storage/gcs/client.py +223 -53
- label_studio_sdk/import_storage/gcs/types/gcs_create_response.py +22 -32
- label_studio_sdk/import_storage/gcs/types/gcs_update_response.py +22 -32
- label_studio_sdk/import_storage/local/client.py +223 -53
- label_studio_sdk/import_storage/local/types/local_create_response.py +17 -27
- label_studio_sdk/import_storage/local/types/local_update_response.py +17 -27
- label_studio_sdk/import_storage/redis/client.py +223 -53
- label_studio_sdk/import_storage/redis/types/redis_create_response.py +20 -30
- label_studio_sdk/import_storage/redis/types/redis_update_response.py +20 -30
- label_studio_sdk/import_storage/s3/client.py +223 -53
- label_studio_sdk/import_storage/s3/types/s3create_response.py +31 -39
- label_studio_sdk/import_storage/s3/types/s3update_response.py +31 -39
- label_studio_sdk/import_storage/s3s/client.py +222 -52
- label_studio_sdk/import_storage/types/import_storage_list_types_response_item.py +11 -21
- label_studio_sdk/label_interface/control_tags.py +1 -1
- label_studio_sdk/ml/client.py +280 -78
- label_studio_sdk/ml/types/ml_create_response.py +21 -31
- label_studio_sdk/ml/types/ml_update_response.py +21 -31
- label_studio_sdk/model_providers/client.py +173 -56
- label_studio_sdk/predictions/client.py +247 -101
- label_studio_sdk/projects/__init__.py +3 -0
- label_studio_sdk/projects/client.py +309 -115
- label_studio_sdk/projects/client_ext.py +16 -0
- label_studio_sdk/projects/exports/__init__.py +3 -0
- label_studio_sdk/projects/exports/client.py +447 -296
- label_studio_sdk/projects/exports/client_ext.py +134 -0
- label_studio_sdk/projects/exports/types/__init__.py +6 -0
- label_studio_sdk/projects/exports/types/exports_convert_response.py +24 -0
- label_studio_sdk/projects/exports/types/exports_list_formats_response_item.py +44 -0
- label_studio_sdk/projects/types/projects_create_response.py +29 -34
- label_studio_sdk/projects/types/projects_import_tasks_response.py +19 -29
- label_studio_sdk/projects/types/projects_list_response.py +11 -21
- label_studio_sdk/projects/types/projects_update_response.py +24 -34
- label_studio_sdk/prompts/client.py +309 -92
- label_studio_sdk/prompts/indicators/client.py +67 -23
- label_studio_sdk/prompts/runs/client.py +95 -40
- label_studio_sdk/prompts/types/prompts_batch_failed_predictions_request_failed_predictions_item.py +14 -24
- label_studio_sdk/prompts/types/prompts_batch_failed_predictions_response.py +11 -21
- label_studio_sdk/prompts/types/prompts_batch_predictions_request_results_item.py +26 -29
- label_studio_sdk/prompts/types/prompts_batch_predictions_response.py +11 -21
- label_studio_sdk/prompts/versions/client.py +277 -88
- label_studio_sdk/tasks/client.py +263 -90
- label_studio_sdk/tasks/types/tasks_list_response.py +15 -25
- label_studio_sdk/types/__init__.py +10 -6
- label_studio_sdk/types/annotation.py +29 -38
- label_studio_sdk/types/annotation_filter_options.py +14 -24
- label_studio_sdk/types/annotations_dm_field.py +30 -39
- label_studio_sdk/types/azure_blob_export_storage.py +28 -37
- label_studio_sdk/types/azure_blob_import_storage.py +28 -37
- label_studio_sdk/types/base_task.py +30 -39
- label_studio_sdk/types/base_task_updated_by.py +3 -1
- label_studio_sdk/types/base_user.py +14 -21
- label_studio_sdk/types/comment.py +12 -21
- label_studio_sdk/types/comment_created_by.py +1 -1
- label_studio_sdk/types/converted_format.py +12 -22
- label_studio_sdk/types/data_manager_task_serializer.py +31 -40
- label_studio_sdk/types/data_manager_task_serializer_annotators_item.py +1 -1
- label_studio_sdk/types/data_manager_task_serializer_drafts_item.py +13 -22
- label_studio_sdk/types/data_manager_task_serializer_predictions_item.py +15 -24
- label_studio_sdk/types/export.py +17 -26
- label_studio_sdk/types/export_format.py +25 -0
- label_studio_sdk/types/export_snapshot.py +45 -0
- label_studio_sdk/types/export_snapshot_status.py +5 -0
- label_studio_sdk/types/file_upload.py +11 -21
- label_studio_sdk/types/filter.py +16 -26
- label_studio_sdk/types/filter_group.py +12 -22
- label_studio_sdk/types/gcs_export_storage.py +28 -37
- label_studio_sdk/types/gcs_import_storage.py +28 -37
- label_studio_sdk/types/inference_run.py +14 -23
- label_studio_sdk/types/inference_run_cost_estimate.py +17 -27
- label_studio_sdk/types/inference_run_created_by.py +1 -1
- label_studio_sdk/types/inference_run_organization.py +1 -1
- label_studio_sdk/types/key_indicator_value.py +12 -22
- label_studio_sdk/types/key_indicators.py +0 -1
- label_studio_sdk/types/key_indicators_item.py +15 -25
- label_studio_sdk/types/key_indicators_item_additional_kpis_item.py +13 -23
- label_studio_sdk/types/key_indicators_item_extra_kpis_item.py +13 -23
- label_studio_sdk/types/local_files_export_storage.py +25 -34
- label_studio_sdk/types/local_files_import_storage.py +24 -33
- label_studio_sdk/types/ml_backend.py +23 -32
- label_studio_sdk/types/model_provider_connection.py +22 -31
- label_studio_sdk/types/model_provider_connection_created_by.py +1 -1
- label_studio_sdk/types/model_provider_connection_organization.py +1 -1
- label_studio_sdk/types/model_provider_connection_provider.py +3 -1
- label_studio_sdk/types/prediction.py +21 -30
- label_studio_sdk/types/project.py +48 -55
- label_studio_sdk/types/project_import.py +21 -30
- label_studio_sdk/types/project_label_config.py +12 -22
- label_studio_sdk/types/prompt.py +24 -32
- label_studio_sdk/types/prompt_associated_projects_item.py +6 -0
- label_studio_sdk/types/prompt_associated_projects_item_id.py +20 -0
- label_studio_sdk/types/prompt_created_by.py +1 -1
- label_studio_sdk/types/prompt_organization.py +1 -1
- label_studio_sdk/types/prompt_version.py +13 -22
- label_studio_sdk/types/prompt_version_created_by.py +1 -1
- label_studio_sdk/types/prompt_version_organization.py +1 -1
- label_studio_sdk/types/prompt_version_provider.py +3 -1
- label_studio_sdk/types/redis_export_storage.py +29 -38
- label_studio_sdk/types/redis_import_storage.py +28 -37
- label_studio_sdk/types/refined_prompt_response.py +19 -29
- label_studio_sdk/types/s3export_storage.py +36 -43
- label_studio_sdk/types/s3import_storage.py +37 -44
- label_studio_sdk/types/s3s_export_storage.py +26 -33
- label_studio_sdk/types/s3s_import_storage.py +35 -42
- label_studio_sdk/types/serialization_option.py +12 -22
- label_studio_sdk/types/serialization_options.py +18 -28
- label_studio_sdk/types/task.py +44 -47
- label_studio_sdk/types/task_annotators_item.py +1 -1
- label_studio_sdk/types/task_comment_authors_item.py +1 -1
- label_studio_sdk/types/task_filter_options.py +15 -25
- label_studio_sdk/types/user_simple.py +11 -21
- label_studio_sdk/types/view.py +16 -26
- label_studio_sdk/types/webhook.py +19 -28
- label_studio_sdk/types/webhook_serializer_for_update.py +19 -28
- label_studio_sdk/types/workspace.py +22 -31
- label_studio_sdk/users/client.py +257 -63
- label_studio_sdk/users/types/users_get_token_response.py +12 -22
- label_studio_sdk/users/types/users_reset_token_response.py +12 -22
- label_studio_sdk/version.py +0 -1
- label_studio_sdk/versions/__init__.py +5 -0
- label_studio_sdk/versions/client.py +112 -0
- label_studio_sdk/versions/types/__init__.py +6 -0
- label_studio_sdk/versions/types/versions_get_response.py +73 -0
- label_studio_sdk/versions/types/versions_get_response_edition.py +5 -0
- label_studio_sdk/views/client.py +219 -52
- label_studio_sdk/views/types/views_create_request_data.py +13 -23
- label_studio_sdk/views/types/views_create_request_data_filters.py +14 -24
- label_studio_sdk/views/types/views_create_request_data_filters_items_item.py +16 -26
- label_studio_sdk/views/types/views_create_request_data_filters_items_item_value.py +3 -1
- label_studio_sdk/views/types/views_update_request_data.py +13 -23
- label_studio_sdk/views/types/views_update_request_data_filters.py +14 -24
- label_studio_sdk/views/types/views_update_request_data_filters_items_item.py +16 -26
- label_studio_sdk/views/types/views_update_request_data_filters_items_item_value.py +3 -1
- label_studio_sdk/webhooks/client.py +191 -61
- label_studio_sdk/workspaces/client.py +164 -41
- label_studio_sdk/workspaces/members/client.py +109 -31
- label_studio_sdk/workspaces/members/types/members_create_response.py +12 -22
- label_studio_sdk/workspaces/members/types/members_list_response_item.py +12 -22
- {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.10.dist-info}/METADATA +7 -5
- {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.10.dist-info}/RECORD +197 -184
- {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.10.dist-info}/WHEEL +1 -1
- label_studio_sdk/types/export_convert.py +0 -32
- label_studio_sdk/types/export_create.py +0 -54
- label_studio_sdk/types/export_create_status.py +0 -5
- {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.10.dist-info}/LICENSE +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
+
from ...core.client_wrapper import SyncClientWrapper
|
|
3
4
|
import typing
|
|
5
|
+
from ...core.request_options import RequestOptions
|
|
6
|
+
from ...types.key_indicators import KeyIndicators
|
|
7
|
+
from ...core.jsonable_encoder import jsonable_encoder
|
|
8
|
+
from ...core.pydantic_utilities import parse_obj_as
|
|
4
9
|
from json.decoder import JSONDecodeError
|
|
5
|
-
|
|
6
10
|
from ...core.api_error import ApiError
|
|
7
|
-
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
8
|
-
from ...core.jsonable_encoder import jsonable_encoder
|
|
9
|
-
from ...core.pydantic_utilities import pydantic_v1
|
|
10
|
-
from ...core.request_options import RequestOptions
|
|
11
11
|
from ...types.key_indicator_value import KeyIndicatorValue
|
|
12
|
-
from ...
|
|
12
|
+
from ...core.client_wrapper import AsyncClientWrapper
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
class IndicatorsClient:
|
|
@@ -35,7 +35,7 @@ class IndicatorsClient:
|
|
|
35
35
|
|
|
36
36
|
Examples
|
|
37
37
|
--------
|
|
38
|
-
from label_studio_sdk
|
|
38
|
+
from label_studio_sdk import LabelStudio
|
|
39
39
|
|
|
40
40
|
client = LabelStudio(
|
|
41
41
|
api_key="YOUR_API_KEY",
|
|
@@ -45,11 +45,19 @@ class IndicatorsClient:
|
|
|
45
45
|
)
|
|
46
46
|
"""
|
|
47
47
|
_response = self._client_wrapper.httpx_client.request(
|
|
48
|
-
f"api/inference-runs/{jsonable_encoder(pk)}/indicators",
|
|
48
|
+
f"api/inference-runs/{jsonable_encoder(pk)}/indicators",
|
|
49
|
+
method="GET",
|
|
50
|
+
request_options=request_options,
|
|
49
51
|
)
|
|
50
52
|
try:
|
|
51
53
|
if 200 <= _response.status_code < 300:
|
|
52
|
-
return
|
|
54
|
+
return typing.cast(
|
|
55
|
+
KeyIndicators,
|
|
56
|
+
parse_obj_as(
|
|
57
|
+
type_=KeyIndicators, # type: ignore
|
|
58
|
+
object_=_response.json(),
|
|
59
|
+
),
|
|
60
|
+
)
|
|
53
61
|
_response_json = _response.json()
|
|
54
62
|
except JSONDecodeError:
|
|
55
63
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -79,7 +87,7 @@ class IndicatorsClient:
|
|
|
79
87
|
|
|
80
88
|
Examples
|
|
81
89
|
--------
|
|
82
|
-
from label_studio_sdk
|
|
90
|
+
from label_studio_sdk import LabelStudio
|
|
83
91
|
|
|
84
92
|
client = LabelStudio(
|
|
85
93
|
api_key="YOUR_API_KEY",
|
|
@@ -96,7 +104,13 @@ class IndicatorsClient:
|
|
|
96
104
|
)
|
|
97
105
|
try:
|
|
98
106
|
if 200 <= _response.status_code < 300:
|
|
99
|
-
return
|
|
107
|
+
return typing.cast(
|
|
108
|
+
KeyIndicatorValue,
|
|
109
|
+
parse_obj_as(
|
|
110
|
+
type_=KeyIndicatorValue, # type: ignore
|
|
111
|
+
object_=_response.json(),
|
|
112
|
+
),
|
|
113
|
+
)
|
|
100
114
|
_response_json = _response.json()
|
|
101
115
|
except JSONDecodeError:
|
|
102
116
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -126,21 +140,37 @@ class AsyncIndicatorsClient:
|
|
|
126
140
|
|
|
127
141
|
Examples
|
|
128
142
|
--------
|
|
129
|
-
|
|
143
|
+
import asyncio
|
|
144
|
+
|
|
145
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
130
146
|
|
|
131
147
|
client = AsyncLabelStudio(
|
|
132
148
|
api_key="YOUR_API_KEY",
|
|
133
149
|
)
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
)
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
async def main() -> None:
|
|
153
|
+
await client.prompts.indicators.list(
|
|
154
|
+
pk=1,
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
asyncio.run(main())
|
|
137
159
|
"""
|
|
138
160
|
_response = await self._client_wrapper.httpx_client.request(
|
|
139
|
-
f"api/inference-runs/{jsonable_encoder(pk)}/indicators",
|
|
161
|
+
f"api/inference-runs/{jsonable_encoder(pk)}/indicators",
|
|
162
|
+
method="GET",
|
|
163
|
+
request_options=request_options,
|
|
140
164
|
)
|
|
141
165
|
try:
|
|
142
166
|
if 200 <= _response.status_code < 300:
|
|
143
|
-
return
|
|
167
|
+
return typing.cast(
|
|
168
|
+
KeyIndicators,
|
|
169
|
+
parse_obj_as(
|
|
170
|
+
type_=KeyIndicators, # type: ignore
|
|
171
|
+
object_=_response.json(),
|
|
172
|
+
),
|
|
173
|
+
)
|
|
144
174
|
_response_json = _response.json()
|
|
145
175
|
except JSONDecodeError:
|
|
146
176
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -170,15 +200,23 @@ class AsyncIndicatorsClient:
|
|
|
170
200
|
|
|
171
201
|
Examples
|
|
172
202
|
--------
|
|
173
|
-
|
|
203
|
+
import asyncio
|
|
204
|
+
|
|
205
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
174
206
|
|
|
175
207
|
client = AsyncLabelStudio(
|
|
176
208
|
api_key="YOUR_API_KEY",
|
|
177
209
|
)
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
async def main() -> None:
|
|
213
|
+
await client.prompts.indicators.get(
|
|
214
|
+
indicator_key="indicator_key",
|
|
215
|
+
pk=1,
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
asyncio.run(main())
|
|
182
220
|
"""
|
|
183
221
|
_response = await self._client_wrapper.httpx_client.request(
|
|
184
222
|
f"api/inference-runs/{jsonable_encoder(pk)}/indicators/{jsonable_encoder(indicator_key)}",
|
|
@@ -187,7 +225,13 @@ class AsyncIndicatorsClient:
|
|
|
187
225
|
)
|
|
188
226
|
try:
|
|
189
227
|
if 200 <= _response.status_code < 300:
|
|
190
|
-
return
|
|
228
|
+
return typing.cast(
|
|
229
|
+
KeyIndicatorValue,
|
|
230
|
+
parse_obj_as(
|
|
231
|
+
type_=KeyIndicatorValue, # type: ignore
|
|
232
|
+
object_=_response.json(),
|
|
233
|
+
),
|
|
234
|
+
)
|
|
191
235
|
_response_json = _response.json()
|
|
192
236
|
except JSONDecodeError:
|
|
193
237
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
import datetime as dt
|
|
4
3
|
import typing
|
|
5
|
-
from
|
|
6
|
-
|
|
7
|
-
from ...core.api_error import ApiError
|
|
8
|
-
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
9
|
-
from ...core.jsonable_encoder import jsonable_encoder
|
|
10
|
-
from ...core.pydantic_utilities import pydantic_v1
|
|
4
|
+
from ...core.client_wrapper import SyncClientWrapper
|
|
5
|
+
from .types.runs_list_request_project_subset import RunsListRequestProjectSubset
|
|
11
6
|
from ...core.request_options import RequestOptions
|
|
12
7
|
from ...types.inference_run import InferenceRun
|
|
13
|
-
from ...
|
|
14
|
-
from ...
|
|
8
|
+
from ...core.jsonable_encoder import jsonable_encoder
|
|
9
|
+
from ...core.pydantic_utilities import parse_obj_as
|
|
10
|
+
from json.decoder import JSONDecodeError
|
|
11
|
+
from ...core.api_error import ApiError
|
|
15
12
|
from ...types.inference_run_project_subset import InferenceRunProjectSubset
|
|
13
|
+
from ...types.inference_run_organization import InferenceRunOrganization
|
|
14
|
+
from ...types.inference_run_created_by import InferenceRunCreatedBy
|
|
16
15
|
from ...types.inference_run_status import InferenceRunStatus
|
|
17
|
-
|
|
16
|
+
import datetime as dt
|
|
17
|
+
from ...core.serialization import convert_and_respect_annotation_metadata
|
|
18
|
+
from ...core.client_wrapper import AsyncClientWrapper
|
|
18
19
|
|
|
19
20
|
# this is used as the default value for optional parameters
|
|
20
21
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -60,7 +61,7 @@ class RunsClient:
|
|
|
60
61
|
|
|
61
62
|
Examples
|
|
62
63
|
--------
|
|
63
|
-
from label_studio_sdk
|
|
64
|
+
from label_studio_sdk import LabelStudio
|
|
64
65
|
|
|
65
66
|
client = LabelStudio(
|
|
66
67
|
api_key="YOUR_API_KEY",
|
|
@@ -75,12 +76,21 @@ class RunsClient:
|
|
|
75
76
|
_response = self._client_wrapper.httpx_client.request(
|
|
76
77
|
f"api/prompts/{jsonable_encoder(id)}/versions/{jsonable_encoder(version_id)}/inference-runs",
|
|
77
78
|
method="GET",
|
|
78
|
-
params={
|
|
79
|
+
params={
|
|
80
|
+
"project": project,
|
|
81
|
+
"project_subset": project_subset,
|
|
82
|
+
},
|
|
79
83
|
request_options=request_options,
|
|
80
84
|
)
|
|
81
85
|
try:
|
|
82
86
|
if 200 <= _response.status_code < 300:
|
|
83
|
-
return
|
|
87
|
+
return typing.cast(
|
|
88
|
+
InferenceRun,
|
|
89
|
+
parse_obj_as(
|
|
90
|
+
type_=InferenceRun, # type: ignore
|
|
91
|
+
object_=_response.json(),
|
|
92
|
+
),
|
|
93
|
+
)
|
|
84
94
|
_response_json = _response.json()
|
|
85
95
|
except JSONDecodeError:
|
|
86
96
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -94,7 +104,7 @@ class RunsClient:
|
|
|
94
104
|
project: int,
|
|
95
105
|
project_subset: InferenceRunProjectSubset,
|
|
96
106
|
organization: typing.Optional[InferenceRunOrganization] = OMIT,
|
|
97
|
-
model_version: typing.Optional[
|
|
107
|
+
model_version: typing.Optional[int] = OMIT,
|
|
98
108
|
created_by: typing.Optional[InferenceRunCreatedBy] = OMIT,
|
|
99
109
|
status: typing.Optional[InferenceRunStatus] = OMIT,
|
|
100
110
|
job_id: typing.Optional[str] = OMIT,
|
|
@@ -121,7 +131,7 @@ class RunsClient:
|
|
|
121
131
|
|
|
122
132
|
organization : typing.Optional[InferenceRunOrganization]
|
|
123
133
|
|
|
124
|
-
model_version : typing.Optional[
|
|
134
|
+
model_version : typing.Optional[int]
|
|
125
135
|
|
|
126
136
|
created_by : typing.Optional[InferenceRunCreatedBy]
|
|
127
137
|
|
|
@@ -147,7 +157,7 @@ class RunsClient:
|
|
|
147
157
|
|
|
148
158
|
Examples
|
|
149
159
|
--------
|
|
150
|
-
from label_studio_sdk
|
|
160
|
+
from label_studio_sdk import LabelStudio
|
|
151
161
|
|
|
152
162
|
client = LabelStudio(
|
|
153
163
|
api_key="YOUR_API_KEY",
|
|
@@ -163,10 +173,14 @@ class RunsClient:
|
|
|
163
173
|
f"api/prompts/{jsonable_encoder(id)}/versions/{jsonable_encoder(version_id)}/inference-runs",
|
|
164
174
|
method="POST",
|
|
165
175
|
json={
|
|
166
|
-
"organization":
|
|
176
|
+
"organization": convert_and_respect_annotation_metadata(
|
|
177
|
+
object_=organization, annotation=InferenceRunOrganization, direction="write"
|
|
178
|
+
),
|
|
167
179
|
"project": project,
|
|
168
180
|
"model_version": model_version,
|
|
169
|
-
"created_by":
|
|
181
|
+
"created_by": convert_and_respect_annotation_metadata(
|
|
182
|
+
object_=created_by, annotation=InferenceRunCreatedBy, direction="write"
|
|
183
|
+
),
|
|
170
184
|
"project_subset": project_subset,
|
|
171
185
|
"status": status,
|
|
172
186
|
"job_id": job_id,
|
|
@@ -180,7 +194,13 @@ class RunsClient:
|
|
|
180
194
|
)
|
|
181
195
|
try:
|
|
182
196
|
if 200 <= _response.status_code < 300:
|
|
183
|
-
return
|
|
197
|
+
return typing.cast(
|
|
198
|
+
InferenceRun,
|
|
199
|
+
parse_obj_as(
|
|
200
|
+
type_=InferenceRun, # type: ignore
|
|
201
|
+
object_=_response.json(),
|
|
202
|
+
),
|
|
203
|
+
)
|
|
184
204
|
_response_json = _response.json()
|
|
185
205
|
except JSONDecodeError:
|
|
186
206
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -227,27 +247,44 @@ class AsyncRunsClient:
|
|
|
227
247
|
|
|
228
248
|
Examples
|
|
229
249
|
--------
|
|
230
|
-
|
|
250
|
+
import asyncio
|
|
251
|
+
|
|
252
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
231
253
|
|
|
232
254
|
client = AsyncLabelStudio(
|
|
233
255
|
api_key="YOUR_API_KEY",
|
|
234
256
|
)
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
async def main() -> None:
|
|
260
|
+
await client.prompts.runs.list(
|
|
261
|
+
id=1,
|
|
262
|
+
version_id=1,
|
|
263
|
+
project=1,
|
|
264
|
+
project_subset="All",
|
|
265
|
+
)
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
asyncio.run(main())
|
|
241
269
|
"""
|
|
242
270
|
_response = await self._client_wrapper.httpx_client.request(
|
|
243
271
|
f"api/prompts/{jsonable_encoder(id)}/versions/{jsonable_encoder(version_id)}/inference-runs",
|
|
244
272
|
method="GET",
|
|
245
|
-
params={
|
|
273
|
+
params={
|
|
274
|
+
"project": project,
|
|
275
|
+
"project_subset": project_subset,
|
|
276
|
+
},
|
|
246
277
|
request_options=request_options,
|
|
247
278
|
)
|
|
248
279
|
try:
|
|
249
280
|
if 200 <= _response.status_code < 300:
|
|
250
|
-
return
|
|
281
|
+
return typing.cast(
|
|
282
|
+
InferenceRun,
|
|
283
|
+
parse_obj_as(
|
|
284
|
+
type_=InferenceRun, # type: ignore
|
|
285
|
+
object_=_response.json(),
|
|
286
|
+
),
|
|
287
|
+
)
|
|
251
288
|
_response_json = _response.json()
|
|
252
289
|
except JSONDecodeError:
|
|
253
290
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -261,7 +298,7 @@ class AsyncRunsClient:
|
|
|
261
298
|
project: int,
|
|
262
299
|
project_subset: InferenceRunProjectSubset,
|
|
263
300
|
organization: typing.Optional[InferenceRunOrganization] = OMIT,
|
|
264
|
-
model_version: typing.Optional[
|
|
301
|
+
model_version: typing.Optional[int] = OMIT,
|
|
265
302
|
created_by: typing.Optional[InferenceRunCreatedBy] = OMIT,
|
|
266
303
|
status: typing.Optional[InferenceRunStatus] = OMIT,
|
|
267
304
|
job_id: typing.Optional[str] = OMIT,
|
|
@@ -288,7 +325,7 @@ class AsyncRunsClient:
|
|
|
288
325
|
|
|
289
326
|
organization : typing.Optional[InferenceRunOrganization]
|
|
290
327
|
|
|
291
|
-
model_version : typing.Optional[
|
|
328
|
+
model_version : typing.Optional[int]
|
|
292
329
|
|
|
293
330
|
created_by : typing.Optional[InferenceRunCreatedBy]
|
|
294
331
|
|
|
@@ -314,26 +351,38 @@ class AsyncRunsClient:
|
|
|
314
351
|
|
|
315
352
|
Examples
|
|
316
353
|
--------
|
|
317
|
-
|
|
354
|
+
import asyncio
|
|
355
|
+
|
|
356
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
318
357
|
|
|
319
358
|
client = AsyncLabelStudio(
|
|
320
359
|
api_key="YOUR_API_KEY",
|
|
321
360
|
)
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
async def main() -> None:
|
|
364
|
+
await client.prompts.runs.create(
|
|
365
|
+
id=1,
|
|
366
|
+
version_id=1,
|
|
367
|
+
project=1,
|
|
368
|
+
project_subset="All",
|
|
369
|
+
)
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
asyncio.run(main())
|
|
328
373
|
"""
|
|
329
374
|
_response = await self._client_wrapper.httpx_client.request(
|
|
330
375
|
f"api/prompts/{jsonable_encoder(id)}/versions/{jsonable_encoder(version_id)}/inference-runs",
|
|
331
376
|
method="POST",
|
|
332
377
|
json={
|
|
333
|
-
"organization":
|
|
378
|
+
"organization": convert_and_respect_annotation_metadata(
|
|
379
|
+
object_=organization, annotation=InferenceRunOrganization, direction="write"
|
|
380
|
+
),
|
|
334
381
|
"project": project,
|
|
335
382
|
"model_version": model_version,
|
|
336
|
-
"created_by":
|
|
383
|
+
"created_by": convert_and_respect_annotation_metadata(
|
|
384
|
+
object_=created_by, annotation=InferenceRunCreatedBy, direction="write"
|
|
385
|
+
),
|
|
337
386
|
"project_subset": project_subset,
|
|
338
387
|
"status": status,
|
|
339
388
|
"job_id": job_id,
|
|
@@ -347,7 +396,13 @@ class AsyncRunsClient:
|
|
|
347
396
|
)
|
|
348
397
|
try:
|
|
349
398
|
if 200 <= _response.status_code < 300:
|
|
350
|
-
return
|
|
399
|
+
return typing.cast(
|
|
400
|
+
InferenceRun,
|
|
401
|
+
parse_obj_as(
|
|
402
|
+
type_=InferenceRun, # type: ignore
|
|
403
|
+
object_=_response.json(),
|
|
404
|
+
),
|
|
405
|
+
)
|
|
351
406
|
_response_json = _response.json()
|
|
352
407
|
except JSONDecodeError:
|
|
353
408
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
label_studio_sdk/prompts/types/prompts_batch_failed_predictions_request_failed_predictions_item.py
CHANGED
|
@@ -1,42 +1,32 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
from ...core.pydantic_utilities import UniversalBaseModel
|
|
4
4
|
import typing
|
|
5
|
+
import pydantic
|
|
6
|
+
from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
|
5
7
|
|
|
6
|
-
from ...core.datetime_utils import serialize_datetime
|
|
7
|
-
from ...core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
task_id: typing.Optional[int] = pydantic_v1.Field(default=None)
|
|
9
|
+
class PromptsBatchFailedPredictionsRequestFailedPredictionsItem(UniversalBaseModel):
|
|
10
|
+
task_id: typing.Optional[int] = pydantic.Field(default=None)
|
|
12
11
|
"""
|
|
13
12
|
Task ID to associate the prediction with
|
|
14
13
|
"""
|
|
15
14
|
|
|
16
|
-
error_type: typing.Optional[str] =
|
|
15
|
+
error_type: typing.Optional[str] = pydantic.Field(default=None)
|
|
17
16
|
"""
|
|
18
17
|
Type of error (e.g. "Timeout", "Rate Limit", etc)
|
|
19
18
|
"""
|
|
20
19
|
|
|
21
|
-
message: typing.Optional[str] =
|
|
20
|
+
message: typing.Optional[str] = pydantic.Field(default=None)
|
|
22
21
|
"""
|
|
23
22
|
Error message details
|
|
24
23
|
"""
|
|
25
24
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
|
|
31
|
-
kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
|
32
|
-
kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
|
|
33
|
-
|
|
34
|
-
return deep_union_pydantic_dicts(
|
|
35
|
-
super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
|
|
36
|
-
)
|
|
25
|
+
if IS_PYDANTIC_V2:
|
|
26
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
27
|
+
else:
|
|
37
28
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
json_encoders = {dt.datetime: serialize_datetime}
|
|
29
|
+
class Config:
|
|
30
|
+
frozen = True
|
|
31
|
+
smart_union = True
|
|
32
|
+
extra = pydantic.Extra.allow
|
|
@@ -1,29 +1,19 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
from ...core.pydantic_utilities import UniversalBaseModel
|
|
4
4
|
import typing
|
|
5
|
+
from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
|
6
|
+
import pydantic
|
|
5
7
|
|
|
6
|
-
from ...core.datetime_utils import serialize_datetime
|
|
7
|
-
from ...core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
class PromptsBatchFailedPredictionsResponse(pydantic_v1.BaseModel):
|
|
9
|
+
class PromptsBatchFailedPredictionsResponse(UniversalBaseModel):
|
|
11
10
|
detail: typing.Optional[str] = None
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
)
|
|
12
|
+
if IS_PYDANTIC_V2:
|
|
13
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
14
|
+
else:
|
|
24
15
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
json_encoders = {dt.datetime: serialize_datetime}
|
|
16
|
+
class Config:
|
|
17
|
+
frozen = True
|
|
18
|
+
smart_union = True
|
|
19
|
+
extra = pydantic.Extra.allow
|
|
@@ -1,62 +1,59 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
from ...core.pydantic_utilities import UniversalBaseModel
|
|
4
4
|
import typing
|
|
5
|
+
import pydantic
|
|
6
|
+
from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
|
5
7
|
|
|
6
|
-
from ...core.datetime_utils import serialize_datetime
|
|
7
|
-
from ...core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
task_id: typing.Optional[int] = pydantic_v1.Field(default=None)
|
|
9
|
+
class PromptsBatchPredictionsRequestResultsItem(UniversalBaseModel):
|
|
10
|
+
task_id: typing.Optional[int] = pydantic.Field(default=None)
|
|
12
11
|
"""
|
|
13
12
|
Task ID to associate the prediction with
|
|
14
13
|
"""
|
|
15
14
|
|
|
16
|
-
output: typing.Optional[typing.Dict[str, typing.Any]] =
|
|
15
|
+
output: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
|
|
17
16
|
"""
|
|
18
|
-
Prediction output that contains keys from labeling config. Each key must be a valid control tag name from the labeling config. For example, given the output:
|
|
17
|
+
Prediction output that contains keys from labeling config. Each key must be a valid control tag name from the labeling config. For example, given the output: ```json {"sentiment": "positive"} ``` it will be converted to the internal LS annotation format: ```json {
|
|
18
|
+
"value": {
|
|
19
|
+
"choices": ["positive"]
|
|
20
|
+
},
|
|
21
|
+
"from_name": "label",
|
|
22
|
+
"to_name": "",
|
|
23
|
+
...
|
|
24
|
+
} ```
|
|
19
25
|
"""
|
|
20
26
|
|
|
21
|
-
prompt_tokens: typing.Optional[int] =
|
|
27
|
+
prompt_tokens: typing.Optional[int] = pydantic.Field(default=None)
|
|
22
28
|
"""
|
|
23
29
|
Number of tokens in the prompt
|
|
24
30
|
"""
|
|
25
31
|
|
|
26
|
-
completion_tokens: typing.Optional[int] =
|
|
32
|
+
completion_tokens: typing.Optional[int] = pydantic.Field(default=None)
|
|
27
33
|
"""
|
|
28
34
|
Number of tokens in the completion
|
|
29
35
|
"""
|
|
30
36
|
|
|
31
|
-
prompt_cost_usd: typing.Optional[float] =
|
|
37
|
+
prompt_cost_usd: typing.Optional[float] = pydantic.Field(default=None)
|
|
32
38
|
"""
|
|
33
39
|
Cost of the prompt (in USD)
|
|
34
40
|
"""
|
|
35
41
|
|
|
36
|
-
completion_cost_usd: typing.Optional[float] =
|
|
42
|
+
completion_cost_usd: typing.Optional[float] = pydantic.Field(default=None)
|
|
37
43
|
"""
|
|
38
44
|
Cost of the completion (in USD)
|
|
39
45
|
"""
|
|
40
46
|
|
|
41
|
-
total_cost_usd: typing.Optional[float] =
|
|
47
|
+
total_cost_usd: typing.Optional[float] = pydantic.Field(default=None)
|
|
42
48
|
"""
|
|
43
49
|
Total cost of the inference (in USD)
|
|
44
50
|
"""
|
|
45
51
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
|
|
51
|
-
kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
|
52
|
-
kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
|
|
53
|
-
|
|
54
|
-
return deep_union_pydantic_dicts(
|
|
55
|
-
super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
|
|
56
|
-
)
|
|
52
|
+
if IS_PYDANTIC_V2:
|
|
53
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
54
|
+
else:
|
|
57
55
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
json_encoders = {dt.datetime: serialize_datetime}
|
|
56
|
+
class Config:
|
|
57
|
+
frozen = True
|
|
58
|
+
smart_union = True
|
|
59
|
+
extra = pydantic.Extra.allow
|
|
@@ -1,29 +1,19 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
from ...core.pydantic_utilities import UniversalBaseModel
|
|
4
4
|
import typing
|
|
5
|
+
from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
|
6
|
+
import pydantic
|
|
5
7
|
|
|
6
|
-
from ...core.datetime_utils import serialize_datetime
|
|
7
|
-
from ...core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
class PromptsBatchPredictionsResponse(pydantic_v1.BaseModel):
|
|
9
|
+
class PromptsBatchPredictionsResponse(UniversalBaseModel):
|
|
11
10
|
detail: typing.Optional[str] = None
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
)
|
|
12
|
+
if IS_PYDANTIC_V2:
|
|
13
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
14
|
+
else:
|
|
24
15
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
json_encoders = {dt.datetime: serialize_datetime}
|
|
16
|
+
class Config:
|
|
17
|
+
frozen = True
|
|
18
|
+
smart_union = True
|
|
19
|
+
extra = pydantic.Extra.allow
|