label-studio-sdk 1.0.8__py3-none-any.whl → 1.0.11__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 (218) hide show
  1. label_studio_sdk/__init__.py +37 -8
  2. label_studio_sdk/_extensions/label_studio_tools/core/utils/io.py +16 -4
  3. label_studio_sdk/_extensions/label_studio_tools/core/utils/json_schema.py +5 -0
  4. label_studio_sdk/_extensions/pager_ext.py +8 -0
  5. label_studio_sdk/actions/client.py +91 -40
  6. label_studio_sdk/actions/types/actions_create_request_filters.py +14 -24
  7. label_studio_sdk/actions/types/actions_create_request_filters_items_item.py +16 -26
  8. label_studio_sdk/actions/types/actions_create_request_filters_items_item_value.py +3 -1
  9. label_studio_sdk/actions/types/actions_create_request_selected_items.py +1 -2
  10. label_studio_sdk/actions/types/actions_create_request_selected_items_excluded.py +15 -25
  11. label_studio_sdk/actions/types/actions_create_request_selected_items_included.py +15 -25
  12. label_studio_sdk/annotations/__init__.py +2 -2
  13. label_studio_sdk/annotations/client.py +278 -104
  14. label_studio_sdk/annotations/types/__init__.py +2 -1
  15. label_studio_sdk/annotations/types/annotations_create_bulk_request_selected_items.py +34 -0
  16. label_studio_sdk/annotations/types/annotations_create_bulk_response_item.py +11 -21
  17. label_studio_sdk/base_client.py +54 -27
  18. label_studio_sdk/client.py +1 -0
  19. label_studio_sdk/comments/client.py +190 -44
  20. label_studio_sdk/converter/converter.py +56 -13
  21. label_studio_sdk/converter/imports/yolo.py +1 -1
  22. label_studio_sdk/converter/utils.py +3 -2
  23. label_studio_sdk/core/__init__.py +21 -4
  24. label_studio_sdk/core/client_wrapper.py +37 -19
  25. label_studio_sdk/core/file.py +37 -8
  26. label_studio_sdk/core/http_client.py +52 -28
  27. label_studio_sdk/core/jsonable_encoder.py +33 -31
  28. label_studio_sdk/core/pagination.py +5 -4
  29. label_studio_sdk/core/pydantic_utilities.py +272 -4
  30. label_studio_sdk/core/query_encoder.py +38 -13
  31. label_studio_sdk/core/request_options.py +3 -0
  32. label_studio_sdk/core/serialization.py +272 -0
  33. label_studio_sdk/errors/__init__.py +3 -1
  34. label_studio_sdk/errors/bad_request_error.py +2 -3
  35. label_studio_sdk/errors/not_found_error.py +9 -0
  36. label_studio_sdk/errors/unauthorized_error.py +9 -0
  37. label_studio_sdk/export_storage/azure/client.py +228 -58
  38. label_studio_sdk/export_storage/azure/types/azure_create_response.py +19 -29
  39. label_studio_sdk/export_storage/azure/types/azure_update_response.py +19 -29
  40. label_studio_sdk/export_storage/client.py +48 -18
  41. label_studio_sdk/export_storage/gcs/client.py +228 -58
  42. label_studio_sdk/export_storage/gcs/types/gcs_create_response.py +19 -29
  43. label_studio_sdk/export_storage/gcs/types/gcs_update_response.py +19 -29
  44. label_studio_sdk/export_storage/local/client.py +222 -56
  45. label_studio_sdk/export_storage/local/types/local_create_response.py +17 -27
  46. label_studio_sdk/export_storage/local/types/local_update_response.py +17 -27
  47. label_studio_sdk/export_storage/redis/client.py +228 -58
  48. label_studio_sdk/export_storage/redis/types/redis_create_response.py +20 -30
  49. label_studio_sdk/export_storage/redis/types/redis_update_response.py +20 -30
  50. label_studio_sdk/export_storage/s3/client.py +228 -58
  51. label_studio_sdk/export_storage/s3/types/s3create_response.py +27 -35
  52. label_studio_sdk/export_storage/s3/types/s3update_response.py +27 -35
  53. label_studio_sdk/export_storage/s3s/client.py +187 -43
  54. label_studio_sdk/export_storage/types/export_storage_list_types_response_item.py +11 -21
  55. label_studio_sdk/files/client.py +172 -56
  56. label_studio_sdk/import_storage/azure/client.py +223 -53
  57. label_studio_sdk/import_storage/azure/types/azure_create_response.py +22 -32
  58. label_studio_sdk/import_storage/azure/types/azure_update_response.py +22 -32
  59. label_studio_sdk/import_storage/client.py +48 -18
  60. label_studio_sdk/import_storage/gcs/client.py +223 -53
  61. label_studio_sdk/import_storage/gcs/types/gcs_create_response.py +22 -32
  62. label_studio_sdk/import_storage/gcs/types/gcs_update_response.py +22 -32
  63. label_studio_sdk/import_storage/local/client.py +223 -53
  64. label_studio_sdk/import_storage/local/types/local_create_response.py +17 -27
  65. label_studio_sdk/import_storage/local/types/local_update_response.py +17 -27
  66. label_studio_sdk/import_storage/redis/client.py +223 -53
  67. label_studio_sdk/import_storage/redis/types/redis_create_response.py +20 -30
  68. label_studio_sdk/import_storage/redis/types/redis_update_response.py +20 -30
  69. label_studio_sdk/import_storage/s3/client.py +223 -53
  70. label_studio_sdk/import_storage/s3/types/s3create_response.py +31 -39
  71. label_studio_sdk/import_storage/s3/types/s3update_response.py +31 -39
  72. label_studio_sdk/import_storage/s3s/client.py +222 -52
  73. label_studio_sdk/import_storage/types/import_storage_list_types_response_item.py +11 -21
  74. label_studio_sdk/jwt_settings/__init__.py +2 -0
  75. label_studio_sdk/jwt_settings/client.py +259 -0
  76. label_studio_sdk/label_interface/control_tags.py +16 -3
  77. label_studio_sdk/label_interface/interface.py +80 -1
  78. label_studio_sdk/label_interface/object_tags.py +2 -2
  79. label_studio_sdk/ml/client.py +280 -78
  80. label_studio_sdk/ml/types/ml_create_response.py +21 -31
  81. label_studio_sdk/ml/types/ml_update_response.py +21 -31
  82. label_studio_sdk/model_providers/client.py +173 -56
  83. label_studio_sdk/predictions/client.py +247 -101
  84. label_studio_sdk/projects/__init__.py +5 -1
  85. label_studio_sdk/projects/client.py +313 -115
  86. label_studio_sdk/projects/client_ext.py +16 -0
  87. label_studio_sdk/projects/exports/__init__.py +3 -0
  88. label_studio_sdk/projects/exports/client.py +447 -296
  89. label_studio_sdk/projects/exports/client_ext.py +200 -0
  90. label_studio_sdk/projects/exports/types/__init__.py +6 -0
  91. label_studio_sdk/projects/exports/types/exports_convert_response.py +24 -0
  92. label_studio_sdk/projects/exports/types/exports_list_formats_response_item.py +44 -0
  93. label_studio_sdk/projects/pauses/__init__.py +2 -0
  94. label_studio_sdk/projects/pauses/client.py +704 -0
  95. label_studio_sdk/projects/types/projects_create_response.py +29 -34
  96. label_studio_sdk/projects/types/projects_import_tasks_response.py +19 -29
  97. label_studio_sdk/projects/types/projects_list_response.py +11 -21
  98. label_studio_sdk/projects/types/projects_update_response.py +34 -34
  99. label_studio_sdk/prompts/client.py +309 -92
  100. label_studio_sdk/prompts/indicators/client.py +67 -23
  101. label_studio_sdk/prompts/runs/client.py +95 -40
  102. label_studio_sdk/prompts/types/prompts_batch_failed_predictions_request_failed_predictions_item.py +14 -24
  103. label_studio_sdk/prompts/types/prompts_batch_failed_predictions_response.py +11 -21
  104. label_studio_sdk/prompts/types/prompts_batch_predictions_request_results_item.py +26 -29
  105. label_studio_sdk/prompts/types/prompts_batch_predictions_response.py +11 -21
  106. label_studio_sdk/prompts/versions/client.py +277 -88
  107. label_studio_sdk/tasks/client.py +263 -90
  108. label_studio_sdk/tasks/types/tasks_list_response.py +15 -25
  109. label_studio_sdk/tokens/__init__.py +2 -0
  110. label_studio_sdk/tokens/client.py +470 -0
  111. label_studio_sdk/tokens/client_ext.py +94 -0
  112. label_studio_sdk/types/__init__.py +20 -6
  113. label_studio_sdk/types/access_token_response.py +22 -0
  114. label_studio_sdk/types/annotation.py +29 -38
  115. label_studio_sdk/types/annotation_filter_options.py +14 -24
  116. label_studio_sdk/types/annotations_dm_field.py +30 -39
  117. label_studio_sdk/types/api_token_response.py +32 -0
  118. label_studio_sdk/types/azure_blob_export_storage.py +28 -37
  119. label_studio_sdk/types/azure_blob_import_storage.py +28 -37
  120. label_studio_sdk/types/base_task.py +30 -39
  121. label_studio_sdk/types/base_task_updated_by.py +3 -1
  122. label_studio_sdk/types/base_user.py +14 -21
  123. label_studio_sdk/types/comment.py +12 -21
  124. label_studio_sdk/types/comment_created_by.py +1 -1
  125. label_studio_sdk/types/converted_format.py +12 -22
  126. label_studio_sdk/types/data_manager_task_serializer.py +31 -40
  127. label_studio_sdk/types/data_manager_task_serializer_annotators_item.py +1 -1
  128. label_studio_sdk/types/data_manager_task_serializer_drafts_item.py +13 -22
  129. label_studio_sdk/types/data_manager_task_serializer_predictions_item.py +15 -24
  130. label_studio_sdk/types/export.py +17 -26
  131. label_studio_sdk/types/export_format.py +25 -0
  132. label_studio_sdk/types/export_snapshot.py +45 -0
  133. label_studio_sdk/types/export_snapshot_status.py +5 -0
  134. label_studio_sdk/types/file_upload.py +11 -21
  135. label_studio_sdk/types/filter.py +16 -26
  136. label_studio_sdk/types/filter_group.py +12 -22
  137. label_studio_sdk/types/gcs_export_storage.py +28 -37
  138. label_studio_sdk/types/gcs_import_storage.py +28 -37
  139. label_studio_sdk/types/inference_run.py +14 -23
  140. label_studio_sdk/types/inference_run_cost_estimate.py +17 -27
  141. label_studio_sdk/types/inference_run_created_by.py +1 -1
  142. label_studio_sdk/types/inference_run_organization.py +1 -1
  143. label_studio_sdk/types/jwt_settings_response.py +32 -0
  144. label_studio_sdk/types/key_indicator_value.py +12 -22
  145. label_studio_sdk/types/key_indicators.py +0 -1
  146. label_studio_sdk/types/key_indicators_item.py +15 -25
  147. label_studio_sdk/types/key_indicators_item_additional_kpis_item.py +13 -23
  148. label_studio_sdk/types/key_indicators_item_extra_kpis_item.py +13 -23
  149. label_studio_sdk/types/local_files_export_storage.py +25 -34
  150. label_studio_sdk/types/local_files_import_storage.py +24 -33
  151. label_studio_sdk/types/ml_backend.py +23 -32
  152. label_studio_sdk/types/model_provider_connection.py +22 -31
  153. label_studio_sdk/types/model_provider_connection_created_by.py +1 -1
  154. label_studio_sdk/types/model_provider_connection_organization.py +1 -1
  155. label_studio_sdk/types/model_provider_connection_provider.py +3 -1
  156. label_studio_sdk/types/pause.py +34 -0
  157. label_studio_sdk/types/pause_paused_by.py +5 -0
  158. label_studio_sdk/types/prediction.py +21 -30
  159. label_studio_sdk/types/project.py +58 -55
  160. label_studio_sdk/types/project_import.py +21 -30
  161. label_studio_sdk/types/project_label_config.py +12 -22
  162. label_studio_sdk/types/prompt.py +24 -32
  163. label_studio_sdk/types/prompt_associated_projects_item.py +6 -0
  164. label_studio_sdk/types/prompt_associated_projects_item_id.py +20 -0
  165. label_studio_sdk/types/prompt_created_by.py +1 -1
  166. label_studio_sdk/types/prompt_organization.py +1 -1
  167. label_studio_sdk/types/prompt_version.py +13 -22
  168. label_studio_sdk/types/prompt_version_created_by.py +1 -1
  169. label_studio_sdk/types/prompt_version_organization.py +1 -1
  170. label_studio_sdk/types/prompt_version_provider.py +3 -1
  171. label_studio_sdk/types/redis_export_storage.py +29 -38
  172. label_studio_sdk/types/redis_import_storage.py +28 -37
  173. label_studio_sdk/types/refined_prompt_response.py +19 -29
  174. label_studio_sdk/types/s3export_storage.py +36 -43
  175. label_studio_sdk/types/s3import_storage.py +37 -44
  176. label_studio_sdk/types/s3s_export_storage.py +26 -33
  177. label_studio_sdk/types/s3s_import_storage.py +35 -42
  178. label_studio_sdk/types/serialization_option.py +12 -22
  179. label_studio_sdk/types/serialization_options.py +18 -28
  180. label_studio_sdk/types/task.py +44 -47
  181. label_studio_sdk/types/task_annotators_item.py +1 -1
  182. label_studio_sdk/types/task_comment_authors_item.py +1 -1
  183. label_studio_sdk/types/task_filter_options.py +15 -25
  184. label_studio_sdk/types/user_simple.py +11 -21
  185. label_studio_sdk/types/view.py +16 -26
  186. label_studio_sdk/types/webhook.py +19 -28
  187. label_studio_sdk/types/webhook_serializer_for_update.py +19 -28
  188. label_studio_sdk/types/workspace.py +22 -31
  189. label_studio_sdk/users/client.py +257 -63
  190. label_studio_sdk/users/types/users_get_token_response.py +12 -22
  191. label_studio_sdk/users/types/users_reset_token_response.py +12 -22
  192. label_studio_sdk/version.py +0 -1
  193. label_studio_sdk/versions/__init__.py +5 -0
  194. label_studio_sdk/versions/client.py +112 -0
  195. label_studio_sdk/versions/types/__init__.py +6 -0
  196. label_studio_sdk/versions/types/versions_get_response.py +73 -0
  197. label_studio_sdk/versions/types/versions_get_response_edition.py +5 -0
  198. label_studio_sdk/views/client.py +219 -52
  199. label_studio_sdk/views/types/views_create_request_data.py +13 -23
  200. label_studio_sdk/views/types/views_create_request_data_filters.py +14 -24
  201. label_studio_sdk/views/types/views_create_request_data_filters_items_item.py +16 -26
  202. label_studio_sdk/views/types/views_create_request_data_filters_items_item_value.py +3 -1
  203. label_studio_sdk/views/types/views_update_request_data.py +13 -23
  204. label_studio_sdk/views/types/views_update_request_data_filters.py +14 -24
  205. label_studio_sdk/views/types/views_update_request_data_filters_items_item.py +16 -26
  206. label_studio_sdk/views/types/views_update_request_data_filters_items_item_value.py +3 -1
  207. label_studio_sdk/webhooks/client.py +191 -61
  208. label_studio_sdk/workspaces/client.py +164 -41
  209. label_studio_sdk/workspaces/members/client.py +109 -31
  210. label_studio_sdk/workspaces/members/types/members_create_response.py +12 -22
  211. label_studio_sdk/workspaces/members/types/members_list_response_item.py +12 -22
  212. {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.11.dist-info}/METADATA +8 -5
  213. {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.11.dist-info}/RECORD +215 -188
  214. {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.11.dist-info}/WHEEL +1 -1
  215. label_studio_sdk/types/export_convert.py +0 -32
  216. label_studio_sdk/types/export_create.py +0 -54
  217. label_studio_sdk/types/export_create_status.py +0 -5
  218. {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.11.dist-info}/LICENSE +0 -0
