beswarm 0.1.59__py3-none-any.whl → 0.1.61__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.
beswarm/aient/setup.py CHANGED
@@ -4,7 +4,7 @@ from setuptools import setup, find_packages
4
4
 
5
5
  setup(
6
6
  name="aient",
7
- version="1.1.14",
7
+ version="1.1.16",
8
8
  description="Aient: The Awakening of Agent.",
9
9
  long_description=Path.open(Path("README.md"), encoding="utf-8").read(),
10
10
  long_description_content_type="text/markdown",
@@ -1510,9 +1510,10 @@ async def get_claude_payload(request, engine, provider, api_key=None):
1510
1510
  payload = {
1511
1511
  "model": original_model,
1512
1512
  "messages": messages,
1513
- "system": system_prompt or "You are Claude, a large language model trained by Anthropic.",
1514
1513
  "max_tokens": max_tokens,
1515
1514
  }
1515
+ if system_prompt:
1516
+ payload["system"] = system_prompt
1516
1517
 
1517
1518
  if request.max_tokens:
1518
1519
  payload["max_tokens"] = int(request.max_tokens)
@@ -1560,7 +1561,7 @@ async def get_claude_payload(request, engine, provider, api_key=None):
1560
1561
  payload.pop("tools", None)
1561
1562
  payload.pop("tool_choice", None)
1562
1563
 
1563
- if "think" in request.model:
1564
+ if "think" in request.model.lower():
1564
1565
  payload["thinking"] = {
1565
1566
  "budget_tokens": 4096,
1566
1567
  "type": "enabled"
@@ -1586,6 +1587,14 @@ async def get_claude_payload(request, engine, provider, api_key=None):
1586
1587
  payload.pop("top_k", None)
1587
1588
  # print("payload", json.dumps(payload, indent=2, ensure_ascii=False))
1588
1589
 
1590
+ if safe_get(provider, "preferences", "post_body_parameter_overrides", default=None):
1591
+ for key, value in safe_get(provider, "preferences", "post_body_parameter_overrides", default={}).items():
1592
+ if key == request.model:
1593
+ for k, v in value.items():
1594
+ payload[k] = v
1595
+ elif all(_model not in request.model.lower() for _model in ["gemini", "gpt", "claude"]):
1596
+ payload[key] = value
1597
+
1589
1598
  return url, headers, payload
1590
1599
 
1591
1600
  async def get_dalle_payload(request, engine, provider, api_key=None):
@@ -44,6 +44,7 @@ system_prompt = """
44
44
  2. Always respond in 中文。
45
45
  3. 尽力满足user的请求,如果 user 要求你使用工具,请自行根据工具的参数要求,组织参数,将工具调用组织成xml格式,即可触发工具执行流程。如果user提供了明确的xml工具调用,请直接复述user的xml工具调用。你必须复述user的xml工具调用才能真正调用工具。
46
46
  4. 禁止要求user调用工具,当你需要调用工具时,请自行组织参数,将工具调用组织成xml格式,即可触发工具执行流程。禁止自己没有使用xml格式调用工具就假定工具已经调用。
47
+ 5. 仔细阅读并理解 user 的任务描述和当前指令。user 会根据任务描述分步骤让你执行,因此请严格遵循 user 指令按步骤操作,并请勿自行完成 user 未指定的步骤。在 user 明确给出下一步指令前,绝不擅自行动或推测、执行任何未明确要求的后续步骤。完成当前 user 指定的步骤后,必须主动向 user 汇报该步骤的完成情况,并明确请求 user 提供下一步的操作指令。
47
48
  </communication>
48
49
 
49
50
  <making_code_changes>
beswarm/tools/worker.py CHANGED
@@ -1,5 +1,6 @@
1
1
  import os
2
2
  import copy
3
+ import json
3
4
  import platform
4
5
  from datetime import datetime
5
6
 
@@ -74,6 +75,13 @@ async def worker(goal, tools, work_dir, cache_messages=None):
74
75
  # 让指令agent分析对话历史并生成新指令
75
76
  instruction_agent = chatgpt(**instruction_agent_config)
76
77
  conversation_history = copy.deepcopy(work_agent.conversation["default"])
78
+
79
+ cache_dir = os.path.join(work_dir, ".beswarm")
80
+ os.makedirs(cache_dir, exist_ok=True)
81
+ cache_file = os.path.join(cache_dir, "work_agent_conversation_history.json")
82
+ with open(cache_file, "w", encoding="utf-8") as f:
83
+ f.write(json.dumps(conversation_history, ensure_ascii=False, indent=4))
84
+
77
85
  conversation_history.pop(0)
78
86
  instruction_agent.conversation["default"][1:] = conversation_history
79
87
  if "find_and_click_element" in str(tools_json):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: beswarm
3
- Version: 0.1.59
3
+ Version: 0.1.61
4
4
  Summary: MAS
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -1,12 +1,12 @@
1
1
  beswarm/__init__.py,sha256=HZjUOJtZR5QhMuDbq-wukQQn1VrBusNWai_ysGo-VVI,20
2
2
  beswarm/utils.py,sha256=Z2Kuus2BLp9EHUC2ZNL9iUsb6NWnPj-MTA7SYzGyg24,1755
3
3
  beswarm/aient/main.py,sha256=SiYAIgQlLJqYusnTVEJOx1WNkSJKMImhgn5aWjfroxg,3814
4
- beswarm/aient/setup.py,sha256=qROUPbImzYY1XRZJ-vg_r1jy-51i5axd7ROuKJKxUJ4,487
4
+ beswarm/aient/setup.py,sha256=Sd2NPcQ4WHx-F_jSx8hMYbLMTtRxIo6a-wxcEkruwW0,487
5
5
  beswarm/aient/src/aient/__init__.py,sha256=SRfF7oDVlOOAi6nGKiJIUK6B_arqYLO9iSMp-2IZZps,21
6
6
  beswarm/aient/src/aient/core/__init__.py,sha256=NxjebTlku35S4Dzr16rdSqSTWUvvwEeACe8KvHJnjPg,34
7
7
  beswarm/aient/src/aient/core/log_config.py,sha256=kz2_yJv1p-o3lUQOwA3qh-LSc3wMHv13iCQclw44W9c,274
8
8
  beswarm/aient/src/aient/core/models.py,sha256=kF-HLi1I2k_G5r153ZHuiGH8_NmpTlFMfK0_myB28YQ,7366
9
- beswarm/aient/src/aient/core/request.py,sha256=9GbzEg7jIH8s-jXeB1gsfoOsDbwg4C6LqXvRxVTnqEs,65263
9
+ beswarm/aient/src/aient/core/request.py,sha256=2u_vPJjoIqRsKOPOkPilGzM4iZXUpsx5xtouQy87Z4E,65693
10
10
  beswarm/aient/src/aient/core/response.py,sha256=Z0Bjl_QvpUguyky1LIcsVks4BKKqT0eYEpDmKa_cwpQ,31978
11
11
  beswarm/aient/src/aient/core/utils.py,sha256=-naFCv8V-qhnqvDUd8BNbW1HR9CVAPxISrXoAz464Qg,26580
12
12
  beswarm/aient/src/aient/core/test/test_base_api.py,sha256=pWnycRJbuPSXKKU9AQjWrMAX1wiLC_014Qc9hh5C2Pw,524
@@ -36,7 +36,7 @@ beswarm/aient/src/aient/plugins/run_python.py,sha256=dgcUwBunMuDkaSKR5bToudVzSdr
36
36
  beswarm/aient/src/aient/plugins/websearch.py,sha256=llxy1U0vJiNMiKvamMr4p7IruLb3nnDR4YErz8TYimc,15215
37
37
  beswarm/aient/src/aient/plugins/write_file.py,sha256=YRvQKMvV-5lwohxlvwt9hjfxz2dRJP85AJWAMUIqbBY,3804
38
38
  beswarm/aient/src/aient/prompt/__init__.py,sha256=GBtn6-JDT8KHFCcuPpfSNE_aGddg5p4FEyMCy4BfwGs,20
39
- beswarm/aient/src/aient/prompt/agent.py,sha256=y2GETN6ScC5yQVs75VFfzm4YUWzblbqLYz0Sy6JnPRw,24950
39
+ beswarm/aient/src/aient/prompt/agent.py,sha256=ZNsbgXRyvYzAFTRRziAnNVqcTyAnxrGcsGfGrt72j6k,25427
40
40
  beswarm/aient/src/aient/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
41
  beswarm/aient/src/aient/utils/prompt.py,sha256=UcSzKkFE4-h_1b6NofI6xgk3GoleqALRKY8VBaXLjmI,11311
42
42
  beswarm/aient/src/aient/utils/scripts.py,sha256=LD8adnfuRrJoY2tWKseXOPJXaxbrUmz4czsnUvHswNY,29096
@@ -127,8 +127,8 @@ beswarm/tools/repomap.py,sha256=N09K0UgwjCN7Zjg_5TYlVsulp3n2fztYlS8twalChU8,4500
127
127
  beswarm/tools/search_arxiv.py,sha256=9slwBemXjEqrd7-YgVmyMijPXlkhZCybEDRVhWVQ9B0,7937
128
128
  beswarm/tools/search_web.py,sha256=B24amOnGHnmdV_6S8bw8O2PdhZRRIDtJjg-wXcfP7dQ,11859
129
129
  beswarm/tools/think.py,sha256=WLw-7jNIsnS6n8MMSYUin_f-BGLENFmnKM2LISEp0co,1760
130
- beswarm/tools/worker.py,sha256=PRsAa856KYNPbi2L8rDdWEKx3u-c_WzxoI1x8AFkmtc,5613
131
- beswarm-0.1.59.dist-info/METADATA,sha256=LrUP7SrPGRG87cgSLMuE7liHKGGMIe4bQUdOhbfRifk,3553
132
- beswarm-0.1.59.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
133
- beswarm-0.1.59.dist-info/top_level.txt,sha256=pJw4O87wvt5882smuSO6DfByJz7FJ8SxxT8h9fHCmpo,8
134
- beswarm-0.1.59.dist-info/RECORD,,
130
+ beswarm/tools/worker.py,sha256=2EOag_yo8qC020jx32tcU9G_gzT3PeYasukLwuuOAJQ,5976
131
+ beswarm-0.1.61.dist-info/METADATA,sha256=NegTlo6GWu7fnnEQJuZ_zR35Ick42dQdgXxp3lns8P0,3553
132
+ beswarm-0.1.61.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
133
+ beswarm-0.1.61.dist-info/top_level.txt,sha256=pJw4O87wvt5882smuSO6DfByJz7FJ8SxxT8h9fHCmpo,8
134
+ beswarm-0.1.61.dist-info/RECORD,,