Skip to content

Commit 6187633

Browse files
deppprobot-ci-heartex
authored andcommitted
feat: redesign Prompts list and detail pages
GitOrigin-RevId: 461bd44ec80408067a99c77aa9994fe37817193a
1 parent 14c9d5c commit 6187633

8 files changed

Lines changed: 127 additions & 26 deletions

File tree

poetry.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

reference.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6357,7 +6357,7 @@ client.prompts.subsets(
63576357
</dl>
63586358
</details>
63596359

6360-
<details><summary><code>client.prompts.<a href="src/label_studio_sdk/prompts/client.py">list</a>(...) -> typing.List[ModelInterfaceSerializerGet]</code></summary>
6360+
<details><summary><code>client.prompts.<a href="src/label_studio_sdk/prompts/client.py">list</a>(...) -> PaginatedModelInterfaceSerializerGetList</code></summary>
63616361
<dl>
63626362
<dd>
63636363

@@ -6416,6 +6416,22 @@ client.prompts.list()
64166416
<dl>
64176417
<dd>
64186418

6419+
**page:** `typing.Optional[int]` — A page number within the paginated result set.
6420+
6421+
</dd>
6422+
</dl>
6423+
6424+
<dl>
6425+
<dd>
6426+
6427+
**search:** `typing.Optional[str]` — A search term.
6428+
6429+
</dd>
6430+
</dl>
6431+
6432+
<dl>
6433+
<dd>
6434+
64196435
**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
64206436

64216437
</dd>

src/label_studio_sdk/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@
157157
PaginatedLseOrganizationMemberListList,
158158
PaginatedLseProjectCountsList,
159159
PaginatedLseUserList,
160+
PaginatedModelInterfaceSerializerGetList,
160161
PaginatedOrganizationMemberTagList,
161162
PaginatedPaginatedProjectMemberList,
162163
PaginatedProjectMember,
@@ -574,6 +575,7 @@
574575
"PaginatedLseOrganizationMemberListList": ".types",
575576
"PaginatedLseProjectCountsList": ".types",
576577
"PaginatedLseUserList": ".types",
578+
"PaginatedModelInterfaceSerializerGetList": ".types",
577579
"PaginatedOrganizationMemberTagList": ".types",
578580
"PaginatedPaginatedProjectMemberList": ".types",
579581
"PaginatedProjectMember": ".types",
@@ -948,6 +950,7 @@ def __dir__():
948950
"PaginatedLseOrganizationMemberListList",
949951
"PaginatedLseProjectCountsList",
950952
"PaginatedLseUserList",
953+
"PaginatedModelInterfaceSerializerGetList",
951954
"PaginatedOrganizationMemberTagList",
952955
"PaginatedPaginatedProjectMemberList",
953956
"PaginatedProjectMember",

src/label_studio_sdk/prompts/client.py

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from ..types.model_interface import ModelInterface
1212
from ..types.model_interface_serializer_get import ModelInterfaceSerializerGet
1313
from ..types.paginated_all_roles_project_list_list import PaginatedAllRolesProjectListList
14+
from ..types.paginated_model_interface_serializer_get_list import PaginatedModelInterfaceSerializerGetList
1415
from ..types.paginated_project_subset_tasks_response_list import PaginatedProjectSubsetTasksResponseList
1516
from ..types.project_subset_item import ProjectSubsetItem
1617
from ..types.skill_name_enum import SkillNameEnum
@@ -290,8 +291,13 @@ def subsets(
290291
return _response.data
291292

292293
def list(
293-
self, *, ordering: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
294-
) -> typing.List[ModelInterfaceSerializerGet]:
294+
self,
295+
*,
296+
ordering: typing.Optional[str] = None,
297+
page: typing.Optional[int] = None,
298+
search: typing.Optional[str] = None,
299+
request_options: typing.Optional[RequestOptions] = None,
300+
) -> PaginatedModelInterfaceSerializerGetList:
295301
"""
296302
List all prompts.
297303
@@ -300,12 +306,18 @@ def list(
300306
ordering : typing.Optional[str]
301307
Which field to use when ordering the results.
302308
309+
page : typing.Optional[int]
310+
A page number within the paginated result set.
311+
312+
search : typing.Optional[str]
313+
A search term.
314+
303315
request_options : typing.Optional[RequestOptions]
304316
Request-specific configuration.
305317
306318
Returns
307319
-------
308-
typing.List[ModelInterfaceSerializerGet]
320+
PaginatedModelInterfaceSerializerGetList
309321
310322
311323
Examples
@@ -317,7 +329,7 @@ def list(
317329
)
318330
client.prompts.list()
319331
"""
320-
_response = self._raw_client.list(ordering=ordering, request_options=request_options)
332+
_response = self._raw_client.list(ordering=ordering, page=page, search=search, request_options=request_options)
321333
return _response.data
322334

323335
def create(
@@ -918,8 +930,13 @@ async def main() -> None:
918930
return _response.data
919931

920932
async def list(
921-
self, *, ordering: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
922-
) -> typing.List[ModelInterfaceSerializerGet]:
933+
self,
934+
*,
935+
ordering: typing.Optional[str] = None,
936+
page: typing.Optional[int] = None,
937+
search: typing.Optional[str] = None,
938+
request_options: typing.Optional[RequestOptions] = None,
939+
) -> PaginatedModelInterfaceSerializerGetList:
923940
"""
924941
List all prompts.
925942
@@ -928,12 +945,18 @@ async def list(
928945
ordering : typing.Optional[str]
929946
Which field to use when ordering the results.
930947
948+
page : typing.Optional[int]
949+
A page number within the paginated result set.
950+
951+
search : typing.Optional[str]
952+
A search term.
953+
931954
request_options : typing.Optional[RequestOptions]
932955
Request-specific configuration.
933956
934957
Returns
935958
-------
936-
typing.List[ModelInterfaceSerializerGet]
959+
PaginatedModelInterfaceSerializerGetList
937960
938961
939962
Examples
@@ -953,7 +976,9 @@ async def main() -> None:
953976
954977
asyncio.run(main())
955978
"""
956-
_response = await self._raw_client.list(ordering=ordering, request_options=request_options)
979+
_response = await self._raw_client.list(
980+
ordering=ordering, page=page, search=search, request_options=request_options
981+
)
957982
return _response.data
958983

959984
async def create(

src/label_studio_sdk/prompts/raw_client.py

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from ..types.model_interface import ModelInterface
1818
from ..types.model_interface_serializer_get import ModelInterfaceSerializerGet
1919
from ..types.paginated_all_roles_project_list_list import PaginatedAllRolesProjectListList
20+
from ..types.paginated_model_interface_serializer_get_list import PaginatedModelInterfaceSerializerGetList
2021
from ..types.paginated_project_subset_tasks_response_list import PaginatedProjectSubsetTasksResponseList
2122
from ..types.project_subset_item import ProjectSubsetItem
2223
from ..types.skill_name_enum import SkillNameEnum
@@ -340,8 +341,13 @@ def subsets(
340341
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
341342

342343
def list(
343-
self, *, ordering: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
344-
) -> HttpResponse[typing.List[ModelInterfaceSerializerGet]]:
344+
self,
345+
*,
346+
ordering: typing.Optional[str] = None,
347+
page: typing.Optional[int] = None,
348+
search: typing.Optional[str] = None,
349+
request_options: typing.Optional[RequestOptions] = None,
350+
) -> HttpResponse[PaginatedModelInterfaceSerializerGetList]:
345351
"""
346352
List all prompts.
347353
@@ -350,28 +356,36 @@ def list(
350356
ordering : typing.Optional[str]
351357
Which field to use when ordering the results.
352358
359+
page : typing.Optional[int]
360+
A page number within the paginated result set.
361+
362+
search : typing.Optional[str]
363+
A search term.
364+
353365
request_options : typing.Optional[RequestOptions]
354366
Request-specific configuration.
355367
356368
Returns
357369
-------
358-
HttpResponse[typing.List[ModelInterfaceSerializerGet]]
370+
HttpResponse[PaginatedModelInterfaceSerializerGetList]
359371
360372
"""
361373
_response = self._client_wrapper.httpx_client.request(
362374
"api/prompts/",
363375
method="GET",
364376
params={
365377
"ordering": ordering,
378+
"page": page,
379+
"search": search,
366380
},
367381
request_options=request_options,
368382
)
369383
try:
370384
if 200 <= _response.status_code < 300:
371385
_data = typing.cast(
372-
typing.List[ModelInterfaceSerializerGet],
386+
PaginatedModelInterfaceSerializerGetList,
373387
construct_type(
374-
type_=typing.List[ModelInterfaceSerializerGet], # type: ignore
388+
type_=PaginatedModelInterfaceSerializerGetList, # type: ignore
375389
object_=_response.json(),
376390
),
377391
)
@@ -1033,8 +1047,13 @@ async def subsets(
10331047
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
10341048

10351049
async def list(
1036-
self, *, ordering: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
1037-
) -> AsyncHttpResponse[typing.List[ModelInterfaceSerializerGet]]:
1050+
self,
1051+
*,
1052+
ordering: typing.Optional[str] = None,
1053+
page: typing.Optional[int] = None,
1054+
search: typing.Optional[str] = None,
1055+
request_options: typing.Optional[RequestOptions] = None,
1056+
) -> AsyncHttpResponse[PaginatedModelInterfaceSerializerGetList]:
10381057
"""
10391058
List all prompts.
10401059
@@ -1043,28 +1062,36 @@ async def list(
10431062
ordering : typing.Optional[str]
10441063
Which field to use when ordering the results.
10451064
1065+
page : typing.Optional[int]
1066+
A page number within the paginated result set.
1067+
1068+
search : typing.Optional[str]
1069+
A search term.
1070+
10461071
request_options : typing.Optional[RequestOptions]
10471072
Request-specific configuration.
10481073
10491074
Returns
10501075
-------
1051-
AsyncHttpResponse[typing.List[ModelInterfaceSerializerGet]]
1076+
AsyncHttpResponse[PaginatedModelInterfaceSerializerGetList]
10521077
10531078
"""
10541079
_response = await self._client_wrapper.httpx_client.request(
10551080
"api/prompts/",
10561081
method="GET",
10571082
params={
10581083
"ordering": ordering,
1084+
"page": page,
1085+
"search": search,
10591086
},
10601087
request_options=request_options,
10611088
)
10621089
try:
10631090
if 200 <= _response.status_code < 300:
10641091
_data = typing.cast(
1065-
typing.List[ModelInterfaceSerializerGet],
1092+
PaginatedModelInterfaceSerializerGetList,
10661093
construct_type(
1067-
type_=typing.List[ModelInterfaceSerializerGet], # type: ignore
1094+
type_=PaginatedModelInterfaceSerializerGetList, # type: ignore
10681095
object_=_response.json(),
10691096
),
10701097
)

src/label_studio_sdk/types/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@
162162
from .paginated_lse_organization_member_list_list import PaginatedLseOrganizationMemberListList
163163
from .paginated_lse_project_counts_list import PaginatedLseProjectCountsList
164164
from .paginated_lse_user_list import PaginatedLseUserList
165+
from .paginated_model_interface_serializer_get_list import PaginatedModelInterfaceSerializerGetList
165166
from .paginated_organization_member_tag_list import PaginatedOrganizationMemberTagList
166167
from .paginated_paginated_project_member_list import PaginatedPaginatedProjectMemberList
167168
from .paginated_project_member import PaginatedProjectMember
@@ -407,6 +408,7 @@
407408
"PaginatedLseOrganizationMemberListList": ".paginated_lse_organization_member_list_list",
408409
"PaginatedLseProjectCountsList": ".paginated_lse_project_counts_list",
409410
"PaginatedLseUserList": ".paginated_lse_user_list",
411+
"PaginatedModelInterfaceSerializerGetList": ".paginated_model_interface_serializer_get_list",
410412
"PaginatedOrganizationMemberTagList": ".paginated_organization_member_tag_list",
411413
"PaginatedPaginatedProjectMemberList": ".paginated_paginated_project_member_list",
412414
"PaginatedProjectMember": ".paginated_project_member",
@@ -676,6 +678,7 @@ def __dir__():
676678
"PaginatedLseOrganizationMemberListList",
677679
"PaginatedLseProjectCountsList",
678680
"PaginatedLseUserList",
681+
"PaginatedModelInterfaceSerializerGetList",
679682
"PaginatedOrganizationMemberTagList",
680683
"PaginatedPaginatedProjectMemberList",
681684
"PaginatedProjectMember",

src/label_studio_sdk/types/model_interface_serializer_get.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
class ModelInterfaceSerializerGet(UncheckedBaseModel):
1515
associated_projects: typing.Optional[typing.List[AssociatedProject]] = None
16+
best_score: typing.Optional[float] = None
1617
created_at: typing.Optional[dt.datetime] = None
1718
created_by: typing.Optional[UserSimple] = pydantic.Field(default=None)
1819
"""
@@ -28,13 +29,15 @@ class ModelInterfaceSerializerGet(UncheckedBaseModel):
2829
input_fields: typing.Optional[typing.Any] = None
2930
organization: typing.Optional[int] = None
3031
output_classes: typing.Optional[typing.Any] = None
32+
runs_count: typing.Optional[int] = None
3133
skill_name: typing.Optional[SkillNameEnum] = None
3234
title: str = pydantic.Field()
3335
"""
3436
Model name
3537
"""
3638

3739
updated_at: typing.Optional[dt.datetime] = None
40+
versions_count: typing.Optional[int] = None
3841

3942
if IS_PYDANTIC_V2:
4043
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
import typing
4+
5+
import pydantic
6+
from ..core.pydantic_utilities import IS_PYDANTIC_V2
7+
from ..core.unchecked_base_model import UncheckedBaseModel
8+
from .model_interface_serializer_get import ModelInterfaceSerializerGet
9+
10+
11+
class PaginatedModelInterfaceSerializerGetList(UncheckedBaseModel):
12+
count: int
13+
next: typing.Optional[str] = None
14+
previous: typing.Optional[str] = None
15+
results: typing.List[ModelInterfaceSerializerGet]
16+
17+
if IS_PYDANTIC_V2:
18+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
19+
else:
20+
21+
class Config:
22+
frozen = True
23+
smart_union = True
24+
extra = pydantic.Extra.allow

0 commit comments

Comments
 (0)