From 8b84e269a1e803b852e7d8e319f8579e6b10de4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=98=E6=9D=83=20=E9=A9=AC?= Date: Mon, 22 Jan 2024 10:30:38 +0800 Subject: [PATCH 1/5] feat: remove error print --- metagpt/document_store/faiss_store.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/metagpt/document_store/faiss_store.py b/metagpt/document_store/faiss_store.py index 54585dcfc..2359917d5 100644 --- a/metagpt/document_store/faiss_store.py +++ b/metagpt/document_store/faiss_store.py @@ -37,11 +37,7 @@ class FaissStore(LocalStore): return FAISS.load_local(self.raw_data_path.parent, self.embedding, self.fname) def _write(self, docs, metadatas): - try: - store = FAISS.from_texts(docs, self.embedding, metadatas=metadatas) - except Exception as e: - logger.error(f"Failed to write. error: {e}") - raise e + store = FAISS.from_texts(docs, self.embedding, metadatas=metadatas) return store def persist(self): From bda2e06d368e1c80306d441a7ce80da57d5d62f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=98=E6=9D=83=20=E9=A9=AC?= Date: Mon, 22 Jan 2024 10:50:32 +0800 Subject: [PATCH 2/5] feat: +note --- metagpt/roles/role.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/metagpt/roles/role.py b/metagpt/roles/role.py index c363d332c..28d2fe693 100644 --- a/metagpt/roles/role.py +++ b/metagpt/roles/role.py @@ -523,19 +523,26 @@ class Role(SerializationMixin, ContextMixin, BaseModel): return not self.rc.news and not self.rc.todo and self.rc.msg_buffer.empty() async def think(self) -> Action: - """The exported `think` function""" - await self._observe() + """ + Export SDK API, used by AgentStore RPC. + The exported `think` function + """ + await self._observe() # For compatibility with the old version of the Agent. await self._think() return self.rc.todo async def act(self) -> ActionOutput: - """The exported `act` function""" + """ + Export SDK API, used by AgentStore RPC. + The exported `act` function + """ msg = await self._act() return ActionOutput(content=msg.content, instruct_content=msg.instruct_content) @property def action_description(self) -> str: """ + Export SDK API, used by AgentStore RPC. AgentStore uses this attribute to display to the user what actions the current role should take. """ if self.rc.todo: From 525d94317cdcfb191280b2ac8485edc500e2b8f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=98=E6=9D=83=20=E9=A9=AC?= Date: Mon, 22 Jan 2024 10:52:36 +0800 Subject: [PATCH 3/5] feat: +note --- metagpt/roles/role.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/metagpt/roles/role.py b/metagpt/roles/role.py index 28d2fe693..53798f385 100644 --- a/metagpt/roles/role.py +++ b/metagpt/roles/role.py @@ -524,7 +524,7 @@ class Role(SerializationMixin, ContextMixin, BaseModel): async def think(self) -> Action: """ - Export SDK API, used by AgentStore RPC. + Export SDK API, used by AgentStore RPC and Agent. The exported `think` function """ await self._observe() # For compatibility with the old version of the Agent. @@ -533,7 +533,7 @@ class Role(SerializationMixin, ContextMixin, BaseModel): async def act(self) -> ActionOutput: """ - Export SDK API, used by AgentStore RPC. + Export SDK API, used by AgentStore RPC and Agent. The exported `act` function """ msg = await self._act() @@ -542,7 +542,7 @@ class Role(SerializationMixin, ContextMixin, BaseModel): @property def action_description(self) -> str: """ - Export SDK API, used by AgentStore RPC. + Export SDK API, used by AgentStore RPC and Agent. AgentStore uses this attribute to display to the user what actions the current role should take. """ if self.rc.todo: From f15b772d77d76a92a8214cf2b5d4f071de9d8a10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=98=E6=9D=83=20=E9=A9=AC?= Date: Mon, 22 Jan 2024 10:54:15 +0800 Subject: [PATCH 4/5] feat: +note --- metagpt/roles/role.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metagpt/roles/role.py b/metagpt/roles/role.py index 53798f385..dba14bb72 100644 --- a/metagpt/roles/role.py +++ b/metagpt/roles/role.py @@ -524,7 +524,7 @@ class Role(SerializationMixin, ContextMixin, BaseModel): async def think(self) -> Action: """ - Export SDK API, used by AgentStore RPC and Agent. + Export SDK API, used by AgentStore RPC. The exported `think` function """ await self._observe() # For compatibility with the old version of the Agent. @@ -533,7 +533,7 @@ class Role(SerializationMixin, ContextMixin, BaseModel): async def act(self) -> ActionOutput: """ - Export SDK API, used by AgentStore RPC and Agent. + Export SDK API, used by AgentStore RPC. The exported `act` function """ msg = await self._act() From 85465fe500121f65b9c38312034926b7754a0a17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=98=E6=9D=83=20=E9=A9=AC?= Date: Mon, 22 Jan 2024 11:04:03 +0800 Subject: [PATCH 5/5] feat: +note --- metagpt/roles/role.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/metagpt/roles/role.py b/metagpt/roles/role.py index dba14bb72..3747072f1 100644 --- a/metagpt/roles/role.py +++ b/metagpt/roles/role.py @@ -544,6 +544,8 @@ class Role(SerializationMixin, ContextMixin, BaseModel): """ Export SDK API, used by AgentStore RPC and Agent. AgentStore uses this attribute to display to the user what actions the current role should take. + `Role` provides the default property, and this property should be overridden by children classes if necessary, + as demonstrated by the `Engineer` class. """ if self.rc.todo: if self.rc.todo.desc: