beswarm 0.3.4__py3-none-any.whl → 0.3.5__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/agents/planact.py CHANGED
@@ -194,6 +194,9 @@ class WorkerAgent(BaseAgent):
194
194
  except InputTokenCountExceededError as e:
195
195
  self.broker.publish({"status": "error", "result": "The request body is too long, please try again."}, self.status_topic)
196
196
  return
197
+ except BadRequestError as e:
198
+ self.broker.publish({"status": "error", "result": "Bad request error!"}, self.status_topic)
199
+ return
197
200
  except RetryFailedError as e:
198
201
  self.logger.error("❌ Worker retry failed, retrying...")
199
202
  self.broker.publish(message, self.error_topic)
@@ -108,6 +108,7 @@ class chatgpt(BaseLLM):
108
108
  cache_messages: list = None,
109
109
  logger: logging.Logger = None,
110
110
  check_done: bool = False,
111
+ retry_count: int = 999999,
111
112
  ) -> None:
112
113
  """
113
114
  Initialize Chatbot with API key (from https://platform.openai.com/account/api-keys)
@@ -119,7 +120,7 @@ class chatgpt(BaseLLM):
119
120
  self.function_calls_counter = {}
120
121
  self.function_call_max_loop = function_call_max_loop
121
122
  self.check_done = check_done
122
-
123
+ self.retry_count = retry_count
123
124
  if logger:
124
125
  self.logger = logger
125
126
  else:
@@ -708,7 +709,8 @@ class chatgpt(BaseLLM):
708
709
  # 发送请求并处理响应
709
710
  retry_times = 0
710
711
  error_to_raise = None
711
- while True:
712
+ while retry_times < self.retry_count:
713
+ retry_times += 1
712
714
  tmp_post_json = copy.deepcopy(json_post)
713
715
  if need_done_prompt:
714
716
  tmp_post_json["messages"].extend(need_done_prompt)
@@ -821,8 +823,7 @@ class chatgpt(BaseLLM):
821
823
  error_message = "您输入了无效的API URL,请使用正确的URL并使用`/start`命令重新设置API URL。具体错误如下:\n\n" + str(e)
822
824
  raise ConfigurationError(error_message)
823
825
  # 最后一次重试失败,向上抛出异常
824
- retry_times += 1
825
- if retry_times == 9:
826
+ if retry_times == self.retry_count:
826
827
  raise RetryFailedError(str(e))
827
828
 
828
829
  if error_to_raise:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: beswarm
3
- Version: 0.3.4
3
+ Version: 0.3.5
4
4
  Summary: MAS
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -7,7 +7,7 @@ beswarm/prompt.py,sha256=45onnyoY9plKM86KQefbPw5z9QJMn-mVnjlFQZcrjz0,34373
7
7
  beswarm/taskmanager.py,sha256=2Uz_cthW9rWkQMJdzgsXAMlfN8Ni2Qj_DOq_L-p6XZc,12662
8
8
  beswarm/utils.py,sha256=0J-b38P5QGT-A_38co7FjzaUNJykaskI7mbbcQ4w_68,8215
9
9
  beswarm/agents/chatgroup.py,sha256=PzrmRcDKAbB7cxL16nMod_CzPosDV6bfTmXxQVuv-AQ,12012
10
- beswarm/agents/planact.py,sha256=wYIyrAsBY6Z_Hc8rx76vbfUTsagqYFIBOfPi43ze708,18361
10
+ beswarm/agents/planact.py,sha256=F9sGj8R8bgy3NB_mowhzLfq-lK-0iL-3GFoEHaezU8c,18521
11
11
  beswarm/aient/aient/__init__.py,sha256=SRfF7oDVlOOAi6nGKiJIUK6B_arqYLO9iSMp-2IZZps,21
12
12
  beswarm/aient/aient/architext/architext/__init__.py,sha256=79Ih1151rfcqZdr7F8HSZSTs_iT2SKd1xCkehMsXeXs,19
13
13
  beswarm/aient/aient/architext/architext/core.py,sha256=k5Sza5mrIuv_34T0qUmnFGqAZMFwWhudO96qVlnyA8c,34135
@@ -27,7 +27,7 @@ beswarm/aient/aient/core/test/test_payload.py,sha256=8jBiJY1uidm1jzL-EiK0s6UGmW9
27
27
  beswarm/aient/aient/models/__init__.py,sha256=ZTiZgbfBPTjIPSKURE7t6hlFBVLRS9lluGbmqc1WjxQ,43
28
28
  beswarm/aient/aient/models/audio.py,sha256=FNW4lxG1IhxOU7L8mvcbaeC1nXk_lpUZQlg9ijQ0h_Q,1937
29
29
  beswarm/aient/aient/models/base.py,sha256=HWIGfa2A7OTccvHK0wG1-UlHB-yaWRC7hbi4oR1Mu1Y,7228
30
- beswarm/aient/aient/models/chatgpt.py,sha256=DOm0_tieWj8V_xIQCZy_33PGCebZ8nvKIXXYpzYWw6Y,43601
30
+ beswarm/aient/aient/models/chatgpt.py,sha256=SNgfFaAZ-ESOJmvViThS0vbro2ZAcrPtN1A0NHx3oZc,43711
31
31
  beswarm/aient/aient/plugins/__init__.py,sha256=p3KO6Aa3Lupos4i2SjzLQw1hzQTigOAfEHngsldrsyk,986
32
32
  beswarm/aient/aient/plugins/arXiv.py,sha256=yHjb6PS3GUWazpOYRMKMzghKJlxnZ5TX8z9F6UtUVow,1461
33
33
  beswarm/aient/aient/plugins/config.py,sha256=TGgZ5SnNKZ8MmdznrZ-TEq7s2ulhAAwTSKH89bci3dA,7079
@@ -121,8 +121,8 @@ beswarm/tools/search_web.py,sha256=0fTeczXiOX_LJQGaLEGbuJtIPzofeuquGWEt3yDMtVw,1
121
121
  beswarm/tools/subtasks.py,sha256=NHDnmUhUPgDQKBACnpgErpFJRcsH0w_Q9VsyQjNvNHA,12658
122
122
  beswarm/tools/worker.py,sha256=mQ1qdrQ8MgL99byAbTvxfEByFFGN9mty3UHqHjARMQ8,2331
123
123
  beswarm/tools/write_csv.py,sha256=u0Hq18Ksfheb52MVtyLNCnSDHibITpsYBPs2ub7USYA,1466
124
- beswarm-0.3.4.dist-info/METADATA,sha256=ZypZoU4XNVT0XC2xy89Pc0DK0UY9d5Sf-xV7aJdxGwM,3877
125
- beswarm-0.3.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
126
- beswarm-0.3.4.dist-info/entry_points.txt,sha256=URK7Y4PDzBgxIecQnxsWTu4O-eaFa1CoAcNTWh5R7LM,45
127
- beswarm-0.3.4.dist-info/top_level.txt,sha256=pJw4O87wvt5882smuSO6DfByJz7FJ8SxxT8h9fHCmpo,8
128
- beswarm-0.3.4.dist-info/RECORD,,
124
+ beswarm-0.3.5.dist-info/METADATA,sha256=mzkkw-f0COtfBuXBjj623R3RK9ILKBL0FPXkvqs8FvE,3877
125
+ beswarm-0.3.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
126
+ beswarm-0.3.5.dist-info/entry_points.txt,sha256=URK7Y4PDzBgxIecQnxsWTu4O-eaFa1CoAcNTWh5R7LM,45
127
+ beswarm-0.3.5.dist-info/top_level.txt,sha256=pJw4O87wvt5882smuSO6DfByJz7FJ8SxxT8h9fHCmpo,8
128
+ beswarm-0.3.5.dist-info/RECORD,,