forked from Skyvern-AI/skyvern
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Observer code open source (Skyvern-AI#1417)
- Loading branch information
1 parent
0b7ce06
commit 68f0d59
Showing
12 changed files
with
1,071 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
You're to assist the user to achieve the user goal in the web, given the DOM elements in the list, the screenshots of the website and the task history list. Plan the next task the use needs to do towards the goal. | ||
|
||
You have access to the following task types to take actions: | ||
- navigate: this task can be used to set up a mini goal to achieve in the web which most likely results in navigating the web, like filling a form in the page, clicking a buton in the page to open or navigate to another page, interacting with some elements in the page like clicking, typing and selecting options, and so on. | ||
- extract: extract information users would like to output from the page. When planning such a task, you should not expect anything related to navigation mentioned in the "navigate" task. The website will remain still and the only action here is to extract information from it. | ||
- loop: this task can be used to generate a list of planning sessions like this. When to use a loop task? Use loop when there are multiple parallel tasks you can do with the same goal. Each task in the loop has the same goal but with different objects/values/targets/variables. Use loop task when it's in a "breadth first search" situation where you can go through a list of values and execute the same task for each value. Examples: | ||
- When the goal is "Open up to 10 links from an ecomm search result page, and extract information like the price of each product.", loop task should be used to iterate through a list of links or URLs. In each iteration of the loop, the task will go to the linked page and trigger another planning session with the goal of extrating price information of the product | ||
- When the goal is "download 5 documents found on a page", loop task should be used to iterate through a list of document names. Each document will trigger another planning session to download the relative document | ||
|
||
MAKE SURE YOU OUTPUT VALID JSON. No text before or after JSON, no trailing commas, no comments (//), no unnecessary quotes, etc. | ||
|
||
Reply in JSON format with the following keys: | ||
{ | ||
"page_info": str, // Think step by step. Describe all the useful information in the page related to the user goal. | ||
"thoughts": str, // Think step by step. What has been done so far and what is the next reasonable mini goal a human can do foreseeably move towards the overall goal. | ||
"user_goal_achieved": bool, // True if the user goal has been completed, false otherwise. If the user is searching for something, looking for information or specifically trying to extract information along side the goal, make sure at least an extract task has happened in the task history before claiming that the goal is achieved. | ||
"plan": str, // The mini goal to achieve to move towards the goal. Include all the necessary and required user information provided by the user goal to achieve the plan. DO NOT come up or hallucinate any data that's not provided in the user goal. Be accurate and precise. Return null if the user goal has been achieved. | ||
"task_type": str, // One of the available task types: navigate, extract, loop | ||
"loop_values": list[str], // a list of string values to iterate through for loop task. null if it's not a loop task | ||
"is_loop_value_link": bool, // true if the loop_values is a list of urls to go to before for each planning session inside the loop | ||
} | ||
|
||
The URL of the page you're on right now is `{{ current_url }}`. | ||
|
||
Clickable elements from the page: | ||
``` | ||
{{ elements }} | ||
``` | ||
|
||
User goal: | ||
``` | ||
{{ user_goal }} | ||
``` | ||
|
||
Task history (the earliest task is the first in the list and the latest is the last in the list): | ||
``` | ||
{{ task_history }} | ||
``` | ||
|
||
Current datetime, ISO format: | ||
``` | ||
{{ local_datetime }} | ||
``` |
22 changes: 22 additions & 0 deletions
22
skyvern/forge/prompts/skyvern/observer_check_completion.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
You're to assist the user to achieve the user goal in the web, given the user goal and the mini tasks that have been completed by the user along the way. | ||
|
||
Reply in JSON format with the following keys: | ||
{ | ||
"thoughts": str, // Think step by step. Would completing the tasks in the task history be good enough to achieve the user goal? If more tasks need to be completed to achieve the goal, what would be the next task? | ||
"user_goal_achieved": bool, // True if the user goal has been completed, false otherwise. If the user wants to extract information along side the goal, make sure the extract task has happened before claiming that the goal is achieved. | ||
} | ||
|
||
User goal: | ||
``` | ||
{{ user_goal }} | ||
``` | ||
|
||
Task history (the earliest task is the first in the list and the latest is the last in the list): | ||
``` | ||
{{ task_history }} | ||
``` | ||
|
||
Current datetime, ISO format: | ||
``` | ||
{{ local_datetime }} | ||
``` |
25 changes: 25 additions & 0 deletions
25
skyvern/forge/prompts/skyvern/observer_generate_extraction_task.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
You're to assist the user to extract data from the web. Given the data extraction goal, DOM elements in the list and the screenshots of the website, design the schema for the data output. | ||
|
||
MAKE SURE YOU OUTPUT VALID JSON. No text before or after JSON, no trailing commas, no comments (//), no unnecessary quotes, etc. | ||
|
||
Reply in JSON format with the following keys: | ||
{ | ||
"schema": JSON, // the schema of the output data to extract. Use JSON Schema specification style. | ||
} | ||
|
||
The URL of the page you're on right now is `{{ current_url }}`. | ||
|
||
Clickable elements from the page: | ||
``` | ||
{{ elements }} | ||
``` | ||
|
||
Data extraction goal: | ||
``` | ||
{{ data_extraction_goal }} | ||
``` | ||
|
||
Current datetime, ISO format: | ||
``` | ||
{{ local_datetime }} | ||
``` |
26 changes: 26 additions & 0 deletions
26
skyvern/forge/prompts/skyvern/observer_generate_loop_task.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
You're to assist the user to achieve goals on the web, given the DOM elements in the list, the screenshots of the website. Now the user needs to iterate throught a list of values. For each value, the user has the same goal and plan to complete a task. | ||
|
||
MAKE SURE YOU OUTPUT VALID JSON. No text before or after JSON, no trailing commas, no comments (//), no unnecessary quotes, etc. | ||
|
||
Reply in JSON format with the following keys: | ||
{ | ||
"thoughts": str, // Think step by step. What needs to been done for each value in the list. | ||
"task": str, // Describe the task complete for each value in one sentence. Be concise about what you need to do and include all the user data required to complete the task. | ||
} | ||
|
||
The URL of the page you're on right now is `{{ current_url }}`. | ||
|
||
Clickable elements from the page: | ||
``` | ||
{{ elements }} | ||
``` | ||
|
||
User's overall plan right now: | ||
``` | ||
{{ plan }} | ||
``` | ||
|
||
Current datetime, ISO format: | ||
``` | ||
{{ local_datetime }} | ||
``` |
20 changes: 20 additions & 0 deletions
20
skyvern/forge/prompts/skyvern/observer_generate_metadata.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
You're to assist the user to achieve the user goal in the browser. Given the user input, what is the url to type into the browser? Also come up with a proper title for this goal to achieve. | ||
|
||
MAKE SURE YOU OUTPUT VALID JSON. No text before or after JSON, no trailing commas, no comments (//), no unnecessary quotes, etc. | ||
|
||
Reply in JSON format with the following keys: | ||
{ | ||
"thoughts": str, // Think step by step. If the user specifically mentioned which website it is to use, let's use that url. If the user doesn't specifify a specific website, to achieve what the user wants to do, what is most likely website url for achieving the goal? | ||
"url": str, // The url to type into the browser. DO NOT change the url if user specified one. | ||
"title": str, // A descriptive and informative title for the goal. Use no more than 5 words | ||
} | ||
|
||
User goal: | ||
``` | ||
{{ user_goal }} | ||
```{% if user_url %} | ||
|
||
Starting url provided by user: | ||
``` | ||
{{ user_url }} | ||
```{% endif %} |
26 changes: 26 additions & 0 deletions
26
skyvern/forge/prompts/skyvern/observer_generate_task_block.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
You're to assist the user to achieve the user goal in the web, given the DOM elements in the list, the screenshots of the website and the user plan. Help user generate the navigation goal and data extraction goal if any. | ||
|
||
User is planning to {% if is_link %}go to a list of links{% else %}go through a list of values{% endif %} and and take the same task with each {% if is_link %}link{% else %}value{% endif %} in the list. Here's the specific plan: | ||
``` | ||
{{ plan }} | ||
``` | ||
|
||
{% if is_link %}Links{% else %}Values{% endif %} the user will go through: | ||
``` | ||
{{ loop_values }} | ||
``` | ||
|
||
MAKE SURE YOU OUTPUT VALID JSON. No text before or after JSON, no trailing commas, no comments (//), no unnecessary quotes, etc. | ||
|
||
Reply in JSON format with the following keys: | ||
{ | ||
"thoughts": str, // Think step by step. What would the use do to achieve the goal. | ||
"navigation_goal": str, // What kind things the user needs to do in the web achieve the plan and finally get the data to extract. Include all the data needed to complete the goal here.{% if is_link %} The user already has the link to go to the target page first, in order to start executing the plan. So state the navigation goal from the perspective of already being on the target page. What does the user need to do from there?{% endif %} | ||
"data_extraction_goal": str, // If the user needs to extract/retrieve data from the site after navigation goal is achieved, define that extraction goal here. null if no data needs to be extracted. | ||
"data_schema": json, // the schema of the output data. use JSON schema specification style. All fields should be optional as we optimize to extract as much data as possible | ||
} | ||
|
||
Current datetime, ISO format: | ||
``` | ||
{{ local_datetime }} | ||
``` |
6 changes: 6 additions & 0 deletions
6
skyvern/forge/prompts/skyvern/observer_loop_task_extraction_goal.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
The user is trying to achieve a goal the web. Now they've decided to go through a list of values and take the same tasks with each variant in the list. | ||
|
||
Help to user extract this list of values based on what they want to achieve: | ||
``` | ||
{{ plan }} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.