@@ -1,19 +1,19 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
3
  import typing
4
- from json.decoder import JSONDecodeError
5
-
6
- 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
4
+ from ..core.client_wrapper import SyncClientWrapper
10
5
  from ..core.request_options import RequestOptions
11
- from ..errors.internal_server_error import InternalServerError
12
6
  from ..types.ml_backend import MlBackend
7
+ from ..core.pydantic_utilities import parse_obj_as
8
+ from json.decoder import JSONDecodeError
9
+ from ..core.api_error import ApiError
13
10
  from .types.ml_create_request_auth_method import MlCreateRequestAuthMethod
14
11
  from .types.ml_create_response import MlCreateResponse
12
+ from ..core.jsonable_encoder import jsonable_encoder
15
13
  from .types.ml_update_request_auth_method import MlUpdateRequestAuthMethod
16
14
  from .types.ml_update_response import MlUpdateResponse
15
+ from ..errors.internal_server_error import InternalServerError
16
+ from ..core.client_wrapper import AsyncClientWrapper
17
17
 
18
18
  # this is used as the default value for optional parameters
19
19
  OMIT = typing.cast(typing.Any, ...)
@@ -27,8 +27,10 @@ class MlClient:
27
27
  self, *, project: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
28
28
  ) -> typing.List[MlBackend]:
29
29
  """
30
+
30
31
  List all configured Machine Learning (ML) backends for a specific project by ID. For more information about ML backends, see [Machine learning integration](https://labelstud.io/guide/ml).
31
32
 
33
+
32
34
  You will need to provide the project ID. This can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using [List all projects](../projects/list).
33
35
 
34
36
  Parameters
@@ -46,7 +48,7 @@ class MlClient:
46
48
 
47
49
  Examples
48
50
  --------
49
- from label_studio_sdk.client import LabelStudio
51
+ from label_studio_sdk import LabelStudio
50
52
 
51
53
  client = LabelStudio(
52
54
  api_key="YOUR_API_KEY",
@@ -54,11 +56,22 @@ class MlClient:
54
56
  client.ml.list()
55
57
  """
56
58
  _response = self._client_wrapper.httpx_client.request(
57
- "api/ml/", method="GET", params={"project": project}, request_options=request_options
59
+ "api/ml/",
60
+ method="GET",
61
+ params={
62
+ "project": project,
63
+ },
64
+ request_options=request_options,
58
65
  )
59
66
  try:
60
67
  if 200 <= _response.status_code < 300:
61
- return pydantic_v1.parse_obj_as(typing.List[MlBackend], _response.json()) # type: ignore
68
+ return typing.cast(
69
+ typing.List[MlBackend],
70
+ parse_obj_as(
71
+ type_=typing.List[MlBackend], # type: ignore
72
+ object_=_response.json(),
73
+ ),
74
+ )
62
75
  _response_json = _response.json()
