From d84e9cae2c8dfc5345edb253f59ca1f0901cacab Mon Sep 17 00:00:00 2001 From: lidanyang Date: Thu, 14 Dec 2023 10:34:15 +0800 Subject: [PATCH] fix conflict --- metagpt/actions/write_analysis_code.py | 6 ++---- metagpt/roles/ml_engineer.py | 12 ++++++------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/metagpt/actions/write_analysis_code.py b/metagpt/actions/write_analysis_code.py index 2c45281f9..6970fb4f0 100644 --- a/metagpt/actions/write_analysis_code.py +++ b/metagpt/actions/write_analysis_code.py @@ -24,8 +24,8 @@ from metagpt.utils.common import create_func_config, remove_comments class BaseWriteAnalysisCode(Action): - DEFAULT_SYSTEM_MSG = """You are Code Interpreter, a world-class programmer that can complete any goal by executing code. Strictly follow the plan and generate code step by step. Each step of the code will be executed on the user's machine, and the user will provide the code execution results to you.""" # prompt reference: https://github.com/KillianLucas/open-interpreter/blob/v0.1.4/interpreter/system_message.txt - REUSE_CODE_INSTRUCTION = """ATTENTION: DONT include codes from previous tasks in your current code block, include new codes only, DONT repeat codes!""" + DEFAULT_SYSTEM_MSG = """You are Code Interpreter, a world-class programmer that can complete any goal by executing code. Strictly follow the plan and generate code step by step. Each step of the code will be executed on the user's machine, and the user will provide the code execution results to you.**Notice: The code for the next step depends on the code for the previous step. Must reuse variables in the lastest other code directly, dont creat it again, it is very import for you. Use !pip install in a standalone block to install missing packages.**""" # prompt reference: https://github.com/KillianLucas/open-interpreter/blob/v0.1.4/interpreter/system_message.txt + # REUSE_CODE_INSTRUCTION = """ATTENTION: DONT include codes from previous tasks in your current code block, include new codes only, DONT repeat codes!""" def process_msg(self, prompt: Union[str, List[Dict], Message, List[Message]], system_msg: str = None): default_system_msg = system_msg or self.DEFAULT_SYSTEM_MSG @@ -201,8 +201,6 @@ class WriteCodeWithTools(BaseWriteAnalysisCode): module_name=module_name, tool_catalog=tool_catalog, ) - - else: prompt = GENERATE_CODE_PROMPT.format( user_requirement=plan.goal, diff --git a/metagpt/roles/ml_engineer.py b/metagpt/roles/ml_engineer.py index 8f06a541c..0b76711f4 100644 --- a/metagpt/roles/ml_engineer.py +++ b/metagpt/roles/ml_engineer.py @@ -159,12 +159,12 @@ class MLEngineer(Role): # print("*" * 10) # breakpoint() if counter > 0: - improve_code = await DebugCode().run(plan=self.plan.current_task.instruction, - # finished_code=code_context, - # finished_code_result=code_result, - code=code, - runtime_result=self.working_memory.get(), - context=debug_context) + improve_code = await DebugCode().run( + plan=self.plan.current_task.instruction, + code=code, + runtime_result=self.working_memory.get(), + context=debug_context + ) if improve_code != "": code = improve_code