8
Bug description 在 common.py 的 def role_raise_decorator(func): 方法的异常捕获代码没有打印完整的ex 如果调用LLM出现错误时,比如404错误,或者模型不支持时,控制台只会显示warning信息.
There is a exception in role's execution, in order to resume, we delete the newest role communication message in the role's memory.
但丢失了原始Exception的信息.
Bug solved method 应该增加ex捕获,并打印
def role_raise_decorator(func):
async def wrapper(self, *args, **kwargs):
try:
return await func(self, *args, **kwargs)
except KeyboardInterrupt as kbi:
logger.error(f"KeyboardInterrupt: {kbi} occurs, start to serialize the project")
if self.latest_observed_msg:
self.rc.memory.delete(self.latest_observed_msg)
# raise again to make it captured outside
raise Exception(format_trackback_info(limit=None))
except Exception as ex: # 捕获ex
logger.error(f"Exception: {ex} occurs, start to serialize the project") # 打印 ex的具体错误.
if self.latest_observed_msg:
logger.warning(
"There is a exception in role's execution, in order to resume, "
"we delete the newest role communication message in the role's memory."
)
# remove role newest observed msg to make it observed again
self.rc.memory.delete(self.latest_observed_msg)
# raise again to make it captured outside
raise Exception(format_trackback_info(limit=None))
return wrapper
Environment information
-
LLM type and model name: Auzre + gpt-3.5
-
System version:
-
Python version:
- packages version:
- installation method:
Screenshots or logs 如果不加的话,就只有下面的提示
2024-01-12 17:22:52.030 | ERROR | metagpt.utils.common:wrapper:509 - Exception: Error code: 404 - {'error': {'code': 'DeploymentNotFound', 'message': 'The API deployment for this resource does not exist. If you created the deployment within the last 5 minutes, please wait a moment and try again.'}} occurs, start to serialize the project
2024-01-12 17:22:52.032 | WARNING | metagpt.utils.common:wrapper:511 - There is a exception in role's execution, in order to resume, we delete the newest role communication message in the role's memory.