aient 1.1.84__py3-none-any.whl → 1.1.85__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 -6
- aient/models/chatgpt.py +1 -1
- {aient-1.1.84.dist-info → aient-1.1.85.dist-info}/METADATA +1 -1
- {aient-1.1.84.dist-info → aient-1.1.85.dist-info}/RECORD +7 -7
- {aient-1.1.84.dist-info → aient-1.1.85.dist-info}/WHEEL +0 -0
- {aient-1.1.84.dist-info → aient-1.1.85.dist-info}/licenses/LICENSE +0 -0
- {aient-1.1.84.dist-info → aient-1.1.85.dist-info}/top_level.txt +0 -0
aient/core/response.py
CHANGED
@@ -21,13 +21,12 @@ async def check_response(response, error_log):
|
|
21
21
|
return {"error": f"{error_log} HTTP Error", "status_code": response.status_code, "details": error_json}
|
22
22
|
return None
|
23
23
|
|
24
|
-
async def gemini_json_poccess(
|
24
|
+
async def gemini_json_poccess(response_json):
|
25
25
|
promptTokenCount = 0
|
26
26
|
candidatesTokenCount = 0
|
27
27
|
totalTokenCount = 0
|
28
28
|
image_base64 = None
|
29
29
|
|
30
|
-
response_json = await asyncio.to_thread(json.loads, response_str)
|
31
30
|
json_data = safe_get(response_json, "candidates", 0, "content", default=None)
|
32
31
|
finishReason = safe_get(response_json, "candidates", 0 , "finishReason", default=None)
|
33
32
|
if finishReason:
|
@@ -48,7 +47,7 @@ async def gemini_json_poccess(response_str):
|
|
48
47
|
|
49
48
|
function_call_name = safe_get(json_data, "functionCall", "name", default=None)
|
50
49
|
function_full_response = safe_get(json_data, "functionCall", "args", default="")
|
51
|
-
function_full_response = json.dumps
|
50
|
+
function_full_response = await asyncio.to_thread(json.dumps, function_full_response) if function_full_response else None
|
52
51
|
|
53
52
|
blockReason = safe_get(json_data, 0, "promptFeedback", "blockReason", default=None)
|
54
53
|
|
@@ -77,7 +76,7 @@ async def fetch_gemini_response_stream(client, url, headers, payload, model, tim
|
|
77
76
|
if line.startswith("data: "):
|
78
77
|
parts_json = line.lstrip("data: ").strip()
|
79
78
|
try:
|
80
|
-
await asyncio.to_thread(json.loads, parts_json)
|
79
|
+
response_json = await asyncio.to_thread(json.loads, parts_json)
|
81
80
|
except json.JSONDecodeError:
|
82
81
|
logger.error(f"JSON decode error: {parts_json}")
|
83
82
|
continue
|
@@ -85,12 +84,12 @@ async def fetch_gemini_response_stream(client, url, headers, payload, model, tim
|
|
85
84
|
parts_json += line
|
86
85
|
parts_json = parts_json.lstrip("[,")
|
87
86
|
try:
|
88
|
-
await asyncio.to_thread(json.loads, parts_json)
|
87
|
+
response_json = await asyncio.to_thread(json.loads, parts_json)
|
89
88
|
except json.JSONDecodeError:
|
90
89
|
continue
|
91
90
|
|
92
91
|
# https://ai.google.dev/api/generate-content?hl=zh-cn#FinishReason
|
93
|
-
is_thinking, reasoning_content, content, image_base64, function_call_name, function_full_response, finishReason, blockReason, promptTokenCount, candidatesTokenCount, totalTokenCount = await gemini_json_poccess(
|
92
|
+
is_thinking, reasoning_content, content, image_base64, function_call_name, function_full_response, finishReason, blockReason, promptTokenCount, candidatesTokenCount, totalTokenCount = await gemini_json_poccess(response_json)
|
94
93
|
|
95
94
|
if is_thinking:
|
96
95
|
sse_string = await generate_sse_response(timestamp, model, reasoning_content=reasoning_content)
|
aient/models/chatgpt.py
CHANGED
@@ -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=waC-i5i04bwooqNAgjmX30nx0IJ1nLITPeF0RCYwRs0,35620
|
7
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
|
@@ -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=Jb0g9FsTitM7U_qG4RZilSgRY18fJ3-1a5GueetjQ8I,46227
|
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.85.dist-info/licenses/LICENSE,sha256=XNdbcWldt0yaNXXWB_Bakoqnxb3OVhUft4MgMA_71ds,1051
|
34
|
+
aient-1.1.85.dist-info/METADATA,sha256=HxXc6ppmpfa3xS-UYSmYsvoB9xennfmJ8SlJns5X5_U,4842
|
35
|
+
aient-1.1.85.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
36
|
+
aient-1.1.85.dist-info/top_level.txt,sha256=3oXzrP5sAVvyyqabpeq8A2_vfMtY554r4bVE-OHBrZk,6
|
37
|
+
aient-1.1.85.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|