aient 1.0.86__py3-none-any.whl → 1.0.88__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/models/chatgpt.py CHANGED
@@ -431,10 +431,15 @@ class chatgpt(BaseLLM):
431
431
 
432
432
  function_parameter = parse_function_xml(full_response)
433
433
  if function_parameter:
434
- for tool_dict in function_parameter:
435
- if tool_dict.get("function_name", "") not in self.plugins.keys():
436
- function_parameter.remove(tool_dict)
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."
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
+ invalid_tools = [tool_dict for tool_dict in function_parameter if tool_dict.get("function_name", "") not in self.plugins.keys()]
437
+ for tool_dict in invalid_tools:
438
+ 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
+ print("function_parameter2", self.print_log, function_parameter)
440
+ if self.print_log:
441
+ print("invalid_tools", invalid_tools)
442
+ print("full_response", full_response)
438
443
  if function_parameter:
439
444
  need_function_call = True
440
445
  else:
@@ -453,6 +458,11 @@ class chatgpt(BaseLLM):
453
458
  print("function_parameter", function_parameter)
454
459
  print("function_full_response", function_full_response)
455
460
 
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
+
456
466
  function_response = ""
457
467
  # 定义处理单个工具调用的辅助函数
458
468
  async def process_single_tool_call(tool_name, tool_args, tool_id):
@@ -549,7 +559,7 @@ class chatgpt(BaseLLM):
549
559
  all_responses.append(f"[{tool_name}({tool_args}) Result]:\n\n{tool_response}")
550
560
 
551
561
  # 合并所有工具响应
552
- function_response = "\n\n".join(all_responses)
562
+ function_response = "\n\n".join(all_responses).strip()
553
563
 
554
564
  # 使用第一个工具的名称和参数作为历史记录
555
565
  function_call_name = tool_calls[0]['function_name']
@@ -39,8 +39,12 @@ def excute_command(command):
39
39
  stdout_log = result.stdout
40
40
  return f"执行命令成功:\n{stdout_log}"
41
41
  except subprocess.CalledProcessError as e:
42
+ if "pip install" in command:
43
+ stdout_log = "\n".join([x for x in e.stdout.split('\n') if '━━' not in x])
44
+ else:
45
+ stdout_log = e.stdout
42
46
  # 如果命令执行失败,返回错误信息和错误输出
43
- return f"执行命令失败 (退出码 {e.returncode}):\n错误: {e.stderr}\n输出: {e.stdout}"
47
+ return f"执行命令失败 (退出码 {e.returncode}):\n错误: {e.stderr}\n输出: {stdout_log}"
44
48
  except Exception as e:
45
49
  return f"执行命令时发生异常: {e}"
46
50
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aient
3
- Version: 1.0.86
3
+ Version: 1.0.88
4
4
  Summary: Aient: The Awakening of Agent.
5
5
  Description-Content-Type: text/markdown
6
6
  License-File: LICENSE
@@ -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=10c1O1tO_RUCH_oOJ6dsDO6T-cVKyqEkd8rh20MsH7s,44826
16
+ aient/models/chatgpt.py,sha256=pimBAmMcTb1wggftyrJ8n3mrwMp0Id7Lddoc3Hg1NUg,45486
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
@@ -22,7 +22,7 @@ aient/models/vertex.py,sha256=qVD5l1Q538xXUPulxG4nmDjXE1VoV4yuAkTCpIeJVw0,16795
22
22
  aient/plugins/__init__.py,sha256=p3KO6Aa3Lupos4i2SjzLQw1hzQTigOAfEHngsldrsyk,986
23
23
  aient/plugins/arXiv.py,sha256=yHjb6PS3GUWazpOYRMKMzghKJlxnZ5TX8z9F6UtUVow,1461
24
24
  aient/plugins/config.py,sha256=KnZ5xtb5o41FI2_qvxTEQhssdd3WJc7lIAFNR85INQw,7817
25
- aient/plugins/excute_command.py,sha256=A5jvmo8DGcluylIooczMHk8t8zs7vq-wQzbF1ETYY2A,1606
25
+ aient/plugins/excute_command.py,sha256=9bCKFSQCRO2OYEYT-C-Vqmme0TRO7tc7bFjOxlT03Fk,1784
26
26
  aient/plugins/get_time.py,sha256=Ih5XIW5SDAIhrZ9W4Qe5Hs1k4ieKPUc_LAd6ySNyqZk,654
27
27
  aient/plugins/image.py,sha256=ZElCIaZznE06TN9xW3DrSukS7U3A5_cjk1Jge4NzPxw,2072
28
28
  aient/plugins/list_directory.py,sha256=5ubm-mfrj-tanGSDp4M_Tmb6vQb3dx2-XVfQ2yL2G8A,1394
@@ -36,8 +36,8 @@ 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.86.dist-info/licenses/LICENSE,sha256=XNdbcWldt0yaNXXWB_Bakoqnxb3OVhUft4MgMA_71ds,1051
40
- aient-1.0.86.dist-info/METADATA,sha256=vwRTGoQaA0Lgp3HBQTJQ1DrVtSvuo05QfWzp4tT7e2k,5000
41
- aient-1.0.86.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
42
- aient-1.0.86.dist-info/top_level.txt,sha256=3oXzrP5sAVvyyqabpeq8A2_vfMtY554r4bVE-OHBrZk,6
43
- aient-1.0.86.dist-info/RECORD,,
39
+ aient-1.0.88.dist-info/licenses/LICENSE,sha256=XNdbcWldt0yaNXXWB_Bakoqnxb3OVhUft4MgMA_71ds,1051
40
+ aient-1.0.88.dist-info/METADATA,sha256=pcgbp2wLsuCO6gZoTmPYUISICv_A8qQnFF8PoCSA26Y,5000
41
+ aient-1.0.88.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
42
+ aient-1.0.88.dist-info/top_level.txt,sha256=3oXzrP5sAVvyyqabpeq8A2_vfMtY554r4bVE-OHBrZk,6
43
+ aient-1.0.88.dist-info/RECORD,,
File without changes