refine prompt

This commit is contained in:
lidanyang 2024-07-26 14:06:18 +08:00
parent 24332620b7
commit 32458e574e
4 changed files with 10 additions and 15 deletions

View file

@ -2,9 +2,9 @@ from metagpt.strategy.task_type import TaskType
EXTRA_INSTRUCTION = """
6. 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.
- When no click action is required, no need to use the Browser tool to navigate to the webpage before scraping.
- Write code to view the HTML content rather than using the Browser tool.
- Make sure the command_name are certainly in Available Commands when you use the Browser tool.
7. When you are making plan. It is highly recommend to plan and append all the tasks in first response once time.
8. Don't finish_current_task multiple times for the same task.
9. Finish current task timely, such as when the code is written and executed successfully.
@ -20,10 +20,3 @@ CODE_STATUS = """
**Execution status**: {status}
**Execution result**: {result}
"""
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_actions}
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.
"""

View file

@ -57,5 +57,5 @@ The current task is about converting image into webpage code. please note the fo
# Prompt for taking on "web_scraping" tasks
WEB_SCRAPING_PROMPT = """
- Remember to view and print the necessary HTML content in a separate task to understand the structure first before scraping data. Such as `html_content = await view_page_element_to_scrape(...)\nprint(html_content)`.
- Since the data required by user may not correspond directly to the actual HTML element names, you should thoroughly analyze the HTML structure and meanings of all elements in the executing result first. Ensure the `class_` in your code should derived from the actual HTML structure directly, not based on your knowledge. To ensure it, analyse the most suitable location of the 'class_' in the actual HTML content before code.
- Since the data required by user may not correspond directly to the actual HTML element names, you should thoroughly analyze the HTML structure and meanings of all elements in your context first. Ensure the `class_` in your code should derived from the actual HTML structure directly, not based on your knowledge. To ensure it, analyse the most suitable location of the 'class_' in the actual HTML content before code.
"""

View file

@ -937,7 +937,7 @@ Explanation: The requirement is to scrape data from a website and extract inform
"args": {
"task_id": "3",
"dependent_task_ids": ["2"],
"instruction": "View the html content of the search result page before scrap data to understand the structure.",
"instruction": "View and print the html content of the search result page before scrap data to understand the structure.",
"assignee": "David"
}
},
@ -988,7 +988,7 @@ Explanation: Since the Browser has successfully navigated to the website, and I
```
## action 4
Explanation: Since the Browser has successfully search the keyword `beef`, I will finish the current task and then write code to view the html content of the page.
Explanation: Since the Browser has successfully search the keyword `beef`, I will finish the current task and then write code to view and print the html content of the page.
```json
[
@ -1034,7 +1034,7 @@ Explanation: The requirement is to scrape data from a website and extract inform
"args": {
"task_id": "1",
"dependent_task_ids": [],
"instruction": "View the html content of the page before scrap data to understand the structure.",
"instruction": "View and print the html content of the page before scrap data to understand the structure.",
"assignee": "David"
}
},
@ -1051,7 +1051,7 @@ Explanation: The requirement is to scrape data from a website and extract inform
```
## action 2
Explanation: To scrap data from the website, I will first view the html content of the page.
Explanation: To scrap data from the website, I will first view and print the html content of the page.
```json
[

View file

@ -42,7 +42,9 @@ PLAN_STATUS = """
## Finished Section of Current Task
### code
```python
{current_task_code}
```
### execution result
{current_task_result}