label-studio-sdk 2.0.4__py3-none-any.whl → 2.0.5__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 (37) hide show
  1. label_studio_sdk/__init__.py +10 -0
  2. label_studio_sdk/activity_logs/__init__.py +5 -0
  3. label_studio_sdk/activity_logs/client.py +246 -0
  4. label_studio_sdk/activity_logs/types/__init__.py +5 -0
  5. label_studio_sdk/activity_logs/types/activity_logs_list_request_method.py +5 -0
  6. label_studio_sdk/base_client.py +4 -0
  7. label_studio_sdk/errors/internal_server_error.py +2 -1
  8. label_studio_sdk/ml/client.py +4 -4
  9. label_studio_sdk/projects/__init__.py +14 -2
  10. label_studio_sdk/projects/client.py +4 -0
  11. label_studio_sdk/projects/metrics/__init__.py +6 -0
  12. label_studio_sdk/projects/metrics/client.py +282 -0
  13. label_studio_sdk/projects/metrics/custom/__init__.py +5 -0
  14. label_studio_sdk/projects/metrics/custom/client.py +535 -0
  15. label_studio_sdk/projects/metrics/custom/types/__init__.py +5 -0
  16. label_studio_sdk/projects/metrics/custom/types/custom_get_lambda_response.py +19 -0
  17. label_studio_sdk/projects/stats/__init__.py +18 -2
  18. label_studio_sdk/projects/stats/client.py +129 -0
  19. label_studio_sdk/projects/stats/types/__init__.py +12 -1
  20. label_studio_sdk/projects/stats/types/stats_total_agreement_response.py +7 -0
  21. label_studio_sdk/projects/stats/types/stats_total_agreement_response_one.py +19 -0
  22. label_studio_sdk/projects/stats/types/stats_total_agreement_response_zero.py +19 -0
  23. label_studio_sdk/types/__init__.py +6 -0
  24. label_studio_sdk/types/activity_log.py +49 -0
  25. label_studio_sdk/types/activity_log_response.py +28 -0
  26. label_studio_sdk/types/metric_param.py +31 -0
  27. label_studio_sdk/workspaces/members/__init__.py +4 -0
  28. label_studio_sdk/workspaces/members/bulk/__init__.py +5 -0
  29. label_studio_sdk/workspaces/members/bulk/client.py +273 -0
  30. label_studio_sdk/workspaces/members/bulk/types/__init__.py +6 -0
  31. label_studio_sdk/workspaces/members/bulk/types/bulk_delete_response.py +19 -0
  32. label_studio_sdk/workspaces/members/bulk/types/bulk_post_response.py +19 -0
  33. label_studio_sdk/workspaces/members/client.py +4 -0
  34. {label_studio_sdk-2.0.4.dist-info → label_studio_sdk-2.0.5.dist-info}/METADATA +1 -1
  35. {label_studio_sdk-2.0.4.dist-info → label_studio_sdk-2.0.5.dist-info}/RECORD +37 -16
  36. {label_studio_sdk-2.0.4.dist-info → label_studio_sdk-2.0.5.dist-info}/LICENSE +0 -0
  37. {label_studio_sdk-2.0.4.dist-info → label_studio_sdk-2.0.5.dist-info}/WHEEL +0 -0
