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.

Files changed (200) hide show
  1. label_studio_sdk/__init__.py +20 -7
  2. label_studio_sdk/_extensions/label_studio_tools/core/utils/io.py +16 -4
  3. label_studio_sdk/_extensions/pager_ext.py +8 -0
  4. label_studio_sdk/actions/client.py +91 -40
  5. label_studio_sdk/actions/types/actions_create_request_filters.py +14 -24
  6. label_studio_sdk/actions/types/actions_create_request_filters_items_item.py +16 -26
  7. label_studio_sdk/actions/types/actions_create_request_filters_items_item_value.py +3 -1
  8. label_studio_sdk/actions/types/actions_create_request_selected_items.py +1 -2
  9. label_studio_sdk/actions/types/actions_create_request_selected_items_excluded.py +15 -25
  10. label_studio_sdk/actions/types/actions_create_request_selected_items_included.py +15 -25
  11. label_studio_sdk/annotations/__init__.py +2 -2
  12. label_studio_sdk/annotations/client.py +278 -104
  13. label_studio_sdk/annotations/types/__init__.py +2 -1
  14. label_studio_sdk/annotations/types/annotations_create_bulk_request_selected_items.py +34 -0
  15. label_studio_sdk/annotations/types/annotations_create_bulk_response_item.py +11 -21
  16. label_studio_sdk/base_client.py +46 -27
  17. label_studio_sdk/client.py +1 -0
  18. label_studio_sdk/comments/client.py +190 -44
  19. label_studio_sdk/converter/converter.py +56 -13
  20. label_studio_sdk/converter/imports/yolo.py +1 -1
  21. label_studio_sdk/converter/utils.py +3 -2
  22. label_studio_sdk/core/__init__.py +21 -4
  23. label_studio_sdk/core/client_wrapper.py +9 -10
  24. label_studio_sdk/core/file.py +37 -8
  25. label_studio_sdk/core/http_client.py +52 -28
  26. label_studio_sdk/core/jsonable_encoder.py +33 -31
  27. label_studio_sdk/core/pagination.py +5 -4
  28. label_studio_sdk/core/pydantic_utilities.py +272 -4
  29. label_studio_sdk/core/query_encoder.py +38 -13
  30. label_studio_sdk/core/request_options.py +3 -0
  31. label_studio_sdk/core/serialization.py +272 -0
  32. label_studio_sdk/errors/bad_request_error.py +2 -3
  33. label_studio_sdk/export_storage/azure/client.py +228 -58
  34. label_studio_sdk/export_storage/azure/types/azure_create_response.py +19 -29
  35. label_studio_sdk/export_storage/azure/types/azure_update_response.py +19 -29
  36. label_studio_sdk/export_storage/client.py +48 -18
  37. label_studio_sdk/export_storage/gcs/client.py +228 -58
  38. label_studio_sdk/export_storage/gcs/types/gcs_create_response.py +19 -29
  39. label_studio_sdk/export_storage/gcs/types/gcs_update_response.py +19 -29
  40. label_studio_sdk/export_storage/local/client.py +222 -56
  41. label_studio_sdk/export_storage/local/types/local_create_response.py +17 -27
  42. label_studio_sdk/export_storage/local/types/local_update_response.py +17 -27
  43. label_studio_sdk/export_storage/redis/client.py +228 -58
  44. label_studio_sdk/export_storage/redis/types/redis_create_response.py +20 -30
  45. label_studio_sdk/export_storage/redis/types/redis_update_response.py +20 -30
  46. label_studio_sdk/export_storage/s3/client.py +228 -58
  47. label_studio_sdk/export_storage/s3/types/s3create_response.py +27 -35
  48. label_studio_sdk/export_storage/s3/types/s3update_response.py +27 -35
  49. label_studio_sdk/export_storage/s3s/client.py +187 -43
  50. label_studio_sdk/export_storage/types/export_storage_list_types_response_item.py +11 -21
  51. label_studio_sdk/files/client.py +172 -56
  52. label_studio_sdk/import_storage/azure/client.py +223 -53
  53. label_studio_sdk/import_storage/azure/types/azure_create_response.py +22 -32
  54. label_studio_sdk/import_storage/azure/types/azure_update_response.py +22 -32
  55. label_studio_sdk/import_storage/client.py +48 -18
  56. label_studio_sdk/import_storage/gcs/client.py +223 -53
  57. label_studio_sdk/import_storage/gcs/types/gcs_create_response.py +22 -32
  58. label_studio_sdk/import_storage/gcs/types/gcs_update_response.py +22 -32
  59. label_studio_sdk/import_storage/local/client.py +223 -53
  60. label_studio_sdk/import_storage/local/types/local_create_response.py +17 -27
  61. label_studio_sdk/import_storage/local/types/local_update_response.py +17 -27
  62. label_studio_sdk/import_storage/redis/client.py +223 -53
  63. label_studio_sdk/import_storage/redis/types/redis_create_response.py +20 -30
  64. label_studio_sdk/import_storage/redis/types/redis_update_response.py +20 -30
  65. label_studio_sdk/import_storage/s3/client.py +223 -53
  66. label_studio_sdk/import_storage/s3/types/s3create_response.py +31 -39
  67. label_studio_sdk/import_storage/s3/types/s3update_response.py +31 -39
  68. label_studio_sdk/import_storage/s3s/client.py +222 -52
  69. label_studio_sdk/import_storage/types/import_storage_list_types_response_item.py +11 -21
  70. label_studio_sdk/label_interface/control_tags.py +1 -1
  71. label_studio_sdk/ml/client.py +280 -78
  72. label_studio_sdk/ml/types/ml_create_response.py +21 -31
  73. label_studio_sdk/ml/types/ml_update_response.py +21 -31
  74. label_studio_sdk/model_providers/client.py +173 -56
  75. label_studio_sdk/predictions/client.py +247 -101
  76. label_studio_sdk/projects/__init__.py +3 -0
  77. label_studio_sdk/projects/client.py +309 -115
  78. label_studio_sdk/projects/client_ext.py +16 -0
  79. label_studio_sdk/projects/exports/__init__.py +3 -0
  80. label_studio_sdk/projects/exports/client.py +447 -296
  81. label_studio_sdk/projects/exports/client_ext.py +134 -0
  82. label_studio_sdk/projects/exports/types/__init__.py +6 -0
  83. label_studio_sdk/projects/exports/types/exports_convert_response.py +24 -0
  84. label_studio_sdk/projects/exports/types/exports_list_formats_response_item.py +44 -0
  85. label_studio_sdk/projects/types/projects_create_response.py +29 -34
  86. label_studio_sdk/projects/types/projects_import_tasks_response.py +19 -29
  87. label_studio_sdk/projects/types/projects_list_response.py +11 -21
  88. label_studio_sdk/projects/types/projects_update_response.py +24 -34
  89. label_studio_sdk/prompts/client.py +309 -92
  90. label_studio_sdk/prompts/indicators/client.py +67 -23
  91. label_studio_sdk/prompts/runs/client.py +95 -40
  92. label_studio_sdk/prompts/types/prompts_batch_failed_predictions_request_failed_predictions_item.py +14 -24
  93. label_studio_sdk/prompts/types/prompts_batch_failed_predictions_response.py +11 -21
  94. label_studio_sdk/prompts/types/prompts_batch_predictions_request_results_item.py +26 -29
  95. label_studio_sdk/prompts/types/prompts_batch_predictions_response.py +11 -21
  96. label_studio_sdk/prompts/versions/client.py +277 -88
  97. label_studio_sdk/tasks/client.py +263 -90
  98. label_studio_sdk/tasks/types/tasks_list_response.py +15 -25
  99. label_studio_sdk/types/__init__.py +10 -6
  100. label_studio_sdk/types/annotation.py +29 -38
  101. label_studio_sdk/types/annotation_filter_options.py +14 -24
  102. label_studio_sdk/types/annotations_dm_field.py +30 -39
  103. label_studio_sdk/types/azure_blob_export_storage.py +28 -37
  104. label_studio_sdk/types/azure_blob_import_storage.py +28 -37
  105. label_studio_sdk/types/base_task.py +30 -39
  106. label_studio_sdk/types/base_task_updated_by.py +3 -1
  107. label_studio_sdk/types/base_user.py +14 -21
  108. label_studio_sdk/types/comment.py +12 -21
  109. label_studio_sdk/types/comment_created_by.py +1 -1
  110. label_studio_sdk/types/converted_format.py +12 -22
  111. label_studio_sdk/types/data_manager_task_serializer.py +31 -40
  112. label_studio_sdk/types/data_manager_task_serializer_annotators_item.py +1 -1
  113. label_studio_sdk/types/data_manager_task_serializer_drafts_item.py +13 -22
  114. label_studio_sdk/types/data_manager_task_serializer_predictions_item.py +15 -24
  115. label_studio_sdk/types/export.py +17 -26
  116. label_studio_sdk/types/export_format.py +25 -0
  117. label_studio_sdk/types/export_snapshot.py +45 -0
  118. label_studio_sdk/types/export_snapshot_status.py +5 -0
  119. label_studio_sdk/types/file_upload.py +11 -21
  120. label_studio_sdk/types/filter.py +16 -26
  121. label_studio_sdk/types/filter_group.py +12 -22
  122. label_studio_sdk/types/gcs_export_storage.py +28 -37
  123. label_studio_sdk/types/gcs_import_storage.py +28 -37
  124. label_studio_sdk/types/inference_run.py +14 -23
  125. label_studio_sdk/types/inference_run_cost_estimate.py +17 -27
  126. label_studio_sdk/types/inference_run_created_by.py +1 -1
  127. label_studio_sdk/types/inference_run_organization.py +1 -1
  128. label_studio_sdk/types/key_indicator_value.py +12 -22
  129. label_studio_sdk/types/key_indicators.py +0 -1
  130. label_studio_sdk/types/key_indicators_item.py +15 -25
  131. label_studio_sdk/types/key_indicators_item_additional_kpis_item.py +13 -23
  132. label_studio_sdk/types/key_indicators_item_extra_kpis_item.py +13 -23
  133. label_studio_sdk/types/local_files_export_storage.py +25 -34
  134. label_studio_sdk/types/local_files_import_storage.py +24 -33
  135. label_studio_sdk/types/ml_backend.py +23 -32
  136. label_studio_sdk/types/model_provider_connection.py +22 -31
  137. label_studio_sdk/types/model_provider_connection_created_by.py +1 -1
  138. label_studio_sdk/types/model_provider_connection_organization.py +1 -1
  139. label_studio_sdk/types/model_provider_connection_provider.py +3 -1
  140. label_studio_sdk/types/prediction.py +21 -30
  141. label_studio_sdk/types/project.py +48 -55
  142. label_studio_sdk/types/project_import.py +21 -30
  143. label_studio_sdk/types/project_label_config.py +12 -22
  144. label_studio_sdk/types/prompt.py +24 -32
  145. label_studio_sdk/types/prompt_associated_projects_item.py +6 -0
  146. label_studio_sdk/types/prompt_associated_projects_item_id.py +20 -0
  147. label_studio_sdk/types/prompt_created_by.py +1 -1
  148. label_studio_sdk/types/prompt_organization.py +1 -1
  149. label_studio_sdk/types/prompt_version.py +13 -22
  150. label_studio_sdk/types/prompt_version_created_by.py +1 -1
  151. label_studio_sdk/types/prompt_version_organization.py +1 -1
  152. label_studio_sdk/types/prompt_version_provider.py +3 -1
  153. label_studio_sdk/types/redis_export_storage.py +29 -38
  154. label_studio_sdk/types/redis_import_storage.py +28 -37
  155. label_studio_sdk/types/refined_prompt_response.py +19 -29
  156. label_studio_sdk/types/s3export_storage.py +36 -43
  157. label_studio_sdk/types/s3import_storage.py +37 -44
  158. label_studio_sdk/types/s3s_export_storage.py +26 -33
  159. label_studio_sdk/types/s3s_import_storage.py +35 -42
  160. label_studio_sdk/types/serialization_option.py +12 -22
  161. label_studio_sdk/types/serialization_options.py +18 -28
  162. label_studio_sdk/types/task.py +44 -47
  163. label_studio_sdk/types/task_annotators_item.py +1 -1
  164. label_studio_sdk/types/task_comment_authors_item.py +1 -1
  165. label_studio_sdk/types/task_filter_options.py +15 -25
  166. label_studio_sdk/types/user_simple.py +11 -21
  167. label_studio_sdk/types/view.py +16 -26
  168. label_studio_sdk/types/webhook.py +19 -28
  169. label_studio_sdk/types/webhook_serializer_for_update.py +19 -28
  170. label_studio_sdk/types/workspace.py +22 -31
  171. label_studio_sdk/users/client.py +257 -63
  172. label_studio_sdk/users/types/users_get_token_response.py +12 -22
  173. label_studio_sdk/users/types/users_reset_token_response.py +12 -22
  174. label_studio_sdk/version.py +0 -1
  175. label_studio_sdk/versions/__init__.py +5 -0
  176. label_studio_sdk/versions/client.py +112 -0
  177. label_studio_sdk/versions/types/__init__.py +6 -0
  178. label_studio_sdk/versions/types/versions_get_response.py +73 -0
  179. label_studio_sdk/versions/types/versions_get_response_edition.py +5 -0
  180. label_studio_sdk/views/client.py +219 -52
  181. label_studio_sdk/views/types/views_create_request_data.py +13 -23
  182. label_studio_sdk/views/types/views_create_request_data_filters.py +14 -24
  183. label_studio_sdk/views/types/views_create_request_data_filters_items_item.py +16 -26
  184. label_studio_sdk/views/types/views_create_request_data_filters_items_item_value.py +3 -1
  185. label_studio_sdk/views/types/views_update_request_data.py +13 -23
  186. label_studio_sdk/views/types/views_update_request_data_filters.py +14 -24
  187. label_studio_sdk/views/types/views_update_request_data_filters_items_item.py +16 -26
  188. label_studio_sdk/views/types/views_update_request_data_filters_items_item_value.py +3 -1
  189. label_studio_sdk/webhooks/client.py +191 -61
  190. label_studio_sdk/workspaces/client.py +164 -41
  191. label_studio_sdk/workspaces/members/client.py +109 -31
  192. label_studio_sdk/workspaces/members/types/members_create_response.py +12 -22
  193. label_studio_sdk/workspaces/members/types/members_list_response_item.py +12 -22
  194. {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.10.dist-info}/METADATA +7 -5
  195. {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.10.dist-info}/RECORD +197 -184
  196. {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.10.dist-info}/WHEEL +1 -1
  197. label_studio_sdk/types/export_convert.py +0 -32
  198. label_studio_sdk/types/export_create.py +0 -54
  199. label_studio_sdk/types/export_create_status.py +0 -5
  200. {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.10.dist-info}/LICENSE +0 -0
