aient 1.0.88__py3-none-any.whl → 1.0.90__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/request.py +8 -0
- aient/core/response.py +4 -1
- aient/models/chatgpt.py +5 -15
- aient/plugins/write_file.py +1 -1
- {aient-1.0.88.dist-info → aient-1.0.90.dist-info}/METADATA +1 -1
- {aient-1.0.88.dist-info → aient-1.0.90.dist-info}/RECORD +9 -9
- {aient-1.0.88.dist-info → aient-1.0.90.dist-info}/WHEEL +0 -0
- {aient-1.0.88.dist-info → aient-1.0.90.dist-info}/licenses/LICENSE +0 -0
- {aient-1.0.88.dist-info → aient-1.0.90.dist-info}/top_level.txt +0 -0
aient/core/request.py
CHANGED
@@ -995,6 +995,10 @@ async def get_gpt_payload(request, engine, provider, api_key=None):
|
|
995
995
|
}
|
996
996
|
})
|
997
997
|
|
998
|
+
if safe_get(provider, "preferences", "post_body_parameter_overrides", default=None):
|
999
|
+
for key, value in safe_get(provider, "preferences", "post_body_parameter_overrides", default={}).items():
|
1000
|
+
payload[key] = value
|
1001
|
+
|
998
1002
|
return url, headers, payload
|
999
1003
|
|
1000
1004
|
def build_azure_endpoint(base_url, deployment_id, api_version="2025-01-01-preview"):
|
@@ -1085,6 +1089,10 @@ async def get_azure_payload(request, engine, provider, api_key=None):
|
|
1085
1089
|
payload.pop("tools", None)
|
1086
1090
|
payload.pop("tool_choice", None)
|
1087
1091
|
|
1092
|
+
if safe_get(provider, "preferences", "post_body_parameter_overrides", default=None):
|
1093
|
+
for key, value in safe_get(provider, "preferences", "post_body_parameter_overrides", default={}).items():
|
1094
|
+
payload[key] = value
|
1095
|
+
|
1088
1096
|
return url, headers, payload
|
1089
1097
|
|
1090
1098
|
async def get_openrouter_payload(request, engine, provider, api_key=None):
|
aient/core/response.py
CHANGED
@@ -327,7 +327,10 @@ async def fetch_azure_response_stream(client, url, headers, payload):
|
|
327
327
|
continue
|
328
328
|
|
329
329
|
if no_stream_content or content or sse_string:
|
330
|
-
|
330
|
+
input_tokens = safe_get(line, "usage", "prompt_tokens", default=0)
|
331
|
+
output_tokens = safe_get(line, "usage", "completion_tokens", default=0)
|
332
|
+
total_tokens = safe_get(line, "usage", "total_tokens", default=0)
|
333
|
+
sse_string = await generate_sse_response(timestamp, safe_get(line, "model", default=None), content=no_stream_content or content, total_tokens=total_tokens, prompt_tokens=input_tokens, completion_tokens=output_tokens)
|
331
334
|
yield sse_string
|
332
335
|
else:
|
333
336
|
if no_stream_content:
|
aient/models/chatgpt.py
CHANGED
@@ -431,26 +431,21 @@ class chatgpt(BaseLLM):
|
|
431
431
|
|
432
432
|
function_parameter = parse_function_xml(full_response)
|
433
433
|
if function_parameter:
|
434
|
-
print("function_parameter1", function_parameter)
|
435
|
-
function_parameter = [tool_dict for tool_dict in function_parameter if tool_dict.get("function_name", "") in self.plugins.keys()]
|
436
434
|
invalid_tools = [tool_dict for tool_dict in function_parameter if tool_dict.get("function_name", "") not in self.plugins.keys()]
|
435
|
+
function_parameter = [tool_dict for tool_dict in function_parameter if tool_dict.get("function_name", "") in self.plugins.keys()]
|
437
436
|
for tool_dict in invalid_tools:
|
438
437
|
full_response = full_response + f"\n\nFunction: {tool_dict.get('function_name', '')} does not exist! I must use existing functions. I need to try again."
|
439
|
-
|
440
|
-
if self.print_log:
|
438
|
+
if self.print_log and invalid_tools:
|
441
439
|
print("invalid_tools", invalid_tools)
|
440
|
+
print("function_parameter", function_parameter)
|
442
441
|
print("full_response", full_response)
|
443
442
|
if function_parameter:
|
444
443
|
need_function_call = True
|
445
444
|
else:
|
446
445
|
need_function_call = False
|
447
446
|
if self.print_log:
|
448
|
-
print("Failed to parse function_parameter",
|
449
|
-
|
450
|
-
full_response = (
|
451
|
-
f"{full_response}"
|
452
|
-
"\n\nFailed to parse function parameter, I need to try again."
|
453
|
-
)
|
447
|
+
print("Failed to parse function_parameter full_response", full_response)
|
448
|
+
full_response = ""
|
454
449
|
|
455
450
|
# 处理函数调用
|
456
451
|
if need_function_call and self.use_plugins != False:
|
@@ -458,11 +453,6 @@ class chatgpt(BaseLLM):
|
|
458
453
|
print("function_parameter", function_parameter)
|
459
454
|
print("function_full_response", function_full_response)
|
460
455
|
|
461
|
-
function_parameter = [tool_dict for tool_dict in function_parameter if tool_dict.get("function_name", "") in self.plugins.keys()]
|
462
|
-
|
463
|
-
if self.print_log:
|
464
|
-
print("function_parameter3", function_parameter)
|
465
|
-
|
466
456
|
function_response = ""
|
467
457
|
# 定义处理单个工具调用的辅助函数
|
468
458
|
async def process_single_tool_call(tool_name, tool_args, tool_id):
|
aient/plugins/write_file.py
CHANGED
@@ -44,7 +44,7 @@ Example: Requesting to write to frontend-config.json
|
|
44
44
|
# 确保目录存在
|
45
45
|
os.makedirs(os.path.dirname(path) or '.', exist_ok=True)
|
46
46
|
|
47
|
-
if content.startswith("##
|
47
|
+
if content.startswith("##") and (path.endswith(".md") or path.endswith(".txt")):
|
48
48
|
content = "\n\n" + content
|
49
49
|
|
50
50
|
# 写入文件
|
@@ -4,8 +4,8 @@ aient/core/.gitignore,sha256=5JRRlYYsqt_yt6iFvvzhbqh2FTUQMqwo6WwIuFzlGR8,13
|
|
4
4
|
aient/core/__init__.py,sha256=NxjebTlku35S4Dzr16rdSqSTWUvvwEeACe8KvHJnjPg,34
|
5
5
|
aient/core/log_config.py,sha256=kz2_yJv1p-o3lUQOwA3qh-LSc3wMHv13iCQclw44W9c,274
|
6
6
|
aient/core/models.py,sha256=_1wYZg_n9kb2A3C8xCboyqleH2iHc9scwOvtx9DPeok,7582
|
7
|
-
aient/core/request.py,sha256=
|
8
|
-
aient/core/response.py,sha256=
|
7
|
+
aient/core/request.py,sha256=U0SDf_dOE5EEhzyJA14XMQCiCFUtcivYcISveLBsK64,61405
|
8
|
+
aient/core/response.py,sha256=6fo3GKvTKio8nf4cZdizDIYYq7SnBnFeQ6ROvdAIW9k,30959
|
9
9
|
aient/core/utils.py,sha256=W-PDhwoJIbmlt4xfyrV9GXHu9TwRk4pivBOcDVXjgsc,26163
|
10
10
|
aient/core/test/test_base_api.py,sha256=pWnycRJbuPSXKKU9AQjWrMAX1wiLC_014Qc9hh5C2Pw,524
|
11
11
|
aient/core/test/test_image.py,sha256=_T4peNGdXKBHHxyQNx12u-NTyFE8TlYI6NvvagsG2LE,319
|
@@ -13,7 +13,7 @@ aient/core/test/test_payload.py,sha256=8jBiJY1uidm1jzL-EiK0s6UGmW9XkdsuuKFGrwFhF
|
|
13
13
|
aient/models/__init__.py,sha256=ouNDNvoBBpIFrLsk09Q_sq23HR0GbLAKfGLIFmfEuXE,219
|
14
14
|
aient/models/audio.py,sha256=kRd-8-WXzv4vwvsTGwnstK-WR8--vr9CdfCZzu8y9LA,1934
|
15
15
|
aient/models/base.py,sha256=z-Z0pJfTN2x0cuwfvu0BdMRY9O-RmLwHEnBIJN1x4Fg,6719
|
16
|
-
aient/models/chatgpt.py,sha256=
|
16
|
+
aient/models/chatgpt.py,sha256=Y99EIUE9m7QIo3G-6MQWQ_HShCv5tDQHYM-nQyV32DM,45002
|
17
17
|
aient/models/claude.py,sha256=thK9P8qkaaoUN3OOJ9Shw4KDs-pAGKPoX4FOPGFXva8,28597
|
18
18
|
aient/models/duckduckgo.py,sha256=1l7vYCs9SG5SWPCbcl7q6pCcB5AUF_r-a4l9frz3Ogo,8115
|
19
19
|
aient/models/gemini.py,sha256=chGLc-8G_DAOxr10HPoOhvVFW1RvMgHd6mt--VyAW98,14730
|
@@ -30,14 +30,14 @@ aient/plugins/read_file.py,sha256=cJxGnhcz1_gjkgeemVyixLUiCvf-dWm-UtDfrbFdlLE,48
|
|
30
30
|
aient/plugins/registry.py,sha256=YknzhieU_8nQ3oKlUSSWDB4X7t2Jx0JnqT2Jd9Xsvfk,3574
|
31
31
|
aient/plugins/run_python.py,sha256=dgcUwBunMuDkaSKR5bToudVzSdrXVewktDDFUz_iIOQ,4589
|
32
32
|
aient/plugins/websearch.py,sha256=yiBzqXK5X220ibR-zko3VDsn4QOnLu1k6E2YOygCeTQ,15185
|
33
|
-
aient/plugins/write_file.py,sha256=
|
33
|
+
aient/plugins/write_file.py,sha256=qmT6iQ3mDyVAa9Sld1jfJq0KPZj0w2kRIHq0JyjpGeA,1853
|
34
34
|
aient/prompt/__init__.py,sha256=GBtn6-JDT8KHFCcuPpfSNE_aGddg5p4FEyMCy4BfwGs,20
|
35
35
|
aient/prompt/agent.py,sha256=WLs0KiNZs29FJ5w7N3kQZYLVEeS7K8vxIOUw06LcXVE,23825
|
36
36
|
aient/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
37
37
|
aient/utils/prompt.py,sha256=UcSzKkFE4-h_1b6NofI6xgk3GoleqALRKY8VBaXLjmI,11311
|
38
38
|
aient/utils/scripts.py,sha256=PPwaJEigPkpciJHUXOag483iq1GjvaLReHDHjkinv6c,26780
|
39
|
-
aient-1.0.
|
40
|
-
aient-1.0.
|
41
|
-
aient-1.0.
|
42
|
-
aient-1.0.
|
43
|
-
aient-1.0.
|
39
|
+
aient-1.0.90.dist-info/licenses/LICENSE,sha256=XNdbcWldt0yaNXXWB_Bakoqnxb3OVhUft4MgMA_71ds,1051
|
40
|
+
aient-1.0.90.dist-info/METADATA,sha256=r6fU6TadrmIOJb-YQgLT5nuH1IcipmCK--zNMS_-Ub4,5000
|
41
|
+
aient-1.0.90.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
|
42
|
+
aient-1.0.90.dist-info/top_level.txt,sha256=3oXzrP5sAVvyyqabpeq8A2_vfMtY554r4bVE-OHBrZk,6
|
43
|
+
aient-1.0.90.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|