Skip to content

Commit d24dfd4

Browse files
jameszyaoSimsonW
authored andcommitted
feat: update urllib3 client to httpx
1 parent fb3df29 commit d24dfd4

15 files changed

+622
-444
lines changed

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ from taskingai.client.rest import ApiException
5555
from pprint import pprint
5656

5757
# create an instance of the API class
58-
api_instance = client.AssistantApi(client.ApiClient(configuration))
58+
api_instance = client.AssistantApi(client.SyncApiClient(configuration))
5959
body = client.AssistantCreateRequestBodySchema() # AssistantCreateRequestBodySchema |
6060

6161
try:
@@ -66,7 +66,7 @@ except ApiException as e:
6666
print("Exception when calling AssistantApi->create_assistant: %s\n" % e)
6767

6868
# create an instance of the API class
69-
api_instance = client.AssistantApi(client.ApiClient(configuration))
69+
api_instance = client.AssistantApi(client.SyncApiClient(configuration))
7070
body = client.ChatCreateRequestBodySchema() # ChatCreateRequestBodySchema |
7171
assistant_id = NULL # object |
7272

@@ -78,7 +78,7 @@ except ApiException as e:
7878
print("Exception when calling AssistantApi->create_chat: %s\n" % e)
7979

8080
# create an instance of the API class
81-
api_instance = client.AssistantApi(client.ApiClient(configuration))
81+
api_instance = client.AssistantApi(client.SyncApiClient(configuration))
8282
assistant_id = NULL # object |
8383

8484
try:
@@ -89,7 +89,7 @@ except ApiException as e:
8989
print("Exception when calling AssistantApi->delete_assistant: %s\n" % e)
9090

9191
# create an instance of the API class
92-
api_instance = client.AssistantApi(client.ApiClient(configuration))
92+
api_instance = client.AssistantApi(client.SyncApiClient(configuration))
9393
assistant_id = NULL # object |
9494
chat_id = NULL # object |
9595

@@ -101,7 +101,7 @@ except ApiException as e:
101101
print("Exception when calling AssistantApi->delete_chat: %s\n" % e)
102102

103103
# create an instance of the API class
104-
api_instance = client.AssistantApi(client.ApiClient(configuration))
104+
api_instance = client.AssistantApi(client.SyncApiClient(configuration))
105105
body = client.ChatGenerateRequestBodySchema() # ChatGenerateRequestBodySchema |
106106
assistant_id = NULL # object |
107107
chat_id = NULL # object |
@@ -114,7 +114,7 @@ except ApiException as e:
114114
print("Exception when calling AssistantApi->generate: %s\n" % e)
115115

116116
# create an instance of the API class
117-
api_instance = client.AssistantApi(client.ApiClient(configuration))
117+
api_instance = client.AssistantApi(client.SyncApiClient(configuration))
118118
assistant_id = NULL # object |
119119

120120
try:
@@ -125,7 +125,7 @@ except ApiException as e:
125125
print("Exception when calling AssistantApi->get_assistant: %s\n" % e)
126126

127127
# create an instance of the API class
128-
api_instance = client.AssistantApi(client.ApiClient(configuration))
128+
api_instance = client.AssistantApi(client.SyncApiClient(configuration))
129129
assistant_id = NULL # object |
130130
chat_id = NULL # object |
131131

@@ -137,7 +137,7 @@ except ApiException as e:
137137
print("Exception when calling AssistantApi->get_chat: %s\n" % e)
138138

139139
# create an instance of the API class
140-
api_instance = client.AssistantApi(client.ApiClient(configuration))
140+
api_instance = client.AssistantApi(client.SyncApiClient(configuration))
141141
assistant_id = NULL # object |
142142
chat_id = NULL # object |
143143
message_id = NULL # object |
@@ -150,7 +150,7 @@ except ApiException as e:
150150
print("Exception when calling AssistantApi->get_message: %s\n" % e)
151151

152152
# create an instance of the API class
153-
api_instance = client.AssistantApi(client.ApiClient(configuration))
153+
api_instance = client.AssistantApi(client.SyncApiClient(configuration))
154154
limit = 20 # object | (optional) (default to 20)
155155
order = desc # object | (optional) (default to desc)
156156
after = NULL # object | (optional)
@@ -165,7 +165,7 @@ except ApiException as e:
165165
print("Exception when calling AssistantApi->list_assistants: %s\n" % e)
166166

167167
# create an instance of the API class
168-
api_instance = client.AssistantApi(client.ApiClient(configuration))
168+
api_instance = client.AssistantApi(client.SyncApiClient(configuration))
169169
assistant_id = NULL # object |
170170

171171
try:
@@ -176,7 +176,7 @@ except ApiException as e:
176176
print("Exception when calling AssistantApi->list_chats: %s\n" % e)
177177

178178
# create an instance of the API class
179-
api_instance = client.AssistantApi(client.ApiClient(configuration))
179+
api_instance = client.AssistantApi(client.SyncApiClient(configuration))
180180
assistant_id = NULL # object |
181181
chat_id = NULL # object |
182182
limit = 20 # object | (optional) (default to 20)
@@ -193,7 +193,7 @@ except ApiException as e:
193193
print("Exception when calling AssistantApi->list_messages: %s\n" % e)
194194

195195
# create an instance of the API class
196-
api_instance = client.AssistantApi(client.ApiClient(configuration))
196+
api_instance = client.AssistantApi(client.SyncApiClient(configuration))
197197
body = client.AssistantUpdateRequestBodySchema() # AssistantUpdateRequestBodySchema |
198198
assistant_id = NULL # object |
199199

@@ -205,7 +205,7 @@ except ApiException as e:
205205
print("Exception when calling AssistantApi->update_assistant: %s\n" % e)
206206

207207
# create an instance of the API class
208-
api_instance = client.AssistantApi(client.ApiClient(configuration))
208+
api_instance = client.AssistantApi(client.SyncApiClient(configuration))
209209
body = client.ChatUpdateRequestBodySchema() # ChatUpdateRequestBodySchema |
210210
assistant_id = NULL # object |
211211
chat_id = NULL # object |
@@ -218,7 +218,7 @@ except ApiException as e:
218218
print("Exception when calling AssistantApi->update_chat: %s\n" % e)
219219

220220
# create an instance of the API class
221-
api_instance = client.AssistantApi(client.ApiClient(configuration))
221+
api_instance = client.AssistantApi(client.SyncApiClient(configuration))
222222
body = client.MessageUpdateRequestBodySchema() # MessageUpdateRequestBodySchema |
223223
assistant_id = NULL # object |
224224
chat_id = NULL # object |

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ classifiers=[
5454
[tool.poetry.dependencies]
5555
python = "^3.7"
5656

57-
urllib3 = ">= 1.25.3"
57+
certifi = ">= 14.05.14"
58+
httpx = ">= 0.23.0"
5859
python-dateutil = ">=2.8.2"
5960
pydantic = ">=2"
6061
typing-extensions = ">=4.7.1"

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ certifi >= 14.05.14
22
six >= 1.10
33
python_dateutil >= 2.5.3
44
setuptools >= 21.0.0
5-
urllib3 >= 1.15.1
5+
httpx >= 0.23.0

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,18 @@
77
"""
88

99
from setuptools import setup, find_packages # noqa: H301
10+
import taskingai
1011

1112
NAME = "client"
12-
VERSION = "0.0.2"
13+
VERSION = taskingai.__version__
1314
# To install the library, run the following
1415
#
1516
# python setup.py install
1617
#
1718
# prerequisite: setuptools
1819
# http://pypi.python.org/pypi/setuptools
1920

20-
REQUIRES = ["urllib3 >= 1.15", "six >= 1.10", "certifi", "python-dateutil"]
21+
REQUIRES = ["httpx >= 0.23.0", "six >= 1.10", "certifi", "python-dateutil"]
2122

2223
setup(
2324
name=NAME,

taskingai/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
from . import assistant
33
from . import tool
44
from . import retrieval
5-
from . import inference
5+
from . import inference
6+
from ._version import __version__

taskingai/__version__

Lines changed: 0 additions & 1 deletion
This file was deleted.

taskingai/_version.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
__title__ = "taskingai"
2+
__version__ = "0.0.2"

taskingai/client/api/assistant_api.py

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# python 2 and python 3 compatibility library
1414
import six
1515

16-
from taskingai.client.api_client import ApiClient
16+
from taskingai.client.api_client import SyncApiClient
1717

1818

1919
class AssistantApi(object):
@@ -25,7 +25,7 @@ class AssistantApi(object):
2525

2626
def __init__(self, api_client=None):
2727
if api_client is None:
28-
api_client = ApiClient()
28+
api_client = SyncApiClient()
2929
self.api_client = api_client
3030

3131
def create_assistant(self, body, **kwargs): # noqa: E501
@@ -121,7 +121,6 @@ def create_assistant_with_http_info(self, body, **kwargs): # noqa: E501
121121
files=local_var_files,
122122
response_type='AssistantCreateResponse', # noqa: E501
123123
auth_settings=auth_settings,
124-
async_req=params.get('async_req'),
125124
_return_http_data_only=params.get('_return_http_data_only'),
126125
_preload_content=params.get('_preload_content', True),
127126
_request_timeout=params.get('_request_timeout'),
@@ -228,7 +227,6 @@ def create_chat_with_http_info(self, body, assistant_id, **kwargs): # noqa: E50
228227
files=local_var_files,
229228
response_type='ChatCreateResponse', # noqa: E501
230229
auth_settings=auth_settings,
231-
async_req=params.get('async_req'),
232230
_return_http_data_only=params.get('_return_http_data_only'),
233231
_preload_content=params.get('_preload_content', True),
234232
_request_timeout=params.get('_request_timeout'),
@@ -344,7 +342,6 @@ def create_message_with_http_info(self, body, assistant_id, chat_id, **kwargs):
344342
files=local_var_files,
345343
response_type='MessageCreateResponse', # noqa: E501
346344
auth_settings=auth_settings,
347-
async_req=params.get('async_req'),
348345
_return_http_data_only=params.get('_return_http_data_only'),
349346
_preload_content=params.get('_preload_content', True),
350347
_request_timeout=params.get('_request_timeout'),
@@ -440,7 +437,6 @@ def delete_assistant_with_http_info(self, assistant_id, **kwargs): # noqa: E501
440437
files=local_var_files,
441438
response_type='AssistantDeleteResponse', # noqa: E501
442439
auth_settings=auth_settings,
443-
async_req=params.get('async_req'),
444440
_return_http_data_only=params.get('_return_http_data_only'),
445441
_preload_content=params.get('_preload_content', True),
446442
_request_timeout=params.get('_request_timeout'),
@@ -543,7 +539,6 @@ def delete_chat_with_http_info(self, assistant_id, chat_id, **kwargs): # noqa:
543539
files=local_var_files,
544540
response_type='ChatDeleteResponse', # noqa: E501
545541
auth_settings=auth_settings,
546-
async_req=params.get('async_req'),
547542
_return_http_data_only=params.get('_return_http_data_only'),
548543
_preload_content=params.get('_preload_content', True),
549544
_request_timeout=params.get('_request_timeout'),
@@ -661,7 +656,6 @@ def generate_assistant_message_with_http_info(self, body, assistant_id, chat_id,
661656
files=local_var_files,
662657
response_type='object', # noqa: E501
663658
auth_settings=auth_settings,
664-
async_req=params.get('async_req'),
665659
_return_http_data_only=params.get('_return_http_data_only'),
666660
_preload_content=params.get('_preload_content', True),
667661
_request_timeout=params.get('_request_timeout'),
@@ -756,7 +750,6 @@ def get_assistant_with_http_info(self, assistant_id, **kwargs): # noqa: E501
756750
files=local_var_files,
757751
response_type='AssistantGetResponse', # noqa: E501
758752
auth_settings=auth_settings,
759-
async_req=params.get('async_req'),
760753
_return_http_data_only=params.get('_return_http_data_only'),
761754
_preload_content=params.get('_preload_content', True),
762755
_request_timeout=params.get('_request_timeout'),
@@ -859,7 +852,6 @@ def get_chat_with_http_info(self, assistant_id, chat_id, **kwargs): # noqa: E50
859852
files=local_var_files,
860853
response_type='ChatGetResponse', # noqa: E501
861854
auth_settings=auth_settings,
862-
async_req=params.get('async_req'),
863855
_return_http_data_only=params.get('_return_http_data_only'),
864856
_preload_content=params.get('_preload_content', True),
865857
_request_timeout=params.get('_request_timeout'),
@@ -970,7 +962,6 @@ def get_message_with_http_info(self, assistant_id, chat_id, message_id, **kwargs
970962
files=local_var_files,
971963
response_type='MessageGetResponse', # noqa: E501
972964
auth_settings=auth_settings,
973-
async_req=params.get('async_req'),
974965
_return_http_data_only=params.get('_return_http_data_only'),
975966
_preload_content=params.get('_preload_content', True),
976967
_request_timeout=params.get('_request_timeout'),
@@ -1077,7 +1068,6 @@ def list_assistants_with_http_info(self, **kwargs): # noqa: E501
10771068
files=local_var_files,
10781069
response_type='AssistantListResponse', # noqa: E501
10791070
auth_settings=auth_settings,
1080-
async_req=params.get('async_req'),
10811071
_return_http_data_only=params.get('_return_http_data_only'),
10821072
_preload_content=params.get('_preload_content', True),
10831073
_request_timeout=params.get('_request_timeout'),
@@ -1188,7 +1178,6 @@ def list_chats_with_http_info(self, assistant_id, **kwargs): # noqa: E501
11881178
files=local_var_files,
11891179
response_type='ChatListResponse', # noqa: E501
11901180
auth_settings=auth_settings,
1191-
async_req=params.get('async_req'),
11921181
_return_http_data_only=params.get('_return_http_data_only'),
11931182
_preload_content=params.get('_preload_content', True),
11941183
_request_timeout=params.get('_request_timeout'),
@@ -1307,7 +1296,6 @@ def list_messages_with_http_info(self, assistant_id, chat_id, **kwargs): # noqa
13071296
files=local_var_files,
13081297
response_type='MessageListResponse', # noqa: E501
13091298
auth_settings=auth_settings,
1310-
async_req=params.get('async_req'),
13111299
_return_http_data_only=params.get('_return_http_data_only'),
13121300
_preload_content=params.get('_preload_content', True),
13131301
_request_timeout=params.get('_request_timeout'),
@@ -1415,7 +1403,6 @@ def update_assistant_with_http_info(self, body, assistant_id, **kwargs): # noqa
14151403
files=local_var_files,
14161404
response_type='AssistantUpdateResponse', # noqa: E501
14171405
auth_settings=auth_settings,
1418-
async_req=params.get('async_req'),
14191406
_return_http_data_only=params.get('_return_http_data_only'),
14201407
_preload_content=params.get('_preload_content', True),
14211408
_request_timeout=params.get('_request_timeout'),
@@ -1530,7 +1517,6 @@ def update_chat_with_http_info(self, body, assistant_id, chat_id, **kwargs): #
15301517
files=local_var_files,
15311518
response_type='ChatUpdateResponse', # noqa: E501
15321519
auth_settings=auth_settings,
1533-
async_req=params.get('async_req'),
15341520
_return_http_data_only=params.get('_return_http_data_only'),
15351521
_preload_content=params.get('_preload_content', True),
15361522
_request_timeout=params.get('_request_timeout'),
@@ -1654,7 +1640,6 @@ def update_message_with_http_info(self, body, assistant_id, chat_id, message_id,
16541640
files=local_var_files,
16551641
response_type='MessageUpdateResponse', # noqa: E501
16561642
auth_settings=auth_settings,
1657-
async_req=params.get('async_req'),
16581643
_return_http_data_only=params.get('_return_http_data_only'),
16591644
_preload_content=params.get('_preload_content', True),
16601645
_request_timeout=params.get('_request_timeout'),

taskingai/client/api/inference_api.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# python 2 and python 3 compatibility library
1414
import six
1515

16-
from taskingai.client.api_client import ApiClient
16+
from taskingai.client.api_client import SyncApiClient
1717

1818

1919
class InferenceApi(object):
@@ -25,7 +25,7 @@ class InferenceApi(object):
2525

2626
def __init__(self, api_client=None):
2727
if api_client is None:
28-
api_client = ApiClient()
28+
api_client = SyncApiClient()
2929
self.api_client = api_client
3030

3131
def chat_completion(self, body, **kwargs): # noqa: E501
@@ -121,7 +121,6 @@ def chat_completion_with_http_info(self, body, **kwargs): # noqa: E501
121121
files=local_var_files,
122122
response_type='object', # noqa: E501
123123
auth_settings=auth_settings,
124-
async_req=params.get('async_req'),
125124
_return_http_data_only=params.get('_return_http_data_only'),
126125
_preload_content=params.get('_preload_content', True),
127126
_request_timeout=params.get('_request_timeout'),
@@ -220,7 +219,6 @@ def text_embedding_with_http_info(self, body, **kwargs): # noqa: E501
220219
files=local_var_files,
221220
response_type='TextEmbeddingResponse', # noqa: E501
222221
auth_settings=auth_settings,
223-
async_req=params.get('async_req'),
224222
_return_http_data_only=params.get('_return_http_data_only'),
225223
_preload_content=params.get('_preload_content', True),
226224
_request_timeout=params.get('_request_timeout'),

0 commit comments

Comments
 (0)