@@ -1,26 +1,31 @@
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 json.decoder import JSONDecodeError
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 .versions.client import VersionsClient
6
+ from .runs.client import RunsClient
7
+ from .indicators.client import IndicatorsClient
11
8
  from ..core.request_options import RequestOptions
12
9
  from ..types.prompt import Prompt
10
+ from ..core.pydantic_utilities import parse_obj_as
11
+ from json.decoder import JSONDecodeError
12
+ from ..core.api_error import ApiError
13
13
  from ..types.prompt_created_by import PromptCreatedBy
14
+ import datetime as dt
14
15
  from ..types.prompt_organization import PromptOrganization
15
- from .indicators.client import AsyncIndicatorsClient, IndicatorsClient
16
- from .runs.client import AsyncRunsClient, RunsClient
16
+ from ..types.prompt_associated_projects_item import PromptAssociatedProjectsItem
17
+ from ..core.serialization import convert_and_respect_annotation_metadata
18
+ from ..core.jsonable_encoder import jsonable_encoder
19
+ from .types.prompts_batch_predictions_request_results_item import PromptsBatchPredictionsRequestResultsItem
20
+ from .types.prompts_batch_predictions_response import PromptsBatchPredictionsResponse
17
21
  from .types.prompts_batch_failed_predictions_request_failed_predictions_item import (
18
22
  PromptsBatchFailedPredictionsRequestFailedPredictionsItem,
19
23
  )
