label-studio-sdk 2.0.3__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.
- label_studio_sdk/__init__.py +18 -0
- label_studio_sdk/activity_logs/__init__.py +5 -0
- label_studio_sdk/activity_logs/client.py +246 -0
- label_studio_sdk/activity_logs/types/__init__.py +5 -0
- label_studio_sdk/activity_logs/types/activity_logs_list_request_method.py +5 -0
- label_studio_sdk/base_client.py +4 -0
- label_studio_sdk/errors/internal_server_error.py +2 -1
- label_studio_sdk/label_interface/interface.py +0 -4
- label_studio_sdk/ml/client.py +4 -4
- label_studio_sdk/projects/__init__.py +14 -2
- label_studio_sdk/projects/client.py +4 -0
- label_studio_sdk/projects/members/__init__.py +4 -0
- label_studio_sdk/projects/members/bulk/__init__.py +5 -0
- label_studio_sdk/projects/members/bulk/client.py +273 -0
- label_studio_sdk/projects/members/bulk/types/__init__.py +6 -0
- label_studio_sdk/projects/members/bulk/types/bulk_delete_response.py +19 -0
- label_studio_sdk/projects/members/bulk/types/bulk_post_response.py +19 -0
- label_studio_sdk/projects/members/client.py +4 -0
- label_studio_sdk/projects/metrics/__init__.py +6 -0
- label_studio_sdk/projects/metrics/client.py +282 -0
- label_studio_sdk/projects/metrics/custom/__init__.py +5 -0
- label_studio_sdk/projects/metrics/custom/client.py +535 -0
- label_studio_sdk/projects/metrics/custom/types/__init__.py +5 -0
- label_studio_sdk/projects/metrics/custom/types/custom_get_lambda_response.py +19 -0
- label_studio_sdk/projects/stats/__init__.py +18 -2
- label_studio_sdk/projects/stats/client.py +129 -0
- label_studio_sdk/projects/stats/types/__init__.py +12 -1
- label_studio_sdk/projects/stats/types/stats_total_agreement_response.py +7 -0
- label_studio_sdk/projects/stats/types/stats_total_agreement_response_one.py +19 -0
- label_studio_sdk/projects/stats/types/stats_total_agreement_response_zero.py +19 -0
- label_studio_sdk/types/__init__.py +14 -0
- label_studio_sdk/types/activity_log.py +49 -0
- label_studio_sdk/types/activity_log_response.py +28 -0
- label_studio_sdk/types/metric_param.py +31 -0
- label_studio_sdk/types/who_am_i_lse_fields.py +50 -0
- label_studio_sdk/types/who_am_i_lse_fields_onboarding_state.py +8 -0
- label_studio_sdk/types/who_am_i_lse_fields_trial_role.py +8 -0
- label_studio_sdk/types/who_am_i_user.py +49 -0
- label_studio_sdk/users/client.py +9 -8
- label_studio_sdk/workspaces/members/__init__.py +4 -0
- label_studio_sdk/workspaces/members/bulk/__init__.py +5 -0
- label_studio_sdk/workspaces/members/bulk/client.py +273 -0
- label_studio_sdk/workspaces/members/bulk/types/__init__.py +6 -0
- label_studio_sdk/workspaces/members/bulk/types/bulk_delete_response.py +19 -0
- label_studio_sdk/workspaces/members/bulk/types/bulk_post_response.py +19 -0
- label_studio_sdk/workspaces/members/client.py +4 -0
- {label_studio_sdk-2.0.3.dist-info → label_studio_sdk-2.0.5.dist-info}/METADATA +1 -1
- {label_studio_sdk-2.0.3.dist-info → label_studio_sdk-2.0.5.dist-info}/RECORD +50 -20
- {label_studio_sdk-2.0.3.dist-info → label_studio_sdk-2.0.5.dist-info}/LICENSE +0 -0
- {label_studio_sdk-2.0.3.dist-info → label_studio_sdk-2.0.5.dist-info}/WHEEL +0 -0
|
@@ -8,6 +8,7 @@ from ...core.jsonable_encoder import jsonable_encoder
|
|
|
8
8
|
from ...core.unchecked_base_model import construct_type
|
|
9
9
|
from json.decoder import JSONDecodeError
|
|
10
10
|
from ...core.api_error import ApiError
|
|
11
|
+
from .types.stats_total_agreement_response import StatsTotalAgreementResponse
|
|
11
12
|
from ...core.client_wrapper import AsyncClientWrapper
|
|
12
13
|
|
|
13
14
|
|
|
@@ -88,6 +89,66 @@ class StatsClient:
|
|
|
88
89
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
89
90
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
90
91
|
|
|
92
|
+
def total_agreement(
|
|
93
|
+
self,
|
|
94
|
+
id: int,
|
|
95
|
+
*,
|
|
96
|
+
per_label: typing.Optional[bool] = None,
|
|
97
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
98
|
+
) -> StatsTotalAgreementResponse:
|
|
99
|
+
"""
|
|
100
|
+
Overall or per-label total agreement across the project.
|
|
101
|
+
|
|
102
|
+
NOTE: due to an open issue in Fern, SDK clients will raise ApiError upon handling a 204 response. As a workaround, wrap call to this function in a try-except block.
|
|
103
|
+
|
|
104
|
+
Parameters
|
|
105
|
+
----------
|
|
106
|
+
id : int
|
|
107
|
+
|
|
108
|
+
per_label : typing.Optional[bool]
|
|
109
|
+
Return agreement per label
|
|
110
|
+
|
|
111
|
+
request_options : typing.Optional[RequestOptions]
|
|
112
|
+
Request-specific configuration.
|
|
113
|
+
|
|
114
|
+
Returns
|
|
115
|
+
-------
|
|
116
|
+
StatsTotalAgreementResponse
|
|
117
|
+
Total agreement
|
|
118
|
+
|
|
119
|
+
Examples
|
|
120
|
+
--------
|
|
121
|
+
from label_studio_sdk import LabelStudio
|
|
122
|
+
|
|
123
|
+
client = LabelStudio(
|
|
124
|
+
api_key="YOUR_API_KEY",
|
|
125
|
+
)
|
|
126
|
+
client.projects.stats.total_agreement(
|
|
127
|
+
id=1,
|
|
128
|
+
)
|
|
129
|
+
"""
|
|
130
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
131
|
+
f"api/projects/{jsonable_encoder(id)}/stats/total_agreement",
|
|
132
|
+
method="GET",
|
|
133
|
+
params={
|
|
134
|
+
"per_label": per_label,
|
|
135
|
+
},
|
|
136
|
+
request_options=request_options,
|
|
137
|
+
)
|
|
138
|
+
try:
|
|
139
|
+
if 200 <= _response.status_code < 300:
|
|
140
|
+
return typing.cast(
|
|
141
|
+
StatsTotalAgreementResponse,
|
|
142
|
+
construct_type(
|
|
143
|
+
type_=StatsTotalAgreementResponse, # type: ignore
|
|
144
|
+
object_=_response.json(),
|
|
145
|
+
),
|
|
146
|
+
)
|
|
147
|
+
_response_json = _response.json()
|
|
148
|
+
except JSONDecodeError:
|
|
149
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
150
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
151
|
+
|
|
91
152
|
|
|
92
153
|
class AsyncStatsClient:
|
|
93
154
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
@@ -173,3 +234,71 @@ class AsyncStatsClient:
|
|
|
173
234
|
except JSONDecodeError:
|
|
174
235
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
175
236
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
237
|
+
|
|
238
|
+
async def total_agreement(
|
|
239
|
+
self,
|
|
240
|
+
id: int,
|
|
241
|
+
*,
|
|
242
|
+
per_label: typing.Optional[bool] = None,
|
|
243
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
244
|
+
) -> StatsTotalAgreementResponse:
|
|
245
|
+
"""
|
|
246
|
+
Overall or per-label total agreement across the project.
|
|
247
|
+
|
|
248
|
+
NOTE: due to an open issue in Fern, SDK clients will raise ApiError upon handling a 204 response. As a workaround, wrap call to this function in a try-except block.
|
|
249
|
+
|
|
250
|
+
Parameters
|
|
251
|
+
----------
|
|
252
|
+
id : int
|
|
253
|
+
|
|
254
|
+
per_label : typing.Optional[bool]
|
|
255
|
+
Return agreement per label
|
|
256
|
+
|
|
257
|
+
request_options : typing.Optional[RequestOptions]
|
|
258
|
+
Request-specific configuration.
|
|
259
|
+
|
|
260
|
+
Returns
|
|
261
|
+
-------
|
|
262
|
+
StatsTotalAgreementResponse
|
|
263
|
+
Total agreement
|
|
264
|
+
|
|
265
|
+
Examples
|
|
266
|
+
--------
|
|
267
|
+
import asyncio
|
|
268
|
+
|
|
269
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
270
|
+
|
|
271
|
+
client = AsyncLabelStudio(
|
|
272
|
+
api_key="YOUR_API_KEY",
|
|
273
|
+
)
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
async def main() -> None:
|
|
277
|
+
await client.projects.stats.total_agreement(
|
|
278
|
+
id=1,
|
|
279
|
+
)
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
asyncio.run(main())
|
|
283
|
+
"""
|
|
284
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
285
|
+
f"api/projects/{jsonable_encoder(id)}/stats/total_agreement",
|
|
286
|
+
method="GET",
|
|
287
|
+
params={
|
|
288
|
+
"per_label": per_label,
|
|
289
|
+
},
|
|
290
|
+
request_options=request_options,
|
|
291
|
+
)
|
|
292
|
+
try:
|
|
293
|
+
if 200 <= _response.status_code < 300:
|
|
294
|
+
return typing.cast(
|
|
295
|
+
StatsTotalAgreementResponse,
|
|
296
|
+
construct_type(
|
|
297
|
+
type_=StatsTotalAgreementResponse, # type: ignore
|
|
298
|
+
object_=_response.json(),
|
|
299
|
+
),
|
|
300
|
+
)
|
|
301
|
+
_response_json = _response.json()
|
|
302
|
+
except JSONDecodeError:
|
|
303
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
304
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
@@ -4,5 +4,16 @@ from .stats_iaa_response import StatsIaaResponse
|
|
|
4
4
|
from .stats_iaa_response_common_tasks import StatsIaaResponseCommonTasks
|
|
5
5
|
from .stats_iaa_response_iaa import StatsIaaResponseIaa
|
|
6
6
|
from .stats_iaa_response_std import StatsIaaResponseStd
|
|
7
|
+
from .stats_total_agreement_response import StatsTotalAgreementResponse
|
|
8
|
+
from .stats_total_agreement_response_one import StatsTotalAgreementResponseOne
|
|
9
|
+
from .stats_total_agreement_response_zero import StatsTotalAgreementResponseZero
|
|
7
10
|
|
|
8
|
-
__all__ = [
|
|
11
|
+
__all__ = [
|
|
12
|
+
"StatsIaaResponse",
|
|
13
|
+
"StatsIaaResponseCommonTasks",
|
|
14
|
+
"StatsIaaResponseIaa",
|
|
15
|
+
"StatsIaaResponseStd",
|
|
16
|
+
"StatsTotalAgreementResponse",
|
|
17
|
+
"StatsTotalAgreementResponseOne",
|
|
18
|
+
"StatsTotalAgreementResponseZero",
|
|
19
|
+
]
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from .stats_total_agreement_response_zero import StatsTotalAgreementResponseZero
|
|
5
|
+
from .stats_total_agreement_response_one import StatsTotalAgreementResponseOne
|
|
6
|
+
|
|
7
|
+
StatsTotalAgreementResponse = typing.Union[StatsTotalAgreementResponseZero, StatsTotalAgreementResponseOne]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from ....core.unchecked_base_model import UncheckedBaseModel
|
|
4
|
+
import typing
|
|
5
|
+
from ....core.pydantic_utilities import IS_PYDANTIC_V2
|
|
6
|
+
import pydantic
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class StatsTotalAgreementResponseOne(UncheckedBaseModel):
|
|
10
|
+
total_agreement: typing.Optional[typing.Dict[str, float]] = None
|
|
11
|
+
|
|
12
|
+
if IS_PYDANTIC_V2:
|
|
13
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
14
|
+
else:
|
|
15
|
+
|
|
16
|
+
class Config:
|
|
17
|
+
frozen = True
|
|
18
|
+
smart_union = True
|
|
19
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from ....core.unchecked_base_model import UncheckedBaseModel
|
|
4
|
+
import typing
|
|
5
|
+
from ....core.pydantic_utilities import IS_PYDANTIC_V2
|
|
6
|
+
import pydantic
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class StatsTotalAgreementResponseZero(UncheckedBaseModel):
|
|
10
|
+
total_agreement: typing.Optional[float] = None
|
|
11
|
+
|
|
12
|
+
if IS_PYDANTIC_V2:
|
|
13
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
14
|
+
else:
|
|
15
|
+
|
|
16
|
+
class Config:
|
|
17
|
+
frozen = True
|
|
18
|
+
smart_union = True
|
|
19
|
+
extra = pydantic.Extra.allow
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
3
|
from .actions_enum import ActionsEnum
|
|
4
|
+
from .activity_log import ActivityLog
|
|
5
|
+
from .activity_log_response import ActivityLogResponse
|
|
4
6
|
from .all_roles_project_list import AllRolesProjectList
|
|
5
7
|
from .all_roles_project_list_sampling import AllRolesProjectListSampling
|
|
6
8
|
from .all_roles_project_list_skip_queue import AllRolesProjectListSkipQueue
|
|
@@ -99,6 +101,7 @@ from .lseapi_token_create import LseapiTokenCreate
|
|
|
99
101
|
from .lseapi_token_list import LseapiTokenList
|
|
100
102
|
from .lsejwt_settings import LsejwtSettings
|
|
101
103
|
from .maybe_expanded_comment import MaybeExpandedComment
|
|
104
|
+
from .metric_param import MetricParam
|
|
102
105
|
from .ml_backend import MlBackend
|
|
103
106
|
from .mode_enum import ModeEnum
|
|
104
107
|
from .model_interface import ModelInterface
|
|
@@ -182,12 +185,18 @@ from .version_response import VersionResponse
|
|
|
182
185
|
from .view import View
|
|
183
186
|
from .webhook import Webhook
|
|
184
187
|
from .webhook_serializer_for_update import WebhookSerializerForUpdate
|
|
188
|
+
from .who_am_i_lse_fields import WhoAmILseFields
|
|
189
|
+
from .who_am_i_lse_fields_onboarding_state import WhoAmILseFieldsOnboardingState
|
|
190
|
+
from .who_am_i_lse_fields_trial_role import WhoAmILseFieldsTrialRole
|
|
191
|
+
from .who_am_i_user import WhoAmIUser
|
|
185
192
|
from .workspace import Workspace
|
|
186
193
|
from .workspace_member_create import WorkspaceMemberCreate
|
|
187
194
|
from .workspace_member_list import WorkspaceMemberList
|
|
188
195
|
|
|
189
196
|
__all__ = [
|
|
190
197
|
"ActionsEnum",
|
|
198
|
+
"ActivityLog",
|
|
199
|
+
"ActivityLogResponse",
|
|
191
200
|
"AllRolesProjectList",
|
|
192
201
|
"AllRolesProjectListSampling",
|
|
193
202
|
"AllRolesProjectListSkipQueue",
|
|
@@ -284,6 +293,7 @@ __all__ = [
|
|
|
284
293
|
"LseapiTokenList",
|
|
285
294
|
"LsejwtSettings",
|
|
286
295
|
"MaybeExpandedComment",
|
|
296
|
+
"MetricParam",
|
|
287
297
|
"MlBackend",
|
|
288
298
|
"ModeEnum",
|
|
289
299
|
"ModelInterface",
|
|
@@ -367,6 +377,10 @@ __all__ = [
|
|
|
367
377
|
"View",
|
|
368
378
|
"Webhook",
|
|
369
379
|
"WebhookSerializerForUpdate",
|
|
380
|
+
"WhoAmILseFields",
|
|
381
|
+
"WhoAmILseFieldsOnboardingState",
|
|
382
|
+
"WhoAmILseFieldsTrialRole",
|
|
383
|
+
"WhoAmIUser",
|
|
370
384
|
"Workspace",
|
|
371
385
|
"WorkspaceMemberCreate",
|
|
372
386
|
"WorkspaceMemberList",
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from ..core.unchecked_base_model import UncheckedBaseModel
|
|
4
|
+
import datetime as dt
|
|
5
|
+
import typing
|
|
6
|
+
import pydantic
|
|
7
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ActivityLog(UncheckedBaseModel):
|
|
11
|
+
datetime: dt.datetime
|
|
12
|
+
duration: typing.Optional[int] = pydantic.Field(default=None)
|
|
13
|
+
"""
|
|
14
|
+
Duration of response generation in ms
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
email: str
|
|
18
|
+
extra_data: typing.Optional[typing.Optional[typing.Any]] = None
|
|
19
|
+
http_referer: typing.Optional[str] = None
|
|
20
|
+
id: int
|
|
21
|
+
ip_address: typing.Optional[str] = None
|
|
22
|
+
organization_id: typing.Optional[int] = pydantic.Field(default=None)
|
|
23
|
+
"""
|
|
24
|
+
Organization id
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
project_id: typing.Optional[int] = pydantic.Field(default=None)
|
|
28
|
+
"""
|
|
29
|
+
Project id if request has it
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
request_method: str
|
|
33
|
+
request_url: str
|
|
34
|
+
response_code: str
|
|
35
|
+
user_agent: typing.Optional[str] = None
|
|
36
|
+
user_id: int
|
|
37
|
+
workspace_owner_id: typing.Optional[int] = pydantic.Field(default=None)
|
|
38
|
+
"""
|
|
39
|
+
Owner id of workspace where action performed
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
if IS_PYDANTIC_V2:
|
|
43
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
44
|
+
else:
|
|
45
|
+
|
|
46
|
+
class Config:
|
|
47
|
+
frozen = True
|
|
48
|
+
smart_union = True
|
|
49
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from ..core.unchecked_base_model import UncheckedBaseModel
|
|
4
|
+
import typing
|
|
5
|
+
from .activity_log import ActivityLog
|
|
6
|
+
import typing_extensions
|
|
7
|
+
from ..core.serialization import FieldMetadata
|
|
8
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
9
|
+
import pydantic
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ActivityLogResponse(UncheckedBaseModel):
|
|
13
|
+
"""
|
|
14
|
+
Serializer for ActivityLogAPI response.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
data: typing.List[ActivityLog]
|
|
18
|
+
records_filtered: typing_extensions.Annotated[int, FieldMetadata(alias="recordsFiltered")]
|
|
19
|
+
records_total: typing_extensions.Annotated[int, FieldMetadata(alias="recordsTotal")]
|
|
20
|
+
|
|
21
|
+
if IS_PYDANTIC_V2:
|
|
22
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
23
|
+
else:
|
|
24
|
+
|
|
25
|
+
class Config:
|
|
26
|
+
frozen = True
|
|
27
|
+
smart_union = True
|
|
28
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from ..core.unchecked_base_model import UncheckedBaseModel
|
|
4
|
+
import typing
|
|
5
|
+
import pydantic
|
|
6
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class MetricParam(UncheckedBaseModel):
|
|
10
|
+
agreement_threshold: str
|
|
11
|
+
allowed: str
|
|
12
|
+
max_additional_annotators_assignable: typing.Optional[int] = pydantic.Field(default=None)
|
|
13
|
+
"""
|
|
14
|
+
Maximum number of additional annotators that can be assigned to a low agreement task
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
metric_name: typing.Optional[str] = pydantic.Field(default=None)
|
|
18
|
+
"""
|
|
19
|
+
Evaluation metric chosen for this project
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
metric_params: typing.Optional[typing.Optional[typing.Any]] = None
|
|
23
|
+
|
|
24
|
+
if IS_PYDANTIC_V2:
|
|
25
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
26
|
+
else:
|
|
27
|
+
|
|
28
|
+
class Config:
|
|
29
|
+
frozen = True
|
|
30
|
+
smart_union = True
|
|
31
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from ..core.unchecked_base_model import UncheckedBaseModel
|
|
4
|
+
import typing
|
|
5
|
+
import datetime as dt
|
|
6
|
+
from .who_am_i_lse_fields_onboarding_state import WhoAmILseFieldsOnboardingState
|
|
7
|
+
import pydantic
|
|
8
|
+
from .who_am_i_lse_fields_trial_role import WhoAmILseFieldsTrialRole
|
|
9
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class WhoAmILseFields(UncheckedBaseModel):
|
|
13
|
+
active_organization_external_id: typing.Optional[str] = None
|
|
14
|
+
email_notification_settings: str
|
|
15
|
+
invite_activated: typing.Optional[bool] = None
|
|
16
|
+
invite_expired: str
|
|
17
|
+
invite_expired_at: str
|
|
18
|
+
invited_at: typing.Optional[dt.datetime] = None
|
|
19
|
+
invited_by: typing.Optional[int] = None
|
|
20
|
+
onboarding_state: typing.Optional[WhoAmILseFieldsOnboardingState] = pydantic.Field(default=None)
|
|
21
|
+
"""
|
|
22
|
+
The current stage of user onboarding
|
|
23
|
+
|
|
24
|
+
* `not_started` - Not Started
|
|
25
|
+
* `signup` - Signup
|
|
26
|
+
* `trial_signup` - Trial Signup
|
|
27
|
+
* `first_tutorial` - First Tutorial
|
|
28
|
+
* `in_app_guidance` - In App Guidance
|
|
29
|
+
* `complete` - Complete
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
social_auth_finished: typing.Optional[bool] = pydantic.Field(default=None)
|
|
33
|
+
"""
|
|
34
|
+
Is user finished social authentication
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
trial_company: typing.Optional[str] = None
|
|
38
|
+
trial_experience_labeling: typing.Optional[str] = None
|
|
39
|
+
trial_license_enterprise: typing.Optional[bool] = None
|
|
40
|
+
trial_models_in_production: typing.Optional[str] = None
|
|
41
|
+
trial_role: typing.Optional[WhoAmILseFieldsTrialRole] = None
|
|
42
|
+
|
|
43
|
+
if IS_PYDANTIC_V2:
|
|
44
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
45
|
+
else:
|
|
46
|
+
|
|
47
|
+
class Config:
|
|
48
|
+
frozen = True
|
|
49
|
+
smart_union = True
|
|
50
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from .onboarding_state_enum import OnboardingStateEnum
|
|
5
|
+
from .blank_enum import BlankEnum
|
|
6
|
+
from .null_enum import NullEnum
|
|
7
|
+
|
|
8
|
+
WhoAmILseFieldsOnboardingState = typing.Union[OnboardingStateEnum, BlankEnum, NullEnum]
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from .trial_role_enum import TrialRoleEnum
|
|
5
|
+
from .blank_enum import BlankEnum
|
|
6
|
+
from .null_enum import NullEnum
|
|
7
|
+
|
|
8
|
+
WhoAmILseFieldsTrialRole = typing.Union[TrialRoleEnum, BlankEnum, NullEnum]
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from ..core.unchecked_base_model import UncheckedBaseModel
|
|
4
|
+
import typing
|
|
5
|
+
import pydantic
|
|
6
|
+
import datetime as dt
|
|
7
|
+
from .who_am_i_lse_fields import WhoAmILseFields
|
|
8
|
+
from .organization_membership import OrganizationMembership
|
|
9
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class WhoAmIUser(UncheckedBaseModel):
|
|
13
|
+
"""
|
|
14
|
+
A ModelSerializer that takes additional arguments for
|
|
15
|
+
"fields", "omit" and "expand" in order to
|
|
16
|
+
control which fields are displayed, and whether to replace simple
|
|
17
|
+
values with complex, nested serializations
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
active_organization: typing.Optional[int] = None
|
|
21
|
+
active_organization_meta: str
|
|
22
|
+
allow_newsletters: typing.Optional[bool] = pydantic.Field(default=None)
|
|
23
|
+
"""
|
|
24
|
+
Allow sending newsletters to user
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
avatar: str
|
|
28
|
+
custom_hotkeys: typing.Optional[typing.Optional[typing.Any]] = None
|
|
29
|
+
date_joined: typing.Optional[dt.datetime] = None
|
|
30
|
+
email: typing.Optional[str] = None
|
|
31
|
+
first_name: typing.Optional[str] = None
|
|
32
|
+
id: int
|
|
33
|
+
initials: str
|
|
34
|
+
last_activity: dt.datetime
|
|
35
|
+
last_name: typing.Optional[str] = None
|
|
36
|
+
lse_fields: WhoAmILseFields
|
|
37
|
+
org_membership: typing.List[OrganizationMembership]
|
|
38
|
+
pause: str
|
|
39
|
+
phone: typing.Optional[str] = None
|
|
40
|
+
username: str
|
|
41
|
+
|
|
42
|
+
if IS_PYDANTIC_V2:
|
|
43
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
44
|
+
else:
|
|
45
|
+
|
|
46
|
+
class Config:
|
|
47
|
+
frozen = True
|
|
48
|
+
smart_union = True
|
|
49
|
+
extra = pydantic.Extra.allow
|
label_studio_sdk/users/client.py
CHANGED
|
@@ -11,6 +11,7 @@ import datetime as dt
|
|
|
11
11
|
from ..types.hotkeys import Hotkeys
|
|
12
12
|
from .types.users_reset_token_response import UsersResetTokenResponse
|
|
13
13
|
from .types.users_get_token_response import UsersGetTokenResponse
|
|
14
|
+
from ..types.who_am_i_user import WhoAmIUser
|
|
14
15
|
from ..types.lse_user import LseUser
|
|
15
16
|
from ..core.jsonable_encoder import jsonable_encoder
|
|
16
17
|
from ..core.client_wrapper import AsyncClientWrapper
|
|
@@ -348,7 +349,7 @@ class UsersClient:
|
|
|
348
349
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
349
350
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
350
351
|
|
|
351
|
-
def whoami(self, *, request_options: typing.Optional[RequestOptions] = None) ->
|
|
352
|
+
def whoami(self, *, request_options: typing.Optional[RequestOptions] = None) -> WhoAmIUser:
|
|
352
353
|
"""
|
|
353
354
|
Retrieve details of the account that you are using to access the API.
|
|
354
355
|
|
|
@@ -359,7 +360,7 @@ class UsersClient:
|
|
|
359
360
|
|
|
360
361
|
Returns
|
|
361
362
|
-------
|
|
362
|
-
|
|
363
|
+
WhoAmIUser
|
|
363
364
|
|
|
364
365
|
|
|
365
366
|
Examples
|
|
@@ -379,9 +380,9 @@ class UsersClient:
|
|
|
379
380
|
try:
|
|
380
381
|
if 200 <= _response.status_code < 300:
|
|
381
382
|
return typing.cast(
|
|
382
|
-
|
|
383
|
+
WhoAmIUser,
|
|
383
384
|
construct_type(
|
|
384
|
-
type_=
|
|
385
|
+
type_=WhoAmIUser, # type: ignore
|
|
385
386
|
object_=_response.json(),
|
|
386
387
|
),
|
|
387
388
|
)
|
|
@@ -1109,7 +1110,7 @@ class AsyncUsersClient:
|
|
|
1109
1110
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1110
1111
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1111
1112
|
|
|
1112
|
-
async def whoami(self, *, request_options: typing.Optional[RequestOptions] = None) ->
|
|
1113
|
+
async def whoami(self, *, request_options: typing.Optional[RequestOptions] = None) -> WhoAmIUser:
|
|
1113
1114
|
"""
|
|
1114
1115
|
Retrieve details of the account that you are using to access the API.
|
|
1115
1116
|
|
|
@@ -1120,7 +1121,7 @@ class AsyncUsersClient:
|
|
|
1120
1121
|
|
|
1121
1122
|
Returns
|
|
1122
1123
|
-------
|
|
1123
|
-
|
|
1124
|
+
WhoAmIUser
|
|
1124
1125
|
|
|
1125
1126
|
|
|
1126
1127
|
Examples
|
|
@@ -1148,9 +1149,9 @@ class AsyncUsersClient:
|
|
|
1148
1149
|
try:
|
|
1149
1150
|
if 200 <= _response.status_code < 300:
|
|
1150
1151
|
return typing.cast(
|
|
1151
|
-
|
|
1152
|
+
WhoAmIUser,
|
|
1152
1153
|
construct_type(
|
|
1153
|
-
type_=
|
|
1154
|
+
type_=WhoAmIUser, # type: ignore
|
|
1154
1155
|
object_=_response.json(),
|
|
1155
1156
|
),
|
|
1156
1157
|
)
|