diff --git a/metagpt/document_store/faiss_store.py b/metagpt/document_store/faiss_store.py index 2359917d5..54585dcfc 100644 --- a/metagpt/document_store/faiss_store.py +++ b/metagpt/document_store/faiss_store.py @@ -37,7 +37,11 @@ class FaissStore(LocalStore): return FAISS.load_local(self.raw_data_path.parent, self.embedding, self.fname) def _write(self, docs, metadatas): - store = FAISS.from_texts(docs, self.embedding, metadatas=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 return store def persist(self): diff --git a/metagpt/roles/role.py b/metagpt/roles/role.py index 47a4f45a7..c363d332c 100644 --- a/metagpt/roles/role.py +++ b/metagpt/roles/role.py @@ -524,6 +524,7 @@ class Role(SerializationMixin, ContextMixin, BaseModel): async def think(self) -> Action: """The exported `think` function""" + await self._observe() await self._think() return self.rc.todo @@ -533,9 +534,14 @@ class Role(SerializationMixin, ContextMixin, BaseModel): return ActionOutput(content=msg.content, instruct_content=msg.instruct_content) @property - def first_action(self) -> str: - """AgentStore uses this attribute to display to the user what actions the current role should take.""" - # FIXME: this is a hack, we should not use the first action to represent the todo + def action_description(self) -> str: + """ + AgentStore uses this attribute to display to the user what actions the current role should take. + """ + if self.rc.todo: + if self.rc.todo.desc: + return self.rc.todo.desc + return any_to_name(self.rc.todo) if self.actions: return any_to_name(self.actions[0]) return "" diff --git a/requirements.txt b/requirements.txt index 0a54236f0..f8e4d2585 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,7 +14,7 @@ lancedb==0.4.0 langchain==0.0.352 loguru==0.6.0 meilisearch==0.21.0 -numpy==1.24.3 +numpy>=1.24.3 openai==1.6.0 openpyxl beautifulsoup4==4.12.2