aient 1.1.87__py3-none-any.whl → 1.1.89__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/response.py +5 -0
- aient/models/chatgpt.py +9 -1
- {aient-1.1.87.dist-info → aient-1.1.89.dist-info}/METADATA +1 -1
- {aient-1.1.87.dist-info → aient-1.1.89.dist-info}/RECORD +7 -7
- {aient-1.1.87.dist-info → aient-1.1.89.dist-info}/WHEEL +0 -0
- {aient-1.1.87.dist-info → aient-1.1.89.dist-info}/licenses/LICENSE +0 -0
- {aient-1.1.87.dist-info → aient-1.1.89.dist-info}/top_level.txt +0 -0
aient/core/response.py
CHANGED
@@ -275,6 +275,11 @@ async def fetch_gpt_response_stream(client, url, headers, payload, timeout):
|
|
275
275
|
|
276
276
|
no_stream_content = safe_get(line, "choices", 0, "message", "content", default=None)
|
277
277
|
openrouter_reasoning = safe_get(line, "choices", 0, "delta", "reasoning", default="")
|
278
|
+
openrouter_base64_image = safe_get(line, "choices", 0, "delta", "images", 0, "image_url", "url", default="")
|
279
|
+
if openrouter_base64_image:
|
280
|
+
sse_string = await generate_sse_response(timestamp, payload["model"], content=f"\n\n")
|
281
|
+
yield sse_string
|
282
|
+
continue
|
278
283
|
azure_databricks_claude_summary_content = safe_get(line, "choices", 0, "delta", "content", 0, "summary", 0, "text", default="")
|
279
284
|
azure_databricks_claude_signature_content = safe_get(line, "choices", 0, "delta", "content", 0, "summary", 0, "signature", default="")
|
280
285
|
# print("openrouter_reasoning", repr(openrouter_reasoning), openrouter_reasoning.endswith("\\\\"), openrouter_reasoning.endswith("\\"))
|
aient/models/chatgpt.py
CHANGED
@@ -757,6 +757,7 @@ class chatgpt(BaseLLM):
|
|
757
757
|
|
758
758
|
# 发送请求并处理响应
|
759
759
|
retry_times = 0
|
760
|
+
error_to_raise = None
|
760
761
|
while True:
|
761
762
|
tmp_post_json = copy.deepcopy(json_post)
|
762
763
|
if need_done_prompt:
|
@@ -840,10 +841,14 @@ class chatgpt(BaseLLM):
|
|
840
841
|
continue
|
841
842
|
except InputTokenCountExceededError as e:
|
842
843
|
self.logger.error(f"The request body is too long: {e}")
|
843
|
-
|
844
|
+
error_to_raise = e
|
845
|
+
break
|
844
846
|
except BadRequestError as e:
|
845
847
|
self.logger.error(f"Bad request error: {e}")
|
846
848
|
raise
|
849
|
+
except GeneratorExit:
|
850
|
+
self.logger.warning("GeneratorExit caught, closing stream.")
|
851
|
+
break
|
847
852
|
except ValidationError as e:
|
848
853
|
self.logger.warning(f"Validation failed: {e}. Retrying with corrective prompt.")
|
849
854
|
need_done_prompt = [
|
@@ -870,6 +875,9 @@ class chatgpt(BaseLLM):
|
|
870
875
|
if retry_times == 9:
|
871
876
|
raise RetryFailedError(str(e))
|
872
877
|
|
878
|
+
if error_to_raise:
|
879
|
+
raise error_to_raise
|
880
|
+
|
873
881
|
def ask_stream(
|
874
882
|
self,
|
875
883
|
prompt: list,
|
@@ -3,7 +3,7 @@ aient/core/__init__.py,sha256=NxjebTlku35S4Dzr16rdSqSTWUvvwEeACe8KvHJnjPg,34
|
|
3
3
|
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
|
-
aient/core/response.py,sha256=
|
6
|
+
aient/core/response.py,sha256=HcyOEfZXZEXeJaUBMCYE4LiLyB79XuUR5o0Gtwdyi-E,36309
|
7
7
|
aient/core/utils.py,sha256=sLmPHONYhIPq1zUYcbKOtIOpAVsLFk_5lNwH5-G2c4E,30013
|
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
|
@@ -12,7 +12,7 @@ aient/core/test/test_payload.py,sha256=8jBiJY1uidm1jzL-EiK0s6UGmW9XkdsuuKFGrwFhF
|
|
12
12
|
aient/models/__init__.py,sha256=ZTiZgbfBPTjIPSKURE7t6hlFBVLRS9lluGbmqc1WjxQ,43
|
13
13
|
aient/models/audio.py,sha256=kRd-8-WXzv4vwvsTGwnstK-WR8--vr9CdfCZzu8y9LA,1934
|
14
14
|
aient/models/base.py,sha256=-nnihYnx-vHZMqeVO9ljjt3k4FcD3n-iMk4tT-10nRQ,7232
|
15
|
-
aient/models/chatgpt.py,sha256
|
15
|
+
aient/models/chatgpt.py,sha256=2RaObZmliqJlGveOSWbwgpscjPWk7R1RmxwbEAH0xXo,47315
|
16
16
|
aient/plugins/__init__.py,sha256=p3KO6Aa3Lupos4i2SjzLQw1hzQTigOAfEHngsldrsyk,986
|
17
17
|
aient/plugins/arXiv.py,sha256=yHjb6PS3GUWazpOYRMKMzghKJlxnZ5TX8z9F6UtUVow,1461
|
18
18
|
aient/plugins/config.py,sha256=TGgZ5SnNKZ8MmdznrZ-TEq7s2ulhAAwTSKH89bci3dA,7079
|
@@ -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.89.dist-info/licenses/LICENSE,sha256=XNdbcWldt0yaNXXWB_Bakoqnxb3OVhUft4MgMA_71ds,1051
|
34
|
+
aient-1.1.89.dist-info/METADATA,sha256=nm5ByqWMd1QUeKvHdPUnzKwapeaRFxfqhCPCOnClxnE,4842
|
35
|
+
aient-1.1.89.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
36
|
+
aient-1.1.89.dist-info/top_level.txt,sha256=3oXzrP5sAVvyyqabpeq8A2_vfMtY554r4bVE-OHBrZk,6
|
37
|
+
aient-1.1.89.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|