63
76
  except JSONDecodeError:
64
77
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -75,11 +88,12 @@ class MlClient:
75
88
  auth_method: typing.Optional[MlCreateRequestAuthMethod] = OMIT,
76
89
  basic_auth_user: typing.Optional[str] = OMIT,
77
90
  basic_auth_pass: typing.Optional[str] = OMIT,
78
- extra_params: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
91
+ extra_params: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
79
92
  timeout: typing.Optional[int] = OMIT,
80
93
  request_options: typing.Optional[RequestOptions] = None,
81
94
  ) -> MlCreateResponse:
82
95
  """
96
+
83
97
  Add an ML backend to a project. For more information about what you need to configure when adding an ML backend, see [Connect the model to Label studio](https://labelstud.io/guide/ml#Connect-the-model-to-Label-Studio).
84
98
 
85
99
  <Note>If you are using Docker Compose, you may need to adjust your ML backend URL. See [localhost and Docker containers](https://labelstud.io/guide/ml#localhost-and-Docker-containers).</Note>
@@ -112,7 +126,7 @@ class MlClient:
112
126
  basic_auth_pass : typing.Optional[str]
113
127
  Basic auth password
114
128
 
115
- extra_params : typing.Optional[typing.Dict[str, typing.Any]]
129
+ extra_params : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
116
130
  Extra parameters
117
131
 
118
132
  timeout : typing.Optional[int]
@@ -128,7 +142,7 @@ class MlClient:
128
142
 
129
143
  Examples
130
144
  --------
131
- from label_studio_sdk.client import LabelStudio
145
+ from label_studio_sdk import LabelStudio
132
146
 
133
147
  client = LabelStudio(
134
148
  api_key="YOUR_API_KEY",
@@ -150,12 +164,21 @@ class MlClient:
150
164
  "extra_params": extra_params,
151
165
  "timeout": timeout,
152
166
  },
167
+ headers={
168
+ "content-type": "application/json",
169
+ },
153
170
  request_options=request_options,
154
171
  omit=OMIT,
155
172
  )
156
173
  try:
157
174
  if 200 <= _response.status_code < 300:
158
- return pydantic_v1.parse_obj_as(MlCreateResponse, _response.json()) # type: ignore
175
+ return typing.cast(
176
+ MlCreateResponse,
177
+ parse_obj_as(
178
+ type_=MlCreateResponse, # type: ignore
179
+ object_=_response.json(),
180
+ ),
181
+ )
159
182
  _response_json = _response.json()
160
183
  except JSONDecodeError:
161
184
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -163,6 +186,7 @@ class MlClient:
163
186
 
164
187
  def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> MlBackend:
165
188
  """
189
+
166
190
  Get details about a specific ML backend. You will need to specify an ID for the backend connection. You can find this using [List ML backends](list).
167
191
 
