diff --git a/metagpt/actions/research.py b/metagpt/actions/research.py index 074cdee0a..2d2db4403 100644 --- a/metagpt/actions/research.py +++ b/metagpt/actions/research.py @@ -181,6 +181,7 @@ class WebBrowseAndSummarize(Action): desc: str = "Explore the web and provide summaries of articles and webpages." browse_func: Union[Callable[[list[str]], None], None] = None web_browser_engine: WebBrowserEngine = WebBrowserEngine( + options={}, # FIXME: REMOVE options? engine=WebBrowserEngineType.CUSTOM if browse_func else None, run_func=browse_func, ) diff --git a/metagpt/actions/write_prd.py b/metagpt/actions/write_prd.py index 362d4cc82..071eacd29 100644 --- a/metagpt/actions/write_prd.py +++ b/metagpt/actions/write_prd.py @@ -123,7 +123,7 @@ class WritePRD(Action): # logger.info(rsp) project_name = CONFIG.project_name if CONFIG.project_name else "" context = CONTEXT_TEMPLATE.format(requirements=requirements, project_name=project_name) - node = await WRITE_PRD_NODE.fill(context=context, llm=self.llm, schema=schema) + node = await WRITE_PRD_NODE.fill(context=context, llm=self.llm) # schema=schema await self._rename_workspace(node) return node diff --git a/metagpt/provider/openai_api.py b/metagpt/provider/openai_api.py index 9305052b8..71fe56bf4 100644 --- a/metagpt/provider/openai_api.py +++ b/metagpt/provider/openai_api.py @@ -28,7 +28,7 @@ from tenacity import ( ) from metagpt.config import CONFIG, Config, LLMProviderEnum -from metagpt.const import DEFAULT_MAX_TOKENS +from metagpt.const import DEFAULT_MAX_TOKENS, DEFAULT_TOKEN_SIZE from metagpt.logs import logger from metagpt.provider.base_gpt_api import BaseGPTAPI from metagpt.provider.constant import GENERAL_FUNCTION_SCHEMA, GENERAL_TOOL_CHOICE diff --git a/metagpt/roles/engineer.py b/metagpt/roles/engineer.py index 994c176e9..76c3d96b3 100644 --- a/metagpt/roles/engineer.py +++ b/metagpt/roles/engineer.py @@ -78,9 +78,8 @@ class Engineer(Role): n_borg: int = 1 use_code_review: bool = False code_todos: list = [] - summarize_todos = [] - - todo_desc: str = any_to_name(WriteCode) + summarize_todos: list = [] + next_todo_action: str = "" def __init__(self, **kwargs) -> None: super().__init__(**kwargs) @@ -89,6 +88,7 @@ class Engineer(Role): self._watch([WriteTasks, SummarizeCode, WriteCode, WriteCodeReview, FixBug]) self.code_todos = [] self.summarize_todos = [] + self.next_todo_action = any_to_name(WriteCode) @staticmethod def _parse_tasks(task_msg: Document) -> list[str]: @@ -132,10 +132,10 @@ class Engineer(Role): if self._rc.todo is None: return None if isinstance(self._rc.todo, WriteCode): - self.todo_desc = any_to_name(SummarizeCode) + self.next_todo_action = any_to_name(SummarizeCode) return await self._act_write_code() if isinstance(self._rc.todo, SummarizeCode): - self.todo_desc = any_to_name(WriteCode) + self.next_todo_action = any_to_name(WriteCode) return await self._act_summarize() return None @@ -311,4 +311,4 @@ class Engineer(Role): @property def todo(self) -> str: """AgentStore uses this attribute to display to the user what actions the current role should take.""" - return self.todo_desc + return self.next_todo_action diff --git a/metagpt/roles/product_manager.py b/metagpt/roles/product_manager.py index 847649a82..5412dc2b5 100644 --- a/metagpt/roles/product_manager.py +++ b/metagpt/roles/product_manager.py @@ -29,14 +29,14 @@ class ProductManager(Role): profile: str = "Product Manager" goal: str = "efficiently create a successful product that meets market demands and user expectations" constraints: str = "utilize the same language as the user requirements for seamless communication" - - todo_desc: str = any_to_name(PrepareDocuments) + todo_action: str = "" def __init__(self, **kwargs) -> None: super().__init__(**kwargs) self._init_actions([PrepareDocuments, WritePRD]) self._watch([UserRequirement, PrepareDocuments]) + self.todo_action = any_to_name(PrepareDocuments) async def _think(self) -> bool: """Decide what to do""" @@ -44,13 +44,13 @@ class ProductManager(Role): self._set_state(1) else: self._set_state(0) - self.todo_desc = any_to_name(WritePRD) + self.todo_action = any_to_name(WritePRD) return bool(self._rc.todo) async def _observe(self, ignore_memory=False) -> int: - return await super(ProductManager, self)._observe(ignore_memory=True) + return await super()._observe(ignore_memory=True) @property def todo(self) -> str: """AgentStore uses this attribute to display to the user what actions the current role should take.""" - return self.todo_desc + return self.todo_action