@@ -0,0 +1,282 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from ...core.client_wrapper import SyncClientWrapper
5
+ from .custom.client import CustomClient
6
+ from ...core.request_options import RequestOptions
7
+ from ...types.metric_param import MetricParam
8
+ from ...core.jsonable_encoder import jsonable_encoder
9
+ from ...core.unchecked_base_model import construct_type
10
+ from json.decoder import JSONDecodeError
11
+ from ...core.api_error import ApiError
12
+ from ...core.client_wrapper import AsyncClientWrapper
13
+ from .custom.client import AsyncCustomClient
14
+
15
+ # this is used as the default value for optional parameters
16
+ OMIT = typing.cast(typing.Any, ...)
17
+
18
+
19
+ class MetricsClient:
20
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
21
+ self._client_wrapper = client_wrapper
22
+ self.custom = CustomClient(client_wrapper=self._client_wrapper)
23
+
24
+ def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> MetricParam:
25
+ """
26
+ Get the current metrics configuration for a project.
27
+
28
+ Parameters
29
+ ----------
30
+ id : int
31
+
32
+ request_options : typing.Optional[RequestOptions]
33
+ Request-specific configuration.
34
+
35
+ Returns
36
+ -------
37
+ MetricParam
38
+ Current metrics configuration
39
+
40
+ Examples
41
+ --------
42
+ from label_studio_sdk import LabelStudio
43
+
44
+ client = LabelStudio(
45
+ api_key="YOUR_API_KEY",
46
+ )
47
+ client.projects.metrics.get(
48
+ id=1,
49
+ )
50
+ """
51
+ _response = self._client_wrapper.httpx_client.request(
52
+ f"api/projects/{jsonable_encoder(id)}/metricparam/",
53
+ method="GET",
54
+ request_options=request_options,
55
+ )
56
+ try:
57
+ if 200 <= _response.status_code < 300:
58
+ return typing.cast(
59
+ MetricParam,
60
+ construct_type(
61
+ type_=MetricParam, # type: ignore
62
+ object_=_response.json(),
63
+ ),
64
+ )
65
+ _response_json = _response.json()
66
+ except JSONDecodeError:
67
+ raise ApiError(status_code=_response.status_code, body=_response.text)
68
+ raise ApiError(status_code=_response.status_code, body=_response_json)
69
+
70
+ def update(
71
+ self,
72
+ id: int,
73
+ *,
74
+ additional_params: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
75
+ agreement_threshold: typing.Optional[int] = OMIT,
76
+ max_additional_annotators_assignable: typing.Optional[int] = OMIT,
77
+ metric_name: typing.Optional[str] = OMIT,
78
+ request_options: typing.Optional[RequestOptions] = None,
79
+ ) -> MetricParam:
80
+ """
81
+ Update metrics strategy and parameters for a project.
82
+
83
+ Parameters
84
+ ----------
85
+ id : int
86
+
87
+ additional_params : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
88
+
89
+ agreement_threshold : typing.Optional[int]
90
+
91
+ max_additional_annotators_assignable : typing.Optional[int]
92
+
93
+ metric_name : typing.Optional[str]
94
+
95
+ request_options : typing.Optional[RequestOptions]
96
+ Request-specific configuration.
97
+
98
+ Returns
99
+ -------
100
+ MetricParam
101
+ Updated metrics configuration
102
+
103
+ Examples
104
+ --------
105
+ from label_studio_sdk import LabelStudio
106
+
107
+ client = LabelStudio(
108
+ api_key="YOUR_API_KEY",
109
+ )
110
+ client.projects.metrics.update(
111
+ id=1,
112
+ )
113
+ """
114
+ _response = self._client_wrapper.httpx_client.request(
115
+ f"api/projects/{jsonable_encoder(id)}/metricparam/",
116
+ method="POST",
117
+ json={
118
+ "additional_params": additional_params,
119
+ "agreement_threshold": agreement_threshold,
120
+ "max_additional_annotators_assignable": max_additional_annotators_assignable,
121
+ "metric_name": metric_name,
122
+ },
123
+ headers={
124
+ "content-type": "application/json",
125
+ },
126
+ request_options=request_options,
127
+ omit=OMIT,
128
+ )
129
+ try:
130
+ if 200 <= _response.status_code < 300:
131
+ return typing.cast(
132
+ MetricParam,
133
+ construct_type(
134
+ type_=MetricParam, # type: ignore
135
+ object_=_response.json(),
136
+ ),
137
+ )
138
+ _response_json = _response.json()
139
+ except JSONDecodeError:
140
+ raise ApiError(status_code=_response.status_code, body=_response.text)
141
+ raise ApiError(status_code=_response.status_code, body=_response_json)
142
+
143
+
144
+ class AsyncMetricsClient:
145
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
146
+ self._client_wrapper = client_wrapper
147
+ self.custom = AsyncCustomClient(client_wrapper=self._client_wrapper)
148
+
149
+ async def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> MetricParam:
150
+ """
151
+ Get the current metrics configuration for a project.
152
+
153
+ Parameters
154
+ ----------
155
+ id : int
156
+
157
+ request_options : typing.Optional[RequestOptions]
158
+ Request-specific configuration.
159
+
160
+ Returns
161
+ -------
162
+ MetricParam
163
+ Current metrics configuration
164
+
165
+ Examples
166
+ --------
167
+ import asyncio
168
+
169
+ from label_studio_sdk import AsyncLabelStudio
170
+
171
+ client = AsyncLabelStudio(
172
+ api_key="YOUR_API_KEY",
173
+ )
174
+
175
+
176
+ async def main() -> None:
177
+ await client.projects.metrics.get(
178
+ id=1,
179
+ )
180
+
181
+
182
+ asyncio.run(main())
183
+ """
184
+ _response = await self._client_wrapper.httpx_client.request(
185
+ f"api/projects/{jsonable_encoder(id)}/metricparam/",
186
+ method="GET",
187
+ request_options=request_options,
188
+ )
189
+ try:
190
+ if 200 <= _response.status_code < 300:
191
+ return typing.cast(
192
+ MetricParam,
193
+ construct_type(
194
+ type_=MetricParam, # type: ignore
195
+ object_=_response.json(),
196
+ ),
197
+ )
198
+ _response_json = _response.json()
199
+ except JSONDecodeError:
200
+ raise ApiError(status_code=_response.status_code, body=_response.text)
201
+ raise ApiError(status_code=_response.status_code, body=_response_json)
202
+
203
+ async def update(
204
+ self,
205
+ id: int,
206
+ *,
207
+ additional_params: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
208
+ agreement_threshold: typing.Optional[int] = OMIT,
209
+ max_additional_annotators_assignable: typing.Optional[int] = OMIT,
210
+ metric_name: typing.Optional[str] = OMIT,
211
+ request_options: typing.Optional[RequestOptions] = None,
212
+ ) -> MetricParam:
213
+ """
214
+ Update metrics strategy and parameters for a project.
215
+
216
+ Parameters
217
+ ----------
218
+ id : int
219
+
220
+ additional_params : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
221
+
222
+ agreement_threshold : typing.Optional[int]
223
+
224
+ max_additional_annotators_assignable : typing.Optional[int]
225
+
226
+ metric_name : typing.Optional[str]
227
+
228
+ request_options : typing.Optional[RequestOptions]
229
+ Request-specific configuration.
230
+
231
+ Returns
232
+ -------
233
+ MetricParam
234
+ Updated metrics configuration
235
+
236
+ Examples
237
+ --------
238
+ import asyncio
239
+
240
+ from label_studio_sdk import AsyncLabelStudio
241
+
242
+ client = AsyncLabelStudio(
243
+ api_key="YOUR_API_KEY",
244
+ )
245
+
246
+
247
+ async def main() -> None:
248
+ await client.projects.metrics.update(
249
+ id=1,
250
+ )
251
+
252
+
253
+ asyncio.run(main())
254
+ """
255
+ _response = await self._client_wrapper.httpx_client.request(
256
+ f"api/projects/{jsonable_encoder(id)}/metricparam/",
257
+ method="POST",
258
+ json={
259
+ "additional_params": additional_params,
260
+ "agreement_threshold": agreement_threshold,
261
+ "max_additional_annotators_assignable": max_additional_annotators_assignable,
262
+ "metric_name": metric_name,
263
+ },
264
+ headers={
265
+ "content-type": "application/json",
266
+ },
267
+ request_options=request_options,
268
+ omit=OMIT,
269
+ )
270
+ try:
271
+ if 200 <= _response.status_code < 300:
272
+ return typing.cast(
273
+ MetricParam,
274
+ construct_type(
275
+ type_=MetricParam, # type: ignore
276
+ object_=_response.json(),
277
+ ),
278
+ )
279
+ _response_json = _response.json()
280
+ except JSONDecodeError:
281
+ raise ApiError(status_code=_response.status_code, body=_response.text)
282
+ raise ApiError(status_code=_response.status_code, body=_response_json)
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from .types import CustomGetLambdaResponse
4
+
5
+ __all__ = ["CustomGetLambdaResponse"]