From 2c83921aee8231696947c6dacfc66f340a739648 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=98=E6=9D=83=20=E9=A9=AC?= Date: Sat, 26 Aug 2023 19:54:49 +0800 Subject: [PATCH] feat: +brain memory --- metagpt/roles/assistant.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/metagpt/roles/assistant.py b/metagpt/roles/assistant.py index f75c05695..e02005f31 100644 --- a/metagpt/roles/assistant.py +++ b/metagpt/roles/assistant.py @@ -28,6 +28,7 @@ from metagpt.schema import Message DEFAULT_MAX_TOKENS = 1500 COMMAND_TOKENS = 500 +BRAIN_MEMORY = "BRAIN_MEMORY" class Assistant(Role): @@ -37,7 +38,8 @@ class Assistant(Role): constraints="Talk in {language}", desc="", *args, **kwargs): super(Assistant, self).__init__(options=options, cost_manager=cost_manager, name=name, profile=profile, goal=goal, constraints=constraints, desc=desc, *args, **kwargs) - self.memory = BrainMemory() + brain_memory = options.get(BRAIN_MEMORY) + self.memory = BrainMemory(**brain_memory) if brain_memory else BrainMemory() self.skills = SkillLoader() async def think(self) -> bool: