From 79744803fd9951269c50284e8c27f664651e4c1e Mon Sep 17 00:00:00 2001 From: lidanyang Date: Tue, 9 Jul 2024 16:59:19 +0800 Subject: [PATCH] refine prompt --- metagpt/prompts/di/data_analyst.py | 7 +++++++ metagpt/prompts/di/role_zero.py | 4 ++-- metagpt/prompts/di/write_analysis_code.py | 6 ++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/metagpt/prompts/di/data_analyst.py b/metagpt/prompts/di/data_analyst.py index 8450b2fe1..27b247fb3 100644 --- a/metagpt/prompts/di/data_analyst.py +++ b/metagpt/prompts/di/data_analyst.py @@ -41,3 +41,10 @@ Some text indicating your thoughts, such as how you should update the plan statu ] ``` """ + +BROWSER_INSTRUCTION = """ +4. Carefully choose to use or not use the browser tool to assist you in web tasks. + - When no click action is required, no need to use the browser tool to navigate to the webpage before scraping. + - If you need detail HTML content, write code to get it but not to use the browser tool. + - Make sure the command_name are certainly in Available Commands when you use the browser tool. +""" diff --git a/metagpt/prompts/di/role_zero.py b/metagpt/prompts/di/role_zero.py index 2b4fe105a..ea25aab82 100644 --- a/metagpt/prompts/di/role_zero.py +++ b/metagpt/prompts/di/role_zero.py @@ -5,7 +5,7 @@ When presented a current task, tackle the task using the available commands. Pay close attention to new user message, review the conversation history, use RoleZero.reply_to_human to respond to new user requirement. Note: 1. If you keeping encountering errors, unexpected situation, or you are not sure of proceeding, use RoleZero.ask_human to ask for help. -2. Carefully review your progress at the current task, if your actions so far has not fulfilled the task instruction, you should continue with current task. Otherwise, finish current task by Plan.finish_current_task. +2. Carefully review your progress at the current task, if your actions so far has not fulfilled the task instruction, you should continue with current task. Otherwise, finish current task by Plan.finish_current_task explicitly. 3. Each time you finish a task, use RoleZero.reply_to_human to report your progress. """ @@ -41,7 +41,7 @@ Pay close attention to the Example provided, you can reuse the example for your You may use any of the available commands to create a plan or update the plan. You may output mutiple commands, they will be executed sequentially. If you finish current task, you will automatically take the next task in the existing plan, use Plan.finish_task, DON'T append a new task. -# Your commands in a json array, in the following output format with command_name and args. If there is nothing to do, use the pass or end command: +# Your commands in a json array, in the following output format with correct command_name and args. If there is nothing to do, use the pass or end command: Some text indicating your thoughts, such as how you should update the plan status, respond to inquiry, or seek for help. Then a json array of commands. You must output ONE and ONLY ONE json array. DON'T output multiple json arrays with thoughts between them. ```json [ diff --git a/metagpt/prompts/di/write_analysis_code.py b/metagpt/prompts/di/write_analysis_code.py index 1d743a719..bf67d8ba0 100644 --- a/metagpt/prompts/di/write_analysis_code.py +++ b/metagpt/prompts/di/write_analysis_code.py @@ -119,3 +119,9 @@ DATA_INFO = """ Latest data info after previous tasks: {info} """ + +BROWSER_INFO = """ +Here are ordered web actions in the browser environment, note that you can not use the browser tool in the current environment. +{browser_memory} +The latest url is the one you should use to view the page. If view page has been done, directly use the variable and html content in executing result. +"""