Skip to content

Commit 9f35d60

Browse files
jameszyaoSimsonW
authored andcommitted
fix: remove offset from list api
1 parent 85314ca commit 9f35d60

File tree

14 files changed

+56
-119
lines changed

14 files changed

+56
-119
lines changed

taskingai/assistant/assistant.py

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
def list_assistants(
2929
order: str = "desc",
3030
limit: int = 20,
31-
offset: Optional[int] = None,
3231
after: Optional[str] = None,
3332
before: Optional[str] = None,
3433
) -> List[Assistant]:
@@ -38,22 +37,19 @@ def list_assistants(
3837
3938
:param order: The order of the assistants. It can be "asc" or "desc".
4039
:param limit: The maximum number of assistants to return.
41-
:param offset: The offset of the assistants.
4240
:param after: The cursor to get the next page of assistants.
4341
:param before: The cursor to get the previous page of assistants.
4442
:return: The list of assistants.
4543
"""
46-
# verify only one of offset, after and before is not None
47-
offset_params = [offset, after, before]
48-
if sum([1 if param is not None else 0 for param in offset_params]) > 1:
49-
raise ValueError("Only one of offset, after and before can be specified.")
44+
45+
if after and before:
46+
raise ValueError("Only one of after and before can be specified.")
5047

5148
api_instance = get_api_instance(ModuleType.assistant)
5249
# only add non-None parameters
5350
params = {
5451
"order": order,
5552
"limit": limit,
56-
"offset": offset,
5753
"after": after,
5854
"before": before,
5955
}
@@ -62,36 +58,31 @@ def list_assistants(
6258
assistants: List[Assistant] = [Assistant(**item) for item in response.data]
6359
return assistants
6460

61+
6562
async def a_list_assistants(
66-
order: str = "desc",
67-
limit: int = 20,
68-
offset: Optional[int] = None,
69-
after: Optional[str] = None,
70-
before: Optional[str] = None,
63+
order: str = "desc",
64+
limit: int = 20,
65+
after: Optional[str] = None,
66+
before: Optional[str] = None,
7167
) -> List[Assistant]:
72-
7368
"""
74-
List assistants in async mode.
69+
List assistants.
7570
7671
:param order: The order of the assistants. It can be "asc" or "desc".
7772
:param limit: The maximum number of assistants to return.
78-
:param offset: The offset of the assistants.
7973
:param after: The cursor to get the next page of assistants.
8074
:param before: The cursor to get the previous page of assistants.
8175
:return: The list of assistants.
8276
"""
8377

84-
# verify only one of offset, after and before is not None
85-
offset_params = [offset, after, before]
86-
if sum([1 if param is not None else 0 for param in offset_params]) > 1:
87-
raise ValueError("Only one of offset, after and before can be specified.")
78+
if after and before:
79+
raise ValueError("Only one of after and before can be specified.")
8880

8981
api_instance = get_api_instance(ModuleType.assistant, async_client=True)
9082
# only add non-None parameters
9183
params = {
9284
"order": order,
9385
"limit": limit,
94-
"offset": offset,
9586
"after": after,
9687
"before": before,
9788
}

taskingai/assistant/chat.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ def list_chats(
3737
:param before: The cursor to get the previous page of chats.
3838
:return: The list of chats.
3939
"""
40+
if after and before:
41+
raise ValueError("Only one of after and before can be specified.")
4042

4143
api_instance = get_api_instance(ModuleType.assistant)
4244
# only add non-None parameters
@@ -71,6 +73,8 @@ async def a_list_chats(
7173
:param before: The cursor to get the previous page of chats.
7274
:return: The list of chats.
7375
"""
76+
if after and before:
77+
raise ValueError("Only one of after and before can be specified.")
7478

7579
api_instance = get_api_instance(ModuleType.assistant, async_client=True)
7680
# only add non-None parameters

taskingai/assistant/message.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ def list_messages(
5555
:param before: The cursor to get the previous page of messages.
5656
:return: The list of messages.
5757
"""
58-
offset_params = [after, before]
59-
if sum([1 if param is not None else 0 for param in offset_params]) > 1:
58+
if after and before:
6059
raise ValueError("Only one of after and before can be specified.")
6160

6261
api_instance = get_api_instance(ModuleType.assistant)
@@ -96,8 +95,7 @@ async def a_list_messages(
9695
:param before: The cursor to get the previous page of messages.
9796
:return: The list of messages.
9897
"""
99-
offset_params = [after, before]
100-
if sum([1 if param is not None else 0 for param in offset_params]) > 1:
98+
if after and before:
10199
raise ValueError("Only one of after and before can be specified.")
102100

103101
api_instance = get_api_instance(ModuleType.assistant, async_client=True)

taskingai/client/api/assistant_api.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,6 @@ def list_assistants(self, **kwargs): # noqa: E501
968968
:param object order:
969969
:param object after:
970970
:param object before:
971-
:param object offset:
972971
:return: AssistantListResponse
973972
If the method is called asynchronously,
974973
returns the request thread.
@@ -994,13 +993,12 @@ def list_assistants_with_http_info(self, **kwargs): # noqa: E501
994993
:param object order:
995994
:param object after:
996995
:param object before:
997-
:param object offset:
998996
:return: AssistantListResponse
999997
If the method is called asynchronously,
1000998
returns the request thread.
1001999
"""
10021000

1003-
all_params = ['limit', 'order', 'after', 'before', 'offset'] # noqa: E501
1001+
all_params = ['limit', 'order', 'after', 'before'] # noqa: E501
10041002
all_params.append('async_req')
10051003
all_params.append('_return_http_data_only')
10061004
all_params.append('_preload_content')
@@ -1029,8 +1027,6 @@ def list_assistants_with_http_info(self, **kwargs): # noqa: E501
10291027
query_params.append(('after', params['after'])) # noqa: E501
10301028
if 'before' in params:
10311029
query_params.append(('before', params['before'])) # noqa: E501
1032-
if 'offset' in params:
1033-
query_params.append(('offset', params['offset'])) # noqa: E501
10341030

10351031
header_params = {}
10361032

taskingai/client/api/assistant_async_api.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,6 @@ async def list_assistants(self, **kwargs): # noqa: E501
970970
:param object order:
971971
:param object after:
972972
:param object before:
973-
:param object offset:
974973
:return: AssistantListResponse
975974
If the method is called asynchronously,
976975
returns the request thread.
@@ -996,13 +995,12 @@ async def list_assistants_with_http_info(self, **kwargs): # noqa: E501
996995
:param object order:
997996
:param object after:
998997
:param object before:
999-
:param object offset:
1000998
:return: AssistantListResponse
1001999
If the method is called asynchronously,
10021000
returns the request thread.
10031001
"""
10041002

1005-
all_params = ['limit', 'order', 'after', 'before', 'offset'] # noqa: E501
1003+
all_params = ['limit', 'order', 'after', 'before'] # noqa: E501
10061004
all_params.append('async_req')
10071005
all_params.append('_return_http_data_only')
10081006
all_params.append('_preload_content')
@@ -1031,8 +1029,6 @@ async def list_assistants_with_http_info(self, **kwargs): # noqa: E501
10311029
query_params.append(('after', params['after'])) # noqa: E501
10321030
if 'before' in params:
10331031
query_params.append(('before', params['before'])) # noqa: E501
1034-
if 'offset' in params:
1035-
query_params.append(('offset', params['offset'])) # noqa: E501
10361032

10371033
header_params = {}
10381034

taskingai/client/api/retrieval_api.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,6 @@ def list_collections(self, **kwargs): # noqa: E501
633633
:param object order:
634634
:param object after:
635635
:param object before:
636-
:param object offset:
637636
:return: CollectionListResponse
638637
If the method is called asynchronously,
639638
returns the request thread.
@@ -659,13 +658,12 @@ def list_collections_with_http_info(self, **kwargs): # noqa: E501
659658
:param object order:
660659
:param object after:
661660
:param object before:
662-
:param object offset:
663661
:return: CollectionListResponse
664662
If the method is called asynchronously,
665663
returns the request thread.
666664
"""
667665

668-
all_params = ['limit', 'order', 'after', 'before', 'offset'] # noqa: E501
666+
all_params = ['limit', 'order', 'after', 'before'] # noqa: E501
669667
all_params.append('async_req')
670668
all_params.append('_return_http_data_only')
671669
all_params.append('_preload_content')
@@ -694,8 +692,6 @@ def list_collections_with_http_info(self, **kwargs): # noqa: E501
694692
query_params.append(('after', params['after'])) # noqa: E501
695693
if 'before' in params:
696694
query_params.append(('before', params['before'])) # noqa: E501
697-
if 'offset' in params:
698-
query_params.append(('offset', params['offset'])) # noqa: E501
699695

700696
header_params = {}
701697

@@ -740,7 +736,6 @@ def list_records(self, collection_id, **kwargs): # noqa: E501
740736
:param object order:
741737
:param object after:
742738
:param object before:
743-
:param object offset:
744739
:return: RecordListResponse
745740
If the method is called asynchronously,
746741
returns the request thread.
@@ -767,13 +762,12 @@ def list_records_with_http_info(self, collection_id, **kwargs): # noqa: E501
767762
:param object order:
768763
:param object after:
769764
:param object before:
770-
:param object offset:
771765
:return: RecordListResponse
772766
If the method is called asynchronously,
773767
returns the request thread.
774768
"""
775769

776-
all_params = ['collection_id', 'limit', 'order', 'after', 'before', 'offset'] # noqa: E501
770+
all_params = ['collection_id', 'limit', 'order', 'after', 'before'] # noqa: E501
777771
all_params.append('async_req')
778772
all_params.append('_return_http_data_only')
779773
all_params.append('_preload_content')
@@ -808,8 +802,6 @@ def list_records_with_http_info(self, collection_id, **kwargs): # noqa: E501
808802
query_params.append(('after', params['after'])) # noqa: E501
809803
if 'before' in params:
810804
query_params.append(('before', params['before'])) # noqa: E501
811-
if 'offset' in params:
812-
query_params.append(('offset', params['offset'])) # noqa: E501
813805

814806
header_params = {}
815807

taskingai/client/api/retrieval_async_api.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,6 @@ async def list_collections(self, **kwargs): # noqa: E501
633633
:param object order:
634634
:param object after:
635635
:param object before:
636-
:param object offset:
637636
:return: CollectionListResponse
638637
If the method is called asynchronously,
639638
returns the request thread.
@@ -659,13 +658,12 @@ async def list_collections_with_http_info(self, **kwargs): # noqa: E501
659658
:param object order:
660659
:param object after:
661660
:param object before:
662-
:param object offset:
663661
:return: CollectionListResponse
664662
If the method is called asynchronously,
665663
returns the request thread.
666664
"""
667665

668-
all_params = ['limit', 'order', 'after', 'before', 'offset'] # noqa: E501
666+
all_params = ['limit', 'order', 'after', 'before'] # noqa: E501
669667
all_params.append('async_req')
670668
all_params.append('_return_http_data_only')
671669
all_params.append('_preload_content')
@@ -694,8 +692,6 @@ async def list_collections_with_http_info(self, **kwargs): # noqa: E501
694692
query_params.append(('after', params['after'])) # noqa: E501
695693
if 'before' in params:
696694
query_params.append(('before', params['before'])) # noqa: E501
697-
if 'offset' in params:
698-
query_params.append(('offset', params['offset'])) # noqa: E501
699695

700696
header_params = {}
701697

@@ -740,7 +736,6 @@ async def list_records(self, collection_id, **kwargs): # noqa: E501
740736
:param object order:
741737
:param object after:
742738
:param object before:
743-
:param object offset:
744739
:return: RecordListResponse
745740
If the method is called asynchronously,
746741
returns the request thread.
@@ -767,13 +762,12 @@ async def list_records_with_http_info(self, collection_id, **kwargs): # noqa: E
767762
:param object order:
768763
:param object after:
769764
:param object before:
770-
:param object offset:
771765
:return: RecordListResponse
772766
If the method is called asynchronously,
773767
returns the request thread.
774768
"""
775769

776-
all_params = ['collection_id', 'limit', 'order', 'after', 'before', 'offset'] # noqa: E501
770+
all_params = ['collection_id', 'limit', 'order', 'after', 'before'] # noqa: E501
777771
all_params.append('async_req')
778772
all_params.append('_return_http_data_only')
779773
all_params.append('_preload_content')
@@ -808,8 +802,6 @@ async def list_records_with_http_info(self, collection_id, **kwargs): # noqa: E
808802
query_params.append(('after', params['after'])) # noqa: E501
809803
if 'before' in params:
810804
query_params.append(('before', params['before'])) # noqa: E501
811-
if 'offset' in params:
812-
query_params.append(('offset', params['offset'])) # noqa: E501
813805

814806
header_params = {}
815807

taskingai/client/api/tool_api.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,6 @@ def list_actions(self, **kwargs): # noqa: E501
609609
:param object order:
610610
:param object after:
611611
:param object before:
612-
:param object offset:
613612
:return: ActionListResponse
614613
If the method is called asynchronously,
615614
returns the request thread.
@@ -635,13 +634,12 @@ def list_actions_with_http_info(self, **kwargs): # noqa: E501
635634
:param object order:
636635
:param object after:
637636
:param object before:
638-
:param object offset:
639637
:return: ActionListResponse
640638
If the method is called asynchronously,
641639
returns the request thread.
642640
"""
643641

644-
all_params = ['limit', 'order', 'after', 'before', 'offset'] # noqa: E501
642+
all_params = ['limit', 'order', 'after', 'before'] # noqa: E501
645643
all_params.append('async_req')
646644
all_params.append('_return_http_data_only')
647645
all_params.append('_preload_content')
@@ -670,8 +668,6 @@ def list_actions_with_http_info(self, **kwargs): # noqa: E501
670668
query_params.append(('after', params['after'])) # noqa: E501
671669
if 'before' in params:
672670
query_params.append(('before', params['before'])) # noqa: E501
673-
if 'offset' in params:
674-
query_params.append(('offset', params['offset'])) # noqa: E501
675671

676672
header_params = {}
677673

@@ -715,7 +711,6 @@ def list_functions(self, **kwargs): # noqa: E501
715711
:param object order:
716712
:param object after:
717713
:param object before:
718-
:param object offset:
719714
:return: FunctionListResponse
720715
If the method is called asynchronously,
721716
returns the request thread.
@@ -741,13 +736,12 @@ def list_functions_with_http_info(self, **kwargs): # noqa: E501
741736
:param object order:
742737
:param object after:
743738
:param object before:
744-
:param object offset:
745739
:return: FunctionListResponse
746740
If the method is called asynchronously,
747741
returns the request thread.
748742
"""
749743

750-
all_params = ['limit', 'order', 'after', 'before', 'offset'] # noqa: E501
744+
all_params = ['limit', 'order', 'after', 'before'] # noqa: E501
751745
all_params.append('async_req')
752746
all_params.append('_return_http_data_only')
753747
all_params.append('_preload_content')
@@ -776,8 +770,6 @@ def list_functions_with_http_info(self, **kwargs): # noqa: E501
776770
query_params.append(('after', params['after'])) # noqa: E501
777771
if 'before' in params:
778772
query_params.append(('before', params['before'])) # noqa: E501
779-
if 'offset' in params:
780-
query_params.append(('offset', params['offset'])) # noqa: E501
781773

782774
header_params = {}
783775

0 commit comments

Comments
 (0)