168
192
  For more information, see [Machine learning integration](https://labelstud.io/guide/ml).
@@ -182,7 +206,7 @@ class MlClient:
182
206
 
183
207
  Examples
184
208
  --------
185
- from label_studio_sdk.client import LabelStudio
209
+ from label_studio_sdk import LabelStudio
186
210
 
187
211
  client = LabelStudio(
188
212
  api_key="YOUR_API_KEY",
@@ -192,11 +216,19 @@ class MlClient:
192
216
  )
193
217
  """
194
218
  _response = self._client_wrapper.httpx_client.request(
195
- f"api/ml/{jsonable_encoder(id)}", method="GET", request_options=request_options
219
+ f"api/ml/{jsonable_encoder(id)}",
220
+ method="GET",
221
+ request_options=request_options,
196
222
  )
197
223
  try:
198
224
  if 200 <= _response.status_code < 300:
199
- return pydantic_v1.parse_obj_as(MlBackend, _response.json()) # type: ignore
225
+ return typing.cast(
226
+ MlBackend,
227
+ parse_obj_as(
228
+ type_=MlBackend, # type: ignore
229
+ object_=_response.json(),
230
+ ),
231
+ )
200
232
  _response_json = _response.json()
201
233
  except JSONDecodeError:
202
234
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -204,6 +236,7 @@ class MlClient:
204
236
 
205
237
  def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
206
238
  """
239
+
207
240
  Remove an existing ML backend connection. You will need to specify an ID for the backend connection. You can find this using [List ML backends](list).
208
241
 
209
242
  For more information, see [Machine learning integration](https://labelstud.io/guide/ml).
@@ -222,7 +255,7 @@ class MlClient:
222
255
 
223
256
  Examples
224
257
  --------
225
- from label_studio_sdk.client import LabelStudio
258
+ from label_studio_sdk import LabelStudio
226
259
 
227
260
  client = LabelStudio(
228
261
  api_key="YOUR_API_KEY",
@@ -232,7 +265,9 @@ class MlClient:
232
265
  )
233
266
  """
234
267
  _response = self._client_wrapper.httpx_client.request(
235
- f"api/ml/{jsonable_encoder(id)}", method="DELETE", request_options=request_options
268
+ f"api/ml/{jsonable_encoder(id)}",
269
+ method="DELETE",
270
+ request_options=request_options,
236
271
  )
237
272
  try:
238
273
  if 200 <= _response.status_code < 300:
@@ -254,11 +289,12 @@ class MlClient:
254
289
  auth_method: typing.Optional[MlUpdateRequestAuthMethod] = OMIT,
255
290
  basic_auth_user: typing.Optional[str] = OMIT,
256
291
  basic_auth_pass: typing.Optional[str] = OMIT,
257
- extra_params: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
292
+ extra_params: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
258
293
  timeout: typing.Optional[int] = OMIT,
259
294
  request_options: typing.Optional[RequestOptions] = None,
260
295
  ) -> MlUpdateResponse:
261
296
  """
297
+
262
298
  Update the ML backend parameters. You will need to specify an ID for the backend connection. You can find this using [List ML backends](list).
263
299
 
264
300
  For more information, see [Machine learning integration](https://labelstud.io/guide/ml).
@@ -292,7 +328,7 @@ class MlClient:
292
328
  basic_auth_pass : typing.Optional[str]
293
329
  Basic auth password
294
330
 
295
- extra_params : typing.Optional[typing.Dict[str, typing.Any]]
331
+ extra_params : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
296
332
  Extra parameters
297
333
 
298
334
  timeout : typing.Optional[int]
@@ -308,7 +344,7 @@ class MlClient:
308
344
 
309
345
  Examples
310
346
  --------
311
- from label_studio_sdk.client import LabelStudio
347
+ from label_studio_sdk import LabelStudio
312
348
 
313
349
  client = LabelStudio(
314
350
  api_key="YOUR_API_KEY",
@@ -332,12 +368,21 @@ class MlClient:
332
368
  "extra_params": extra_params,
333
369
  "timeout": timeout,
334
370
  },
371
+ headers={
372
+ "content-type": "application/json",
373
+ },
335
374
  request_options=request_options,
336
375
  omit=OMIT,
337
376
  )
338
377
  try:
339
378
  if 200 <= _response.status_code < 300:
340
- return pydantic_v1.parse_obj_as(MlUpdateResponse, _response.json()) # type: ignore
379
+ return typing.cast(
380
+ MlUpdateResponse,
381
+ parse_obj_as(
382
+ type_=MlUpdateResponse, # type: ignore
383
+ object_=_response.json(),
384
+ ),
385
+ )
341
386
  _response_json = _response.json()
342
387
  except JSONDecodeError:
343
388
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -348,10 +393,11 @@ class MlClient:
348
393
  id: int,
349
394
  *,
350
395
  task: int,
351
- context: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
396
+ context: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
352
397
  request_options: typing.Optional[RequestOptions] = None,
353
398
  ) -> None:
354
399
  """
400
+
355
401
  Enable interactive pre-annotations for a specific task.
356
402
 
357
403
  ML-assisted labeling with interactive pre-annotations works with image segmentation and object detection tasks using rectangles, ellipses, polygons, brush masks, and keypoints, as well as with HTML and text named entity recognition tasks. Your ML backend must support the type of labeling that you’re performing, recognize the input that you create, and be able to respond with the relevant output for a prediction. For more information, see [Interactive pre-annotations](https://labelstud.io/guide/ml.html#Interactive-pre-annotations).
@@ -368,7 +414,7 @@ class MlClient:
368
414
  task : int
369
415
  ID of task to annotate
370
416
 
371
- context : typing.Optional[typing.Dict[str, typing.Any]]
417
+ context : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
372
418
  Context for ML model
373
419
 
374
420
  request_options : typing.Optional[RequestOptions]
@@ -380,7 +426,7 @@ class MlClient:
380
426
 
381
427
  Examples
382
428
  --------
383
- from label_studio_sdk.client import LabelStudio
429
+ from label_studio_sdk import LabelStudio
384
430
 
385
431
  client = LabelStudio(
386
432
  api_key="YOUR_API_KEY",
@@ -393,7 +439,13 @@ class MlClient:
393
439
  _response = self._client_wrapper.httpx_client.request(
394
440
  f"api/ml/{jsonable_encoder(id)}/interactive-annotating",
395
441
  method="POST",
396
- json={"task": task, "context": context},
442
+ json={
443
+ "task": task,
444
+ "context": context,
445
+ },
446
+ headers={
447
+ "content-type": "application/json",
448
+ },
397
449
  request_options=request_options,
398
450
  omit=OMIT,
399
451
  )
@@ -413,6 +465,7 @@ class MlClient:
413
465
  request_options: typing.Optional[RequestOptions] = None,
414
466
  ) -> None:
415
467
  """
468
+
416
469
  After you connect a model to Label Studio as a machine learning backend and annotate at least one task, you can start training the model. Training logs appear in stdout and the console.
417
470
 
418
471
  For more information, see [Model training](https://labelstud.io/guide/ml.html#Model-training).
@@ -436,7 +489,7 @@ class MlClient:
436
489
 
437
490
  Examples
438
491
  --------
439
- from label_studio_sdk.client import LabelStudio
492
+ from label_studio_sdk import LabelStudio
440
493
 
441
494
  client = LabelStudio(
442
495
  api_key="YOUR_API_KEY",
@@ -448,7 +501,12 @@ class MlClient:
448
501
  _response = self._client_wrapper.httpx_client.request(
449
502
  f"api/ml/{jsonable_encoder(id)}/train",
450
503
  method="POST",
451
- json={"use_ground_truth": use_ground_truth},
504
+ json={
505
+ "use_ground_truth": use_ground_truth,
506
+ },
507
+ headers={
508
+ "content-type": "application/json",
509
+ },
452
510
  request_options=request_options,
453
511
  omit=OMIT,
454
512
  )
@@ -456,7 +514,15 @@ class MlClient:
456
514
  if 200 <= _response.status_code < 300:
457
515
  return
458
516
  if _response.status_code == 500:
459
- raise InternalServerError(pydantic_v1.parse_obj_as(str, _response.json())) # type: ignore
517
+ raise InternalServerError(
518
+ typing.cast(
519
+ str,
520
+ parse_obj_as(
521
+ type_=str, # type: ignore
522
+ object_=_response.json(),
523
+ ),
524
+ )
525
+ )
460
526
  _response_json = _response.json()
461
527
  except JSONDecodeError:
462
528
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -464,6 +530,7 @@ class MlClient:
464
530
 
465
531
  def list_model_versions(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
466
532
  """
533
+
467
534
  Get available versions of the model. You will need to specify an ID for the backend connection. You can find this using [List ML backends](list).
468
535
 
469
536
  Parameters
@@ -479,7 +546,7 @@ class MlClient:
479
546
 
480
547
  Examples
481
548
  --------
482
- from label_studio_sdk.client import LabelStudio
549
+ from label_studio_sdk import LabelStudio
483
550
 
484
551
  client = LabelStudio(
485
552
  api_key="YOUR_API_KEY",
@@ -489,7 +556,9 @@ class MlClient:
489
556
  )
490
557
  """
491
558
  _response = self._client_wrapper.httpx_client.request(
492
- f"api/ml/{jsonable_encoder(id)}/versions", method="GET", request_options=request_options
559
+ f"api/ml/{jsonable_encoder(id)}/versions",
560
+ method="GET",
561
+ request_options=request_options,
493
562
  )
494
563
  try:
495
564
  if 200 <= _response.status_code < 300:
@@ -508,8 +577,10 @@ class AsyncMlClient:
508
577
  self, *, project: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
509
578
  ) -> typing.List[MlBackend]:
510
579
  """
580
+
511
581
  List all configured Machine Learning (ML) backends for a specific project by ID. For more information about ML backends, see [Machine learning integration](https://labelstud.io/guide/ml).
512
582
 
583
+
513
584
  You will need to provide the project ID. This can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using [List all projects](../projects/list).
514
585
 
515
586
  Parameters
@@ -527,19 +598,38 @@ class AsyncMlClient:
527
598
 
528
599
  Examples
529
600
  --------
530
- from label_studio_sdk.client import AsyncLabelStudio
601
+ import asyncio
602
+
603
+ from label_studio_sdk import AsyncLabelStudio
531
604
 
532
605
  client = AsyncLabelStudio(
533
606
  api_key="YOUR_API_KEY",
534
607
  )
535
- await client.ml.list()
608
+
609
+
610
+ async def main() -> None:
611
+ await client.ml.list()
612
+
613
+
614
+ asyncio.run(main())
536
615
  """
537
616
  _response = await self._client_wrapper.httpx_client.request(
538
- "api/ml/", method="GET", params={"project": project}, request_options=request_options
617
+ "api/ml/",
618
+ method="GET",
619
+ params={
620
+ "project": project,
621
+ },
622
+ request_options=request_options,
539
623
  )
540
624
  try:
541
625
  if 200 <= _response.status_code < 300:
542
- return pydantic_v1.parse_obj_as(typing.List[MlBackend], _response.json()) # type: ignore
626
+ return typing.cast(
627
+ typing.List[MlBackend],
628
+ parse_obj_as(
629
+ type_=typing.List[MlBackend], # type: ignore
630
+ object_=_response.json(),
631
+ ),
632
+ )
543
633
  _response_json = _response.json()
544
634
  except JSONDecodeError:
545
635
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -556,11 +646,12 @@ class AsyncMlClient:
556
646
  auth_method: typing.Optional[MlCreateRequestAuthMethod] = OMIT,
557
647
  basic_auth_user: typing.Optional[str] = OMIT,
558
648
  basic_auth_pass: typing.Optional[str] = OMIT,
559
- extra_params: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
649
+ extra_params: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
560
650
  timeout: typing.Optional[int] = OMIT,
561
651
  request_options: typing.Optional[RequestOptions] = None,
562
652
  ) -> MlCreateResponse:
563
653
  """
654
+
564
655
  Add an ML backend to a project. For more information about what you need to configure when adding an ML backend, see [Connect the model to Label studio](https://labelstud.io/guide/ml#Connect-the-model-to-Label-Studio).
565
656
 
566
657
  <Note>If you are using Docker Compose, you may need to adjust your ML backend URL. See [localhost and Docker containers](https://labelstud.io/guide/ml#localhost-and-Docker-containers).</Note>
@@ -593,7 +684,7 @@ class AsyncMlClient:
593
684
  basic_auth_pass : typing.Optional[str]
594
685
  Basic auth password
595
686
 
596
- extra_params : typing.Optional[typing.Dict[str, typing.Any]]
687
+ extra_params : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
597
688
  Extra parameters
598
689
 
599
690
  timeout : typing.Optional[int]
@@ -609,12 +700,20 @@ class AsyncMlClient:
609
700
 
610
701
  Examples
611
702
  --------
612
- from label_studio_sdk.client import AsyncLabelStudio
703
+ import asyncio
704
+
705
+ from label_studio_sdk import AsyncLabelStudio
613
706
 
614
707
  client = AsyncLabelStudio(
615
708
  api_key="YOUR_API_KEY",
616
709
  )
617
- await client.ml.create()
710
+
711
+
712
+ async def main() -> None:
713
+ await client.ml.create()
714
+
715
+
716
+ asyncio.run(main())
618
717
  """
619
718
  _response = await self._client_wrapper.httpx_client.request(
620
719
  "api/ml/",
@@ -631,12 +730,21 @@ class AsyncMlClient:
631
730
  "extra_params": extra_params,
632
731
  "timeout": timeout,
633
732
  },
733
+ headers={
734
+ "content-type": "application/json",
735
+ },
634
736
  request_options=request_options,
635
737
  omit=OMIT,
636
738
  )
637
739
  try:
638
740
  if 200 <= _response.status_code < 300:
639
- return pydantic_v1.parse_obj_as(MlCreateResponse, _response.json()) # type: ignore
741
+ return typing.cast(
742
+ MlCreateResponse,
743
+ parse_obj_as(
744
+ type_=MlCreateResponse, # type: ignore
745
+ object_=_response.json(),
746
+ ),
747
+ )
640
748
  _response_json = _response.json()
641
749
  except JSONDecodeError:
642
750
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -644,6 +752,7 @@ class AsyncMlClient:
644
752
 
645
753
  async def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> MlBackend:
646
754
  """
755
+
647
756
  Get details about a specific ML backend. You will need to specify an ID for the backend connection. You can find this using [List ML backends](list).
648
757
 
649
758
  For more information, see [Machine learning integration](https://labelstud.io/guide/ml).
@@ -663,21 +772,37 @@ class AsyncMlClient:
663
772
 
664
773
  Examples
665
774
  --------
666
- from label_studio_sdk.client import AsyncLabelStudio
775
+ import asyncio
776
+
777
+ from label_studio_sdk import AsyncLabelStudio
667
778
 
668
779
  client = AsyncLabelStudio(
669
780
  api_key="YOUR_API_KEY",
670
781
  )
671
- await client.ml.get(
672
- id=1,
673
- )
782
+
783
+
784
+ async def main() -> None:
785
+ await client.ml.get(
786
+ id=1,
787
+ )
788
+
789
+
790
+ asyncio.run(main())
674
791
  """
675
792
  _response = await self._client_wrapper.httpx_client.request(
676
- f"api/ml/{jsonable_encoder(id)}", method="GET", request_options=request_options
793
+ f"api/ml/{jsonable_encoder(id)}",
794
+ method="GET",
795
+ request_options=request_options,
677
796
  )
678
797
  try:
679
798
  if 200 <= _response.status_code < 300:
680
- return pydantic_v1.parse_obj_as(MlBackend, _response.json()) # type: ignore
799
+ return typing.cast(
800
+ MlBackend,
801
+ parse_obj_as(
802
+ type_=MlBackend, # type: ignore
803
+ object_=_response.json(),
804
+ ),
805
+ )
681
806
  _response_json = _response.json()
682
807
  except JSONDecodeError:
683
808
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -685,6 +810,7 @@ class AsyncMlClient:
685
810
 
686
811
  async def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
687
812
  """
813
+
688
814
  Remove an existing ML backend connection. You will need to specify an ID for the backend connection. You can find this using [List ML backends](list).
689
815
 
690
816
  For more information, see [Machine learning integration](https://labelstud.io/guide/ml).
@@ -703,17 +829,27 @@ class AsyncMlClient:
703
829
 
704
830
  Examples
705
831
  --------
706
- from label_studio_sdk.client import AsyncLabelStudio
832
+ import asyncio
833
+
834
+ from label_studio_sdk import AsyncLabelStudio
707
835
 
708
836
  client = AsyncLabelStudio(
709
837
  api_key="YOUR_API_KEY",
710
838
  )
711
- await client.ml.delete(
712
- id=1,
713
- )
839
+
840
+
841
+ async def main() -> None:
842
+ await client.ml.delete(
843
+ id=1,
844
+ )
845
+
846
+
847
+ asyncio.run(main())
714
848
  """
715
849
  _response = await self._client_wrapper.httpx_client.request(
716
- f"api/ml/{jsonable_encoder(id)}", method="DELETE", request_options=request_options
850
+ f"api/ml/{jsonable_encoder(id)}",
851
+ method="DELETE",
852
+ request_options=request_options,
717
853
  )
718
854
  try:
719
855
  if 200 <= _response.status_code < 300:
@@ -735,11 +871,12 @@ class AsyncMlClient:
735
871
  auth_method: typing.Optional[MlUpdateRequestAuthMethod] = OMIT,
736
872
  basic_auth_user: typing.Optional[str] = OMIT,
737
873
  basic_auth_pass: typing.Optional[str] = OMIT,
738
- extra_params: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
874
+ extra_params: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
739
875
  timeout: typing.Optional[int] = OMIT,
740
876
  request_options: typing.Optional[RequestOptions] = None,
741
877
  ) -> MlUpdateResponse:
742
878
  """
879
+
743
880
  Update the ML backend parameters. You will need to specify an ID for the backend connection. You can find this using [List ML backends](list).
744
881
 
745
882
  For more information, see [Machine learning integration](https://labelstud.io/guide/ml).
@@ -773,7 +910,7 @@ class AsyncMlClient:
773
910
  basic_auth_pass : typing.Optional[str]
774
911
  Basic auth password
775
912
 
776
- extra_params : typing.Optional[typing.Dict[str, typing.Any]]
913
+ extra_params : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
777
914
  Extra parameters
778
915
 
779
916
  timeout : typing.Optional[int]
@@ -789,14 +926,22 @@ class AsyncMlClient:
789
926
 
790
927
  Examples
791
928
  --------
792
- from label_studio_sdk.client import AsyncLabelStudio
929
+ import asyncio
930
+
931
+ from label_studio_sdk import AsyncLabelStudio
793
932
 
794
933
  client = AsyncLabelStudio(
795
934
  api_key="YOUR_API_KEY",
796
935
  )
797
- await client.ml.update(
798
- id=1,
799
- )
936
+
937
+
938
+ async def main() -> None:
939
+ await client.ml.update(
940
+ id=1,
941
+ )
942
+
943
+
944
+ asyncio.run(main())
800
945
  """