20
24
  from .types.prompts_batch_failed_predictions_response import PromptsBatchFailedPredictionsResponse
21
- from .types.prompts_batch_predictions_request_results_item import PromptsBatchPredictionsRequestResultsItem
22
- from .types.prompts_batch_predictions_response import PromptsBatchPredictionsResponse
23
- from .versions.client import AsyncVersionsClient, VersionsClient
25
+ from ..core.client_wrapper import AsyncClientWrapper
26
+ from .versions.client import AsyncVersionsClient
27
+ from .runs.client import AsyncRunsClient
28
+ from .indicators.client import AsyncIndicatorsClient
24
29
 
25
30
  # this is used as the default value for optional parameters
26
31
  OMIT = typing.cast(typing.Any, ...)
@@ -49,7 +54,7 @@ class PromptsClient:
49
54
 
50
55
  Examples
51
56
  --------
52
- from label_studio_sdk.client import LabelStudio
57
+ from label_studio_sdk import LabelStudio
53
58
 
54
59
  client = LabelStudio(
55
60
  api_key="YOUR_API_KEY",
@@ -57,11 +62,19 @@ class PromptsClient:
57
62
  client.prompts.list()
58
63
  """
59
64
  _response = self._client_wrapper.httpx_client.request(
60
- "api/prompts/", method="GET", request_options=request_options
65
+ "api/prompts/",
66
+ method="GET",
67
+ request_options=request_options,
61
68
  )
62
69
  try:
63
70
  if 200 <= _response.status_code < 300:
64
- return pydantic_v1.parse_obj_as(typing.List[Prompt], _response.json()) # type: ignore
71
+ return typing.cast(
72
+ typing.List[Prompt],
73
+ parse_obj_as(
74
+ type_=typing.List[Prompt], # type: ignore
75
+ object_=_response.json(),
76
+ ),
77
+ )
65
78
  _response_json = _response.json()
66
79
  except JSONDecodeError:
67
80
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -78,7 +91,7 @@ class PromptsClient:
78
91
  created_at: typing.Optional[dt.datetime] = OMIT,
79
92
  updated_at: typing.Optional[dt.datetime] = OMIT,
80
93
  organization: typing.Optional[PromptOrganization] = OMIT,
81
- associated_projects: typing.Optional[typing.Sequence[int]] = OMIT,
94
+ associated_projects: typing.Optional[typing.Sequence[PromptAssociatedProjectsItem]] = OMIT,
82
95
  skill_name: typing.Optional[str] = OMIT,
83
96
  request_options: typing.Optional[RequestOptions] = None,
84
97
  ) -> Prompt:
@@ -111,8 +124,8 @@ class PromptsClient:
111
124
  organization : typing.Optional[PromptOrganization]
112
125
  Organization ID of the prompt
113
126
 
114
- associated_projects : typing.Optional[typing.Sequence[int]]
115
- List of associated projects IDs
127
+ associated_projects : typing.Optional[typing.Sequence[PromptAssociatedProjectsItem]]
128
+ List of associated projects IDs or objects
116
129
 
117
130
  skill_name : typing.Optional[str]
118
131
  Name of the skill
@@ -127,7 +140,7 @@ class PromptsClient:
127
140
 
128
141
  Examples
129
142
  --------
130
- from label_studio_sdk.client import LabelStudio
143
+ from label_studio_sdk import LabelStudio
131
144
 
132
145
  client = LabelStudio(
133
146
  api_key="YOUR_API_KEY",
@@ -144,13 +157,21 @@ class PromptsClient:
144
157
  json={
145
158
  "title": title,
146
159
  "description": description,
147
- "created_by": created_by,
160
+ "created_by": convert_and_respect_annotation_metadata(
161
+ object_=created_by, annotation=PromptCreatedBy, direction="write"
162
+ ),
148
163
  "created_at": created_at,
149
164
  "updated_at": updated_at,
150
- "organization": organization,
165
+ "organization": convert_and_respect_annotation_metadata(
166
+ object_=organization, annotation=PromptOrganization, direction="write"
167
+ ),
151
168
  "input_fields": input_fields,
152
169
  "output_classes": output_classes,
153
- "associated_projects": associated_projects,
170
+ "associated_projects": convert_and_respect_annotation_metadata(
171
+ object_=associated_projects,
172
+ annotation=typing.Sequence[PromptAssociatedProjectsItem],
173
+ direction="write",
174
+ ),
154
175
  "skill_name": skill_name,
155
176
  },
156
177
  request_options=request_options,
@@ -158,7 +179,13 @@ class PromptsClient:
158
179
  )
159
180
  try:
160
181
  if 200 <= _response.status_code < 300:
161
- return pydantic_v1.parse_obj_as(Prompt, _response.json()) # type: ignore
182
+ return typing.cast(
183
+ Prompt,
184
+ parse_obj_as(
185
+ type_=Prompt, # type: ignore
186
+ object_=_response.json(),
187
+ ),
188
+ )
162
189
  _response_json = _response.json()
163
190
  except JSONDecodeError:
164
191
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -183,7 +210,7 @@ class PromptsClient:
183
210
 
184
211
  Examples
185
212
  --------
186
- from label_studio_sdk.client import LabelStudio
213
+ from label_studio_sdk import LabelStudio
187
214
 
188
215
  client = LabelStudio(
189
216
  api_key="YOUR_API_KEY",
@@ -193,11 +220,19 @@ class PromptsClient:
193
220
  )
194
221
  """
195
222
  _response = self._client_wrapper.httpx_client.request(
196
- f"api/prompts/{jsonable_encoder(id)}", method="GET", request_options=request_options
223
+ f"api/prompts/{jsonable_encoder(id)}",
224
+ method="GET",
225
+ request_options=request_options,
197
226
  )
198
227
  try:
199
228
  if 200 <= _response.status_code < 300:
200
- return pydantic_v1.parse_obj_as(Prompt, _response.json()) # type: ignore
229
+ return typing.cast(
230
+ Prompt,
231
+ parse_obj_as(
232
+ type_=Prompt, # type: ignore
233
+ object_=_response.json(),
234
+ ),
235
+ )
201
236
  _response_json = _response.json()
202
237
  except JSONDecodeError:
203
238
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -221,7 +256,7 @@ class PromptsClient:
221
256
 
222
257
  Examples
223
258
  --------
224
- from label_studio_sdk.client import LabelStudio
259
+ from label_studio_sdk import LabelStudio
225
260
 
226
261
  client = LabelStudio(
227
262
  api_key="YOUR_API_KEY",
@@ -231,7 +266,9 @@ class PromptsClient:
231
266
  )
232
267
  """
233
268
  _response = self._client_wrapper.httpx_client.request(
234
- f"api/prompts/{jsonable_encoder(id)}", method="DELETE", request_options=request_options
269
+ f"api/prompts/{jsonable_encoder(id)}",
270
+ method="DELETE",
271
+ request_options=request_options,
235
272
  )
236
273
  try:
237
274
  if 200 <= _response.status_code < 300:
@@ -253,7 +290,7 @@ class PromptsClient:
253
290
  created_at: typing.Optional[dt.datetime] = OMIT,
254
291
  updated_at: typing.Optional[dt.datetime] = OMIT,
255
292
  organization: typing.Optional[PromptOrganization] = OMIT,
256
- associated_projects: typing.Optional[typing.Sequence[int]] = OMIT,
293
+ associated_projects: typing.Optional[typing.Sequence[PromptAssociatedProjectsItem]] = OMIT,
257
294
  skill_name: typing.Optional[str] = OMIT,
258
295
  request_options: typing.Optional[RequestOptions] = None,
259
296
  ) -> Prompt:
@@ -289,8 +326,8 @@ class PromptsClient:
289
326
  organization : typing.Optional[PromptOrganization]
290
327
  Organization ID of the prompt
291
328
 
292
- associated_projects : typing.Optional[typing.Sequence[int]]
293
- List of associated projects IDs
329
+ associated_projects : typing.Optional[typing.Sequence[PromptAssociatedProjectsItem]]
330
+ List of associated projects IDs or objects
294
331
 
295
332
  skill_name : typing.Optional[str]
296
333
  Name of the skill
@@ -305,7 +342,7 @@ class PromptsClient:
305
342
 
306
343
  Examples
307
344
  --------
308
- from label_studio_sdk.client import LabelStudio
345
+ from label_studio_sdk import LabelStudio
309
346
 
310
347
  client = LabelStudio(
311
348
  api_key="YOUR_API_KEY",
@@ -323,13 +360,21 @@ class PromptsClient:
323
360
  json={
324
361
  "title": title,
325
362
  "description": description,
326
- "created_by": created_by,
363
+ "created_by": convert_and_respect_annotation_metadata(
364
+ object_=created_by, annotation=PromptCreatedBy, direction="write"
365
+ ),
327
366
  "created_at": created_at,
328
367
  "updated_at": updated_at,
329
- "organization": organization,
368
+ "organization": convert_and_respect_annotation_metadata(
369
+ object_=organization, annotation=PromptOrganization, direction="write"
370
+ ),
330
371
  "input_fields": input_fields,
331
372
  "output_classes": output_classes,
332
- "associated_projects": associated_projects,
373
+ "associated_projects": convert_and_respect_annotation_metadata(
374
+ object_=associated_projects,
375
+ annotation=typing.Sequence[PromptAssociatedProjectsItem],
376
+ direction="write",
377
+ ),
333
378
  "skill_name": skill_name,
334
379
  },
335
380
  request_options=request_options,
@@ -337,7 +382,13 @@ class PromptsClient:
337
382
  )
338
383
  try:
339
384
  if 200 <= _response.status_code < 300:
340
- return pydantic_v1.parse_obj_as(Prompt, _response.json()) # type: ignore
385
+ return typing.cast(
386
+ Prompt,
387
+ parse_obj_as(
388
+ type_=Prompt, # type: ignore
389
+ object_=_response.json(),
390
+ ),
391
+ )
341
392
  _response_json = _response.json()
342
393
  except JSONDecodeError:
343
394
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -370,7 +421,7 @@ class PromptsClient:
370
421
 
371
422
  Examples
372
423
  --------
373
- from label_studio_sdk.client import LabelStudio
424
+ from label_studio_sdk import LabelStudio
374
425
 
375
426
  client = LabelStudio(
376
427
  api_key="YOUR_API_KEY",
@@ -380,13 +431,29 @@ class PromptsClient:
380
431
  _response = self._client_wrapper.httpx_client.request(
381
432
  "api/model-run/batch-predictions",
382
433
  method="POST",
383
- json={"modelrun_id": modelrun_id, "results": results},
434
+ json={
435
+ "modelrun_id": modelrun_id,
436
+ "results": convert_and_respect_annotation_metadata(
437
+ object_=results,
438
+ annotation=typing.Sequence[PromptsBatchPredictionsRequestResultsItem],
439
+ direction="write",
440
+ ),
441
+ },
442
+ headers={
443
+ "content-type": "application/json",
444
+ },
384
445
  request_options=request_options,
385
446
  omit=OMIT,
386
447
  )
387
448
  try:
388
449
  if 200 <= _response.status_code < 300:
389
- return pydantic_v1.parse_obj_as(PromptsBatchPredictionsResponse, _response.json()) # type: ignore
450
+ return typing.cast(
451
+ PromptsBatchPredictionsResponse,
452
+ parse_obj_as(
453
+ type_=PromptsBatchPredictionsResponse, # type: ignore
454
+ object_=_response.json(),
455
+ ),
456
+ )
390
457
  _response_json = _response.json()
391
458
  except JSONDecodeError:
392
459
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -421,7 +488,7 @@ class PromptsClient:
421
488
 
422
489
  Examples
423
490
  --------
424
- from label_studio_sdk.client import LabelStudio
491
+ from label_studio_sdk import LabelStudio
425
492
 
426
493
  client = LabelStudio(
427
494
  api_key="YOUR_API_KEY",
@@ -431,13 +498,29 @@ class PromptsClient:
431
498
  _response = self._client_wrapper.httpx_client.request(
432
499
  "api/model-run/batch-failed-predictions",
433
500
  method="POST",
434
- json={"modelrun_id": modelrun_id, "failed_predictions": failed_predictions},
501
+ json={
502
+ "modelrun_id": modelrun_id,
503
+ "failed_predictions": convert_and_respect_annotation_metadata(
504
+ object_=failed_predictions,
505
+ annotation=typing.Sequence[PromptsBatchFailedPredictionsRequestFailedPredictionsItem],
506
+ direction="write",
507
+ ),
508
+ },
509
+ headers={
510
+ "content-type": "application/json",
511
+ },
435
512
  request_options=request_options,
436
513
  omit=OMIT,
437
514
  )
438
515
  try:
439
516
  if 200 <= _response.status_code < 300:
440
- return pydantic_v1.parse_obj_as(PromptsBatchFailedPredictionsResponse, _response.json()) # type: ignore
517
+ return typing.cast(
518
+ PromptsBatchFailedPredictionsResponse,
519
+ parse_obj_as(
520
+ type_=PromptsBatchFailedPredictionsResponse, # type: ignore
521
+ object_=_response.json(),
522
+ ),
523
+ )
441
524
  _response_json = _response.json()
442
525
  except JSONDecodeError:
443
526
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -467,19 +550,35 @@ class AsyncPromptsClient:
467
550
 
468
551
  Examples
469
552
  --------
470
- from label_studio_sdk.client import AsyncLabelStudio
553
+ import asyncio
554
+
555
+ from label_studio_sdk import AsyncLabelStudio
471
556
 
472
557
  client = AsyncLabelStudio(
473
558
  api_key="YOUR_API_KEY",
474
559
  )
475
- await client.prompts.list()
560
+
561
+
562
+ async def main() -> None:
563
+ await client.prompts.list()
564
+
565
+
566
+ asyncio.run(main())
476
567
  """
477
568
  _response = await self._client_wrapper.httpx_client.request(
478
- "api/prompts/", method="GET", request_options=request_options
569
+ "api/prompts/",
570
+ method="GET",
571
+ request_options=request_options,
479
572
  )
480
573
  try:
481
574
  if 200 <= _response.status_code < 300:
482
- return pydantic_v1.parse_obj_as(typing.List[Prompt], _response.json()) # type: ignore
575
+ return typing.cast(
576
+ typing.List[Prompt],
577
+ parse_obj_as(
578
+ type_=typing.List[Prompt], # type: ignore
579
+ object_=_response.json(),
580
+ ),
581
+ )
483
582
  _response_json = _response.json()
484
583
  except JSONDecodeError:
485
584
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -496,7 +595,7 @@ class AsyncPromptsClient:
496
595
  created_at: typing.Optional[dt.datetime] = OMIT,
497
596
  updated_at: typing.Optional[dt.datetime] = OMIT,
498
597
  organization: typing.Optional[PromptOrganization] = OMIT,
499
- associated_projects: typing.Optional[typing.Sequence[int]] = OMIT,
598
+ associated_projects: typing.Optional[typing.Sequence[PromptAssociatedProjectsItem]] = OMIT,
500
599
  skill_name: typing.Optional[str] = OMIT,
501
600
  request_options: typing.Optional[RequestOptions] = None,
502
601
  ) -> Prompt:
@@ -529,8 +628,8 @@ class AsyncPromptsClient:
529
628
  organization : typing.Optional[PromptOrganization]
530
629
  Organization ID of the prompt
531
630
 
532
- associated_projects : typing.Optional[typing.Sequence[int]]
533
- List of associated projects IDs
631
+ associated_projects : typing.Optional[typing.Sequence[PromptAssociatedProjectsItem]]
632
+ List of associated projects IDs or objects
534
633
 
535
634
  skill_name : typing.Optional[str]
536
635
  Name of the skill
@@ -545,16 +644,24 @@ class AsyncPromptsClient:
545
644
 
546
645
  Examples
547
646
  --------
548
- from label_studio_sdk.client import AsyncLabelStudio
647
+ import asyncio
648
+
649
+ from label_studio_sdk import AsyncLabelStudio
549
650
 
550
651
  client = AsyncLabelStudio(
551
652
  api_key="YOUR_API_KEY",
552
653
  )
553
- await client.prompts.create(
554
- title="title",
555
- input_fields=["input_fields"],
556
- output_classes=["output_classes"],
557
- )
654
+
655
+
656
+ async def main() -> None:
657
+ await client.prompts.create(
658
+ title="title",
659
+ input_fields=["input_fields"],
660
+ output_classes=["output_classes"],
661
+ )
662
+
663
+
664
+ asyncio.run(main())
558
665
  """
559
666
  _response = await self._client_wrapper.httpx_client.request(
560
667
  "api/prompts/",
@@ -562,13 +669,21 @@ class AsyncPromptsClient:
562
669
  json={
563
670
  "title": title,
564
671
  "description": description,
565
- "created_by": created_by,
672
+ "created_by": convert_and_respect_annotation_metadata(
673
+ object_=created_by, annotation=PromptCreatedBy, direction="write"
674
+ ),
566
675
  "created_at": created_at,
567
676
  "updated_at": updated_at,
568
- "organization": organization,
677
+ "organization": convert_and_respect_annotation_metadata(
678
+ object_=organization, annotation=PromptOrganization, direction="write"
679
+ ),
569
680
  "input_fields": input_fields,
570
681
  "output_classes": output_classes,
571
- "associated_projects": associated_projects,
682
+ "associated_projects": convert_and_respect_annotation_metadata(
683
+ object_=associated_projects,
684
+ annotation=typing.Sequence[PromptAssociatedProjectsItem],
685
+ direction="write",
686
+ ),
572
687
  "skill_name": skill_name,
573
688
  },
574
689
  request_options=request_options,
@@ -576,7 +691,13 @@ class AsyncPromptsClient:
576
691
  )
577
692
  try:
578
693
  if 200 <= _response.status_code < 300:
579
- return pydantic_v1.parse_obj_as(Prompt, _response.json()) # type: ignore
694
+ return typing.cast(
695
+ Prompt,
696
+ parse_obj_as(
697
+ type_=Prompt, # type: ignore
698
+ object_=_response.json(),
699
+ ),
700
+ )
580
701
  _response_json = _response.json()
581
702
  except JSONDecodeError:
582
703
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -601,21 +722,37 @@ class AsyncPromptsClient:
601
722
 
602
723
  Examples
603
724
  --------
604
- from label_studio_sdk.client import AsyncLabelStudio
725
+ import asyncio
726
+
727
+ from label_studio_sdk import AsyncLabelStudio
605
728
 
606
729
  client = AsyncLabelStudio(
607
730
  api_key="YOUR_API_KEY",
608
731
  )
609
- await client.prompts.get(
610
- id=1,
611
- )
732
+
733
+
734
+ async def main() -> None:
735
+ await client.prompts.get(
736
+ id=1,
737
+ )
738
+
739
+
740
+ asyncio.run(main())
612
741
  """
