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): diff --git a/metagpt/roles/role.py b/metagpt/roles/role.py index ef71bbd96..5da39f80f 100644 --- a/metagpt/roles/role.py +++ b/metagpt/roles/role.py @@ -523,20 +523,29 @@ 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 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: