aient 1.1.81__py3-none-any.whl → 1.1.83__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.
- aient/core/utils.py +8 -10
- {aient-1.1.81.dist-info → aient-1.1.83.dist-info}/METADATA +1 -1
- {aient-1.1.81.dist-info → aient-1.1.83.dist-info}/RECORD +6 -6
- {aient-1.1.81.dist-info → aient-1.1.83.dist-info}/WHEEL +0 -0
- {aient-1.1.81.dist-info → aient-1.1.83.dist-info}/licenses/LICENSE +0 -0
- {aient-1.1.81.dist-info → aient-1.1.83.dist-info}/top_level.txt +0 -0
aient/core/utils.py
CHANGED
@@ -64,7 +64,6 @@ class BaseAPI:
|
|
64
64
|
self.audio_speech: str = urlunparse(parsed_url[:2] + (before_v1 + "audio/speech",) + ("",) * 3)
|
65
65
|
|
66
66
|
if parsed_url.path.endswith("/v1beta") or \
|
67
|
-
parsed_url.path.endswith("/v1") or \
|
68
67
|
(parsed_url.netloc == 'generativelanguage.googleapis.com' and "openai/chat/completions" not in parsed_url.path):
|
69
68
|
before_v1 = parsed_url.path.split("/v1")[0]
|
70
69
|
self.base_url = api_url
|
@@ -78,7 +77,6 @@ def get_engine(provider, endpoint=None, original_model=""):
|
|
78
77
|
engine = None
|
79
78
|
stream = None
|
80
79
|
if parsed_url.path.endswith("/v1beta") or \
|
81
|
-
parsed_url.path.endswith("/v1") or \
|
82
80
|
(parsed_url.netloc == 'generativelanguage.googleapis.com' and "openai/chat/completions" not in parsed_url.path):
|
83
81
|
engine = "gemini"
|
84
82
|
elif parsed_url.netloc.rstrip('/').endswith('aiplatform.googleapis.com') or \
|
@@ -169,7 +167,7 @@ def get_proxy(proxy, client_config = {}):
|
|
169
167
|
}
|
170
168
|
return client_config
|
171
169
|
|
172
|
-
def update_initial_model(provider):
|
170
|
+
async def update_initial_model(provider):
|
173
171
|
try:
|
174
172
|
engine, stream_mode = get_engine(provider, endpoint=None, original_model="")
|
175
173
|
# print("engine", engine, provider)
|
@@ -181,8 +179,8 @@ def update_initial_model(provider):
|
|
181
179
|
before_v1 = api_url.split("/v1beta")[0]
|
182
180
|
url = before_v1 + "/v1beta/models"
|
183
181
|
params = {"key": api}
|
184
|
-
with httpx.
|
185
|
-
response = client.get(url, params=params)
|
182
|
+
async with httpx.AsyncClient(**client_config) as client:
|
183
|
+
response = await client.get(url, params=params)
|
186
184
|
|
187
185
|
original_models = response.json()
|
188
186
|
if original_models.get("error"):
|
@@ -202,11 +200,11 @@ def update_initial_model(provider):
|
|
202
200
|
headers = {"x-api-key": api, "anthropic-version": "2023-06-01"}
|
203
201
|
else:
|
204
202
|
headers = {"Authorization": f"Bearer {api}"}
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
203
|
+
async with httpx.AsyncClient(**client_config) as client:
|
204
|
+
response = await client.get(
|
205
|
+
endpoint_models_url,
|
206
|
+
headers=headers,
|
207
|
+
)
|
210
208
|
models = response.json()
|
211
209
|
if models.get("error"):
|
212
210
|
logger.error({"error": models.get("error"), "endpoint": endpoint_models_url, "api": api})
|
@@ -4,7 +4,7 @@ aient/core/log_config.py,sha256=kz2_yJv1p-o3lUQOwA3qh-LSc3wMHv13iCQclw44W9c,274
|
|
4
4
|
aient/core/models.py,sha256=KMlCRLjtq1wQHZTJGqnbWhPS2cHq6eLdnk7peKDrzR8,7490
|
5
5
|
aient/core/request.py,sha256=QnDhyrjzcJOEQU2oauMQi_HHMRR5NxdkrX7nn5JMwTc,76675
|
6
6
|
aient/core/response.py,sha256=ye6Ie5HevXVcH3X5V5BoOC5yDJMBKTKopWQzsCNs008,34977
|
7
|
-
aient/core/utils.py,sha256=
|
7
|
+
aient/core/utils.py,sha256=okDFj8S4r71vnkEBYxiOqoKee63UzNyk2y_p4uhWBvY,28848
|
8
8
|
aient/core/test/test_base_api.py,sha256=pWnycRJbuPSXKKU9AQjWrMAX1wiLC_014Qc9hh5C2Pw,524
|
9
9
|
aient/core/test/test_geminimask.py,sha256=HFX8jDbNg_FjjgPNxfYaR-0-roUrOO-ND-FVsuxSoiw,13254
|
10
10
|
aient/core/test/test_image.py,sha256=_T4peNGdXKBHHxyQNx12u-NTyFE8TlYI6NvvagsG2LE,319
|
@@ -30,8 +30,8 @@ aient/plugins/write_file.py,sha256=Jt8fOEwqhYiSWpCbwfAr1xoi_BmFnx3076GMhuL06uI,3
|
|
30
30
|
aient/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
31
31
|
aient/utils/prompt.py,sha256=UcSzKkFE4-h_1b6NofI6xgk3GoleqALRKY8VBaXLjmI,11311
|
32
32
|
aient/utils/scripts.py,sha256=VqtK4RFEx7KxkmcqG3lFDS1DxoNlFFGErEjopVcc8IE,40974
|
33
|
-
aient-1.1.
|
34
|
-
aient-1.1.
|
35
|
-
aient-1.1.
|
36
|
-
aient-1.1.
|
37
|
-
aient-1.1.
|
33
|
+
aient-1.1.83.dist-info/licenses/LICENSE,sha256=XNdbcWldt0yaNXXWB_Bakoqnxb3OVhUft4MgMA_71ds,1051
|
34
|
+
aient-1.1.83.dist-info/METADATA,sha256=djB0cSoRmV_HSI4Fzp2FUyZJ4d0Ob1JnJyr6K_mQGDU,4842
|
35
|
+
aient-1.1.83.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
36
|
+
aient-1.1.83.dist-info/top_level.txt,sha256=3oXzrP5sAVvyyqabpeq8A2_vfMtY554r4bVE-OHBrZk,6
|
37
|
+
aient-1.1.83.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|