613
742
  _response = await self._client_wrapper.httpx_client.request(
614
- f"api/prompts/{jsonable_encoder(id)}", method="GET", request_options=request_options
743
+ f"api/prompts/{jsonable_encoder(id)}",
744
+ method="GET",
745
+ request_options=request_options,
615
746
  )
616
747
  try:
617
748
  if 200 <= _response.status_code < 300:
618
- return pydantic_v1.parse_obj_as(Prompt, _response.json()) # type: ignore
749
+ return typing.cast(
750
+ Prompt,
751
+ parse_obj_as(
752
+ type_=Prompt, # type: ignore
753
+ object_=_response.json(),
754
+ ),
755
+ )
619
756
  _response_json = _response.json()
620
757
  except JSONDecodeError:
621
758
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -639,17 +776,27 @@ class AsyncPromptsClient:
639
776
 
640
777
  Examples
641
778
  --------
642
- from label_studio_sdk.client import AsyncLabelStudio
779
+ import asyncio
780
+
781
+ from label_studio_sdk import AsyncLabelStudio
643
782
 
644
783
  client = AsyncLabelStudio(
645
784
  api_key="YOUR_API_KEY",
646
785
  )
647
- await client.prompts.delete(
648
- id=1,
649
- )
786
+
787
+
788
+ async def main() -> None:
789
+ await client.prompts.delete(
790
+ id=1,
791
+ )
792
+
793
+
794
+ asyncio.run(main())
650
795
  """
651
796
  _response = await self._client_wrapper.httpx_client.request(
652
- f"api/prompts/{jsonable_encoder(id)}", method="DELETE", request_options=request_options
797
+ f"api/prompts/{jsonable_encoder(id)}",
798
+ method="DELETE",
799
+ request_options=request_options,
653
800
  )
654
801
  try:
655
802
  if 200 <= _response.status_code < 300:
@@ -671,7 +818,7 @@ class AsyncPromptsClient:
671
818
  created_at: typing.Optional[dt.datetime] = OMIT,
672
819
  updated_at: typing.Optional[dt.datetime] = OMIT,
673
820
  organization: typing.Optional[PromptOrganization] = OMIT,
674
- associated_projects: typing.Optional[typing.Sequence[int]] = OMIT,
821
+ associated_projects: typing.Optional[typing.Sequence[PromptAssociatedProjectsItem]] = OMIT,
675
822
  skill_name: typing.Optional[str] = OMIT,
676
823
  request_options: typing.Optional[RequestOptions] = None,
677
824
  ) -> Prompt:
@@ -707,8 +854,8 @@ class AsyncPromptsClient:
707
854
  organization : typing.Optional[PromptOrganization]
708
855
  Organization ID of the prompt
709
856
 
710
- associated_projects : typing.Optional[typing.Sequence[int]]
711
- List of associated projects IDs
857
+ associated_projects : typing.Optional[typing.Sequence[PromptAssociatedProjectsItem]]
858
+ List of associated projects IDs or objects
712
859
 
713
860
  skill_name : typing.Optional[str]
714
861
  Name of the skill
@@ -723,17 +870,25 @@ class AsyncPromptsClient:
723
870
 
724
871
  Examples
725
872
  --------
726
- from label_studio_sdk.client import AsyncLabelStudio
873
+ import asyncio
874
+
875
+ from label_studio_sdk import AsyncLabelStudio
727
876
 
728
877
  client = AsyncLabelStudio(
729
878
  api_key="YOUR_API_KEY",
730
879
  )
731
- await client.prompts.update(
732
- id=1,
733
- title="title",
734
- input_fields=["input_fields"],
735
- output_classes=["output_classes"],
736
- )
880
+
881
+
882
+ async def main() -> None:
883
+ await client.prompts.update(
884
+ id=1,
885
+ title="title",
886
+ input_fields=["input_fields"],
887
+ output_classes=["output_classes"],
888
+ )
889
+
890
+
891
+ asyncio.run(main())
737
892
  """
738
893
  _response = await self._client_wrapper.httpx_client.request(
739
894
  f"api/prompts/{jsonable_encoder(id)}",
@@ -741,13 +896,21 @@ class AsyncPromptsClient:
741
896
  json={
742
897
  "title": title,
743
898
  "description": description,
744
- "created_by": created_by,
899
+ "created_by": convert_and_respect_annotation_metadata(
900
+ object_=created_by, annotation=PromptCreatedBy, direction="write"
901
+ ),
745
902
  "created_at": created_at,
746
903
  "updated_at": updated_at,
747
- "organization": organization,
904
+ "organization": convert_and_respect_annotation_metadata(
905
+ object_=organization, annotation=PromptOrganization, direction="write"
906
+ ),
748
907
  "input_fields": input_fields,
749
908
  "output_classes": output_classes,
750
- "associated_projects": associated_projects,
909
+ "associated_projects": convert_and_respect_annotation_metadata(
910
+ object_=associated_projects,
911
+ annotation=typing.Sequence[PromptAssociatedProjectsItem],
912
+ direction="write",
913
+ ),
751
914
  "skill_name": skill_name,
752
915
  },
753
916
  request_options=request_options,
@@ -755,7 +918,13 @@ class AsyncPromptsClient:
755
918
  )
756
919
  try:
757
920
  if 200 <= _response.status_code < 300:
758
- return pydantic_v1.parse_obj_as(Prompt, _response.json()) # type: ignore
921
+ return typing.cast(
922
+ Prompt,
923
+ parse_obj_as(
924
+ type_=Prompt, # type: ignore
925
+ object_=_response.json(),
926
+ ),
927
+ )
759
928
  _response_json = _response.json()
760
929
  except JSONDecodeError:
761
930
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -788,23 +957,47 @@ class AsyncPromptsClient:
788
957
 
789
958
  Examples
790
959
  --------
791
- from label_studio_sdk.client import AsyncLabelStudio
960
+ import asyncio
961
+
962
+ from label_studio_sdk import AsyncLabelStudio
792
963
 
793
964
  client = AsyncLabelStudio(
794
965
  api_key="YOUR_API_KEY",
795
966
  )
796
- await client.prompts.batch_predictions()
967
+
968
+
969
+ async def main() -> None:
970
+ await client.prompts.batch_predictions()
971
+
972
+
973
+ asyncio.run(main())
797
974
  """
798
975
  _response = await self._client_wrapper.httpx_client.request(
799
976
  "api/model-run/batch-predictions",
800
977
  method="POST",
801
- json={"modelrun_id": modelrun_id, "results": results},
978
+ json={
979
+ "modelrun_id": modelrun_id,
980
+ "results": convert_and_respect_annotation_metadata(
981
+ object_=results,
982
+ annotation=typing.Sequence[PromptsBatchPredictionsRequestResultsItem],
983
+ direction="write",
984
+ ),
985
+ },
986
+ headers={
987
+ "content-type": "application/json",
988
+ },
802
989
  request_options=request_options,
803
990
  omit=OMIT,
804
991
  )
805
992
  try:
806
993
  if 200 <= _response.status_code < 300:
807
- return pydantic_v1.parse_obj_as(PromptsBatchPredictionsResponse, _response.json()) # type: ignore
994
+ return typing.cast(
995
+ PromptsBatchPredictionsResponse,
996
+ parse_obj_as(
997
+ type_=PromptsBatchPredictionsResponse, # type: ignore
998
+ object_=_response.json(),
999
+ ),
1000
+ )
808
1001
  _response_json = _response.json()
809
1002
  except JSONDecodeError:
810
1003
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -839,23 +1032,47 @@ class AsyncPromptsClient:
839
1032
 
840
1033
  Examples
841
1034
  --------
842
- from label_studio_sdk.client import AsyncLabelStudio
1035
+ import asyncio
1036
+
1037
+ from label_studio_sdk import AsyncLabelStudio
843
1038
 
844
1039
  client = AsyncLabelStudio(
845
1040
  api_key="YOUR_API_KEY",
846
1041
  )
847
- await client.prompts.batch_failed_predictions()
1042
+
1043
+
1044
+ async def main() -> None:
1045
+ await client.prompts.batch_failed_predictions()
1046
+
1047
+
1048
+ asyncio.run(main())
848
1049
  """
