MetaGPT icon indicating copy to clipboard operation
MetaGPT copied to clipboard

Bug in Environment Initialization with Direct Role Assignment Causes Error

Open iphysresearch opened this issue 2 years ago • 1 comments

Bug description

我看到Environment中也初始化参数也可以直接定义Role进去,所以我就试了下(因为我目标要实现多个不同的环境下的不同Team要协作),结果发现直接Bug报错。目测Bug的来源我还不太确定,因为我不太熟悉这个类的构造方式。根据下面截图的报错,可能是在 self.roles 赋值的时候,触发了什么机制保护?

Bug solved method

如上。

Environment information

  • LLM type and model name:
    • gpt-4-1106-preview
  • System version:
# Inside a docker container
Linux e24f4ba5e757 6.2.0-26-generic #26~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jul 13 16:27:29 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
  • Python version:
    • Conda Python 3.10.13
  • MetaGPT version or branch:
    • 0.8.0
  • packages version:
  • installation method:
pip install -e . && pip install -e .[rag]

Screenshots or logs

image

iphysresearch avatar Mar 31 '24 12:03 iphysresearch

Maybe you can ref to examples/debate_simple.py, firstly init environment and then add roles into team. or, Environment(desc="xxx", roles={assistant1.profile: assistant1, assistant2.profile: assistant2}) which due to the rolesinside env is a dict that keys areprofileofrole`.

BTW, I see you define a android assistant, what's your demands?

better629 avatar Mar 31 '24 13:03 better629