@@ -1067,7 +1067,7 @@ async def search(
10671067 sort_by : AssistantSortBy | None = None ,
10681068 sort_order : SortOrder | None = None ,
10691069 select : list [AssistantSelectField ] | None = None ,
1070- include_pagination : Literal [True ],
1070+ response_format : Literal ["object" ],
10711071 headers : Mapping [str , str ] | None = None ,
10721072 params : QueryParamTypes | None = None ,
10731073 ) -> AssistantsSearchResponse : ...
@@ -1084,7 +1084,7 @@ async def search(
10841084 sort_by : AssistantSortBy | None = None ,
10851085 sort_order : SortOrder | None = None ,
10861086 select : list [AssistantSelectField ] | None = None ,
1087- include_pagination : Literal [False ] = False ,
1087+ response_format : Literal ["array" ] = "array" ,
10881088 headers : Mapping [str , str ] | None = None ,
10891089 params : QueryParamTypes | None = None ,
10901090 ) -> list [Assistant ]: ...
@@ -1100,7 +1100,7 @@ async def search(
11001100 sort_by : AssistantSortBy | None = None ,
11011101 sort_order : SortOrder | None = None ,
11021102 select : list [AssistantSelectField ] | None = None ,
1103- include_pagination : bool = False ,
1103+ response_format : Literal [ "array" , "object" ] = "array" ,
11041104 headers : Mapping [str , str ] | None = None ,
11051105 params : QueryParamTypes | None = None ,
11061106 ) -> AssistantsSearchResponse | list [Assistant ]:
@@ -1117,13 +1117,16 @@ async def search(
11171117 sort_by: The field to sort by.
11181118 sort_order: The order to sort by.
11191119 select: Specific assistant fields to include in the response.
1120- include_pagination: When True, include the ``X-Pagination-Next`` header in the return value.
1120+ response_format: Controls the response shape. Use ``"array"`` (default)
1121+ to return a bare list of assistants, or ``"object"`` to return
1122+ a mapping containing assistants plus pagination metadata.
11211123 headers: Optional custom headers to include with the request.
11221124 params: Optional query parameters to include with the request.
11231125
11241126 Returns:
1125- A list of assistants or, when ``include_pagination`` is True, a mapping
1126- with the assistants and the next pagination cursor.
1127+ A list of assistants (when ``response_format=\" array\" ``) or a mapping
1128+ with the assistants and the next pagination cursor (when
1129+ ``response_format=\" object\" ``).
11271130
11281131 ???+ example "Example Usage"
11291132
@@ -1137,15 +1140,16 @@ async def search(
11371140 )
11381141 ```
11391142
1140- ???+ example "Include pagination metadata"
1143+ ???+ example "Return object with pagination metadata"
11411144
11421145 ```python
11431146 client = get_client(url="http://localhost:2024")
1144- result = await client.assistants.search(include_pagination=True )
1147+ result = await client.assistants.search(response_format="object" )
11451148 next_cursor = result["next"]
11461149 assistants = result["assistants"]
11471150 ```
11481151 """
1152+ effective_format : Literal ["array" , "object" ] = response_format
11491153 payload : dict [str , Any ] = {
11501154 "limit" : limit ,
11511155 "offset" : offset ,
@@ -1175,10 +1179,12 @@ def capture_pagination(response: httpx.Response) -> None:
11751179 json = payload ,
11761180 headers = headers ,
11771181 params = params ,
1178- on_response = capture_pagination if include_pagination else None ,
1182+ on_response = capture_pagination
1183+ if effective_format == "object"
1184+ else None ,
11791185 ),
11801186 )
1181- if include_pagination :
1187+ if effective_format == "object" :
11821188 return {"assistants" : assistants , "next" : next_cursor }
11831189 return assistants
11841190
@@ -4401,7 +4407,7 @@ def search(
44014407 sort_by : AssistantSortBy | None = None ,
44024408 sort_order : SortOrder | None = None ,
44034409 select : list [AssistantSelectField ] | None = None ,
4404- include_pagination : Literal [True ],
4410+ response_format : Literal ["object" ],
44054411 headers : Mapping [str , str ] | None = None ,
44064412 params : QueryParamTypes | None = None ,
44074413 ) -> AssistantsSearchResponse : ...
@@ -4418,7 +4424,7 @@ def search(
44184424 sort_by : AssistantSortBy | None = None ,
44194425 sort_order : SortOrder | None = None ,
44204426 select : list [AssistantSelectField ] | None = None ,
4421- include_pagination : Literal [False ] = False ,
4427+ response_format : Literal ["array" ] = "array" ,
44224428 headers : Mapping [str , str ] | None = None ,
44234429 params : QueryParamTypes | None = None ,
44244430 ) -> list [Assistant ]: ...
@@ -4434,7 +4440,7 @@ def search(
44344440 sort_by : AssistantSortBy | None = None ,
44354441 sort_order : SortOrder | None = None ,
44364442 select : list [AssistantSelectField ] | None = None ,
4437- include_pagination : bool = False ,
4443+ response_format : Literal [ "array" , "object" ] = "array" ,
44384444 headers : Mapping [str , str ] | None = None ,
44394445 params : QueryParamTypes | None = None ,
44404446 ) -> AssistantsSearchResponse | list [Assistant ]:
@@ -4451,12 +4457,15 @@ def search(
44514457 sort_by: The field to sort by.
44524458 sort_order: The order to sort by.
44534459 select: Specific assistant fields to include in the response.
4454- include_pagination: When True, include the ``X-Pagination-Next`` header in the return value.
4460+ response_format: Controls the response shape. Use ``"array"`` (default)
4461+ to return a bare list of assistants, or ``"object"`` to return
4462+ a mapping containing assistants plus pagination metadata.
44554463 headers: Optional custom headers to include with the request.
44564464
44574465 Returns:
4458- A list of assistants or, when ``include_pagination`` is True, a mapping
4459- with the assistants and the next pagination cursor.
4466+ A list of assistants (when ``response_format=\" array\" ``) or a mapping
4467+ with the assistants and the next pagination cursor (when
4468+ ``response_format=\" object\" ``).
44604469
44614470 ???+ example "Example Usage"
44624471
@@ -4470,15 +4479,16 @@ def search(
44704479 )
44714480 ```
44724481
4473- ???+ example "Include pagination metadata"
4482+ ???+ example "Return object with pagination metadata"
44744483
44754484 ```python
44764485 client = get_sync_client(url="http://localhost:2024")
4477- result = client.assistants.search(include_pagination=True )
4486+ result = client.assistants.search(response_format="object" )
44784487 next_cursor = result["next"]
44794488 assistants = result["assistants"]
44804489 ```
44814490 """
4491+ effective_format : Literal ["array" , "object" ] = response_format
44824492 payload : dict [str , Any ] = {
44834493 "limit" : limit ,
44844494 "offset" : offset ,
@@ -4508,10 +4518,12 @@ def capture_pagination(response: httpx.Response) -> None:
45084518 json = payload ,
45094519 headers = headers ,
45104520 params = params ,
4511- on_response = capture_pagination if include_pagination else None ,
4521+ on_response = capture_pagination
4522+ if effective_format == "object"
4523+ else None ,
45124524 ),
45134525 )
4514- if include_pagination :
4526+ if effective_format == "object" :
45154527 return {"assistants" : assistants , "next" : next_cursor }
45164528 return assistants
45174529
0 commit comments