849
1050
  _response = await self._client_wrapper.httpx_client.request(
850
1051
  "api/model-run/batch-failed-predictions",
851
1052
  method="POST",
852
- json={"modelrun_id": modelrun_id, "failed_predictions": failed_predictions},
1053
+ json={
1054
+ "modelrun_id": modelrun_id,
1055
+ "failed_predictions": convert_and_respect_annotation_metadata(
1056
+ object_=failed_predictions,
1057
+ annotation=typing.Sequence[PromptsBatchFailedPredictionsRequestFailedPredictionsItem],
1058
+ direction="write",
1059
+ ),
1060
+ },
1061
+ headers={
1062
+ "content-type": "application/json",
1063
+ },
853
1064
  request_options=request_options,
854
1065
  omit=OMIT,
855
1066
  )
856
1067
  try:
857
1068
  if 200 <= _response.status_code < 300:
858
- return pydantic_v1.parse_obj_as(PromptsBatchFailedPredictionsResponse, _response.json()) # type: ignore
1069
+ return typing.cast(
1070
+ PromptsBatchFailedPredictionsResponse,
1071
+ parse_obj_as(
1072
+ type_=PromptsBatchFailedPredictionsResponse, # type: ignore
1073
+ object_=_response.json(),
1074
+ ),
1075
+ )
859
1076
  _response_json = _response.json()
860
1077
  except JSONDecodeError:
861
1078
  raise ApiError(status_code=_response.status_code, body=_response.text)