801
946
  _response = await self._client_wrapper.httpx_client.request(
802
947
  f"api/ml/{jsonable_encoder(id)}",
@@ -813,12 +958,21 @@ class AsyncMlClient:
813
958
  "extra_params": extra_params,
814
959
  "timeout": timeout,
815
960
  },
961
+ headers={
962
+ "content-type": "application/json",
963
+ },
816
964
  request_options=request_options,
817
965
  omit=OMIT,
818
966
  )
819
967
  try:
820
968
  if 200 <= _response.status_code < 300:
821
- return pydantic_v1.parse_obj_as(MlUpdateResponse, _response.json()) # type: ignore
969
+ return typing.cast(
970
+ MlUpdateResponse,
971
+ parse_obj_as(
972
+ type_=MlUpdateResponse, # type: ignore
973
+ object_=_response.json(),
974
+ ),
975
+ )
822
976
  _response_json = _response.json()
823
977
  except JSONDecodeError:
824
978
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -829,10 +983,11 @@ class AsyncMlClient:
829
983
  id: int,
830
984
  *,
831
985
  task: int,
832
- context: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
986
+ context: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
833
987
  request_options: typing.Optional[RequestOptions] = None,
834
988
  ) -> None:
835
989
  """
990
+
836
991
  Enable interactive pre-annotations for a specific task.
837
992
 
838
993
  ML-assisted labeling with interactive pre-annotations works with image segmentation and object detection tasks using rectangles, ellipses, polygons, brush masks, and keypoints, as well as with HTML and text named entity recognition tasks. Your ML backend must support the type of labeling that you’re performing, recognize the input that you create, and be able to respond with the relevant output for a prediction. For more information, see [Interactive pre-annotations](https://labelstud.io/guide/ml.html#Interactive-pre-annotations).
@@ -849,7 +1004,7 @@ class AsyncMlClient:
849
1004
  task : int
850
1005
  ID of task to annotate
851
1006
 
852
- context : typing.Optional[typing.Dict[str, typing.Any]]
1007
+ context : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
853
1008
  Context for ML model
854
1009
 
855
1010
  request_options : typing.Optional[RequestOptions]
@@ -861,20 +1016,34 @@ class AsyncMlClient:
861
1016
 
862
1017
  Examples
863
1018
  --------
864
- from label_studio_sdk.client import AsyncLabelStudio
1019
+ import asyncio
1020
+
1021
+ from label_studio_sdk import AsyncLabelStudio
865
1022
 
866
1023
  client = AsyncLabelStudio(
867
1024
  api_key="YOUR_API_KEY",
868
1025
  )
869
- await client.ml.predict_interactive(
870
- id=1,
871
- task=1,
872
- )
1026
+
1027
+
1028
+ async def main() -> None:
1029
+ await client.ml.predict_interactive(
1030
+ id=1,
1031
+ task=1,
1032
+ )
1033
+
1034
+
1035
+ asyncio.run(main())
873
1036
  """
874
1037
  _response = await self._client_wrapper.httpx_client.request(
875
1038
  f"api/ml/{jsonable_encoder(id)}/interactive-annotating",
876
1039
  method="POST",
877
- json={"task": task, "context": context},
1040
+ json={
1041
+ "task": task,
1042
+ "context": context,
1043
+ },
1044
+ headers={
1045
+ "content-type": "application/json",
1046
+ },
878
1047
  request_options=request_options,
879
1048
  omit=OMIT,
880
1049
  )
@@ -894,6 +1063,7 @@ class AsyncMlClient:
894
1063
  request_options: typing.Optional[RequestOptions] = None,
895
1064
  ) -> None:
896
1065
  """
1066
+
897
1067
  After you connect a model to Label Studio as a machine learning backend and annotate at least one task, you can start training the model. Training logs appear in stdout and the console.
898
1068
 
899
1069
  For more information, see [Model training](https://labelstud.io/guide/ml.html#Model-training).
@@ -917,19 +1087,32 @@ class AsyncMlClient:
917
1087
 
918
1088
  Examples
919
1089
  --------
920
- from label_studio_sdk.client import AsyncLabelStudio
1090
+ import asyncio
1091
+
1092
+ from label_studio_sdk import AsyncLabelStudio
921
1093
 
922
1094
  client = AsyncLabelStudio(
923
1095
  api_key="YOUR_API_KEY",
924
1096
  )
925
- await client.ml.train(
926
- id=1,
927
- )
1097
+
1098
+
1099
+ async def main() -> None:
1100
+ await client.ml.train(
1101
+ id=1,
1102
+ )
1103
+
1104
+
1105
+ asyncio.run(main())
928
1106
  """
929
1107
  _response = await self._client_wrapper.httpx_client.request(
930
1108
  f"api/ml/{jsonable_encoder(id)}/train",
931
1109
  method="POST",
932
- json={"use_ground_truth": use_ground_truth},
1110
+ json={
1111
+ "use_ground_truth": use_ground_truth,
1112
+ },
1113
+ headers={
1114
+ "content-type": "application/json",
1115
+ },
933
1116
  request_options=request_options,
934
1117
  omit=OMIT,
935
1118
  )
@@ -937,7 +1120,15 @@ class AsyncMlClient:
937
1120
  if 200 <= _response.status_code < 300:
938
1121
  return
939
1122
  if _response.status_code == 500:
940
- raise InternalServerError(pydantic_v1.parse_obj_as(str, _response.json())) # type: ignore
1123
+ raise InternalServerError(
1124
+ typing.cast(
1125
+ str,
1126
+ parse_obj_as(
1127
+ type_=str, # type: ignore
1128
+ object_=_response.json(),
1129
+ ),
1130
+ )
1131
+ )
941
1132
  _response_json = _response.json()
942
1133
  except JSONDecodeError:
943
1134
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -945,6 +1136,7 @@ class AsyncMlClient:
945
1136
 
946
1137
  async def list_model_versions(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
947
1138
  """
1139
+
948
1140
  Get available versions of the model. You will need to specify an ID for the backend connection. You can find this using [List ML backends](list).
949
1141
 
950
1142
  Parameters
@@ -960,17 +1152,27 @@ class AsyncMlClient:
960
1152
 
961
1153
  Examples
962
1154
  --------
963
- from label_studio_sdk.client import AsyncLabelStudio
1155
+ import asyncio
1156
+
1157
+ from label_studio_sdk import AsyncLabelStudio
964
1158
 
965
1159
  client = AsyncLabelStudio(
966
1160
  api_key="YOUR_API_KEY",
967
1161
  )
968
- await client.ml.list_model_versions(
969
- id="id",
970
- )
1162
+
1163
+
1164
+ async def main() -> None:
1165
+ await client.ml.list_model_versions(
1166
+ id="id",
1167
+ )
1168
+
1169
+
1170
+ asyncio.run(main())
971
1171
  """
972
1172
  _response = await self._client_wrapper.httpx_client.request(
973
- f"api/ml/{jsonable_encoder(id)}/versions", method="GET", request_options=request_options
1173
+ f"api/ml/{jsonable_encoder(id)}/versions",
1174
+ method="GET",
1175
+ request_options=request_options,
974
1176
  )
975
1177
  try:
976
1178
  if 200 <= _response.status_code < 300: