# maybe we can use the guidance format
# DengSHIHAN write this prompt for test.
actions_making_prompt = '''
You are a large language model agent stored on a mobile phone, You need to give the current one-step action that needs to be taken to complete the task.
Below I will provide you with a task, a plan, the environment of the current mobile phone interface(UI information), action history.
You need to select the most suitable one element and give the corresponding one action based on the UI information.
You need to first judge based on the UI information and action history whether the planned action has been completed.
Your selection should also consider action history, and have the courage to try new buttons instead of the same buttons from history.
Action can only be the following three functions:
1.click(element) # click a element, only when clickable="true", the element can be clicked.
2.input(element, text) # When you decide to enter, you first need to select the unit by clicking
3.scroll[x_start,y_start][x_end,y_end] # scroll the screen from [x_start,y_start] to [x_end,y_end].
3.1 The four parameters you fill in cannot be directly the same as x_min, y_min, x_max, y_max. x cannot exceed (x_min, x_max), and y can exceed (y_min, y_max).
3.2 When you have not opened the target APP, you can scroll left and right to find the APP; when you have opened the APP, you can scroll up and down to browse the in-app information.
------Below is examples:
{actions_making_example}
------examples ended
REMEMBER:
1.Click and input have higher priority than scrolling. Scrolling is only considered when all elements of the current interface are indeed irrelevant to the task.
2.When you fail to try repeatedly in one interface, maybe you can try to turn back to select other options.
3.When you need to switch apps, you need to return to the HOME page first.
4.When you find that the current page does not have the APP you want, you need to scroll left and right to find more APPs.
Let's Begin!
[Task description]: {task_description}
[Planning]: {planning}
[UI information]: {ui_information}
[Actions history]: {memory}
[Answer]: The only action that should be taken below is:
'''
'''
The content filled in by element belongs to the current mobile phone interface(UI information).
Scrolling can only be performed within the bounds=[x_min, y_min][x_max, y_max] of the element of scrollable="true".
Usually, you can try scrolling the screen horizontally, such as: [x_min+(x_max-x_min)/5,(y_min+y_max)/2][x_max-(x_max-x_min)/5,(y_min + y_max)/2], [x_max-(x_max-x_min)/5,(y_min + y_max)/2][x_min+(x_max-x_min)/5,(y_min + y_max)/2].
or sliding the screen vertically, such as:[(x_min+x_max)/2,y_max-(y_max-y_min)/5][(x_min+x_max)/2,y_min+(y_max-y_min)/5], [(x_min+x_max)/2,y_min+(y_max-y_min)/5][(x_min+x_max)/2,y_max-(y_max-y_min)/5].
'''
actions_making_example = '''
Example 1:
[Task description]: Calculate 9.5×5+2
[Planning]: Open a computing-related application and click the buttons one by one.
[UI information]:
计算
换算
= 47.5
7
4
1
8
5
2
0
9
6
3
.
[Actions history]:
adb shell am start -n com.cleveni.app.calculator/com.cleveni.app.calculator.MainActivity
click(
9,
)
click(
.
)
click(
5,
)
click( )
[Answer]: The only action that should be taken below is: click(click(
5,
))
Example 2:
[Task description]: Write a note for me, title: Sunday, content: Complete the work and finish the file
[Planning]: Open the calendar, create a new event, fill in the title: Sunday, fill in the content: Complete the work and finish the file.
[UI information]:
小米笔记
标题
11月11日 上午11:23
0字
开始书写或
mind_map
创建思维笔记
[Actions history]:
click( )
click( )
click( 标题 )
[Answer]: The only action that should be taken below is: input( 标题 , Sunday)
Example 3:
[Task description]: Help me set an Write a memorandum for me on November 23, title: work, content: Complete the work and finish the file.
[Planning]: Open the calendar, create a new event, fill in the title: work, fill in the content: Complete the work and finish the file.
Mon, Nov 20
Phone
Messages
Play Store
Chrome
Camera
[Actions history]: None
[Answer]: The only action that should be taken below is: scroll([540, 1486], [540, 371])
'''
'''
Example 3:
[Task description]: Help me set an alarm clock for five o'clock.
[Planning]: Turn on the clock, set an alarm, and adjust the time to five o'clock.
[UI information]:
, Complete the work and finish the file)
'''
html_ui_understanding = '''
You are a large language model agent stored on a mobile phone, below I will provide you with an environment of the current mobile phone interface.
Please tell me the information contained in this html interface.
'''
html_ui_examples = '''
You are a large language model agent stored on a mobile phone, below I will provide you with an environment of the current mobile phone interface.
Please tell me the information contained in this html interface.
Answer: There is a picture that says "Clear" and two buttons representing 4 and 7.
'''
# -------------------------------------------------------------------------------------------------------
app_selection_prompt = '''
You are a large language model agent stored on a mobile phone, below I will provide you with a task, the environment of the current mobile phone interface(Apps information).
Please help me choose the correct app to perform the task based on the Apps information.
On this basis, you should make a simple plan for completing the task.
[Apps information]:
{apps_information}
----Below are some examples:
{app_selection_example}
----examples ended
[Task description]: {task_description}
[Answer]:
'''
app_selection_example = '''
Example 1:
[Task description]: Read the latest message.
[Answer]: I should open Messages before I can view recent text messages, then using this one application should be enough.
Example 2:
[Task description]: Calculate 7*2.2/4+1
[Answer]: I should open ClevCalc because this is an application directly related to the calculator and since the task only involves calculations, then using this one application should be enough.
Example 3:
[Task description]: I want to go to Wuhan next week. Please help me determine the specific travel time and method. The information you collect can be saved on my phone for easy review by me.
[Answer]: To determine the time and mode of travel, I should at least check the air tickets or train tickets and hotel conditions on Traveloka, and check the weather conditions for the next few days on Weather. Because the collected information needs to be stored on the mobile phone, I will take screenshots of the necessary air and train ticket information and write the most recommended solution in a memo.
'''
# Base passrate
# -------------------------------------------------------------------------------------------------------
Task_finish_prompt = '''
You are a large language model agent stored on a mobile phone, below I will provide you with a task,
the environment of the current mobile phone interface(UI information), historical action information.
You need to judge whether the current task has been completed based on the current environment and action history.
----Below are the examples:
{task_finish_example}
----examples ended
[Task description]: {task_description}
[UI information]: {ui_information}
[Actions history]: {memory}
[Question]: Is the task completed?
[Answer]:
'''
Task_finish_example = '''
Example 1:
[Task description]: Calculate 9×5+2
[UI information]:
计算,
换算,
= 47,
7,
4,
1,
8,
5,
2,
0,
9,
6,
3,
.,
[Actions history]:
Action: click(
9,
)
Action: click( )
Action: click(
5,
)
Action: click( )
Action: click(
2,
)
Action: click( )
[Question]: Is the task completed?
[Answer]: Yes, the task is completed.
Example 2:
[Task description]: Calculate 9×5+2
[UI information]:
计算,
换算,
= 47,
7,
4,
1,
8,
5,
2,
0,
9,
6,
3,
.,
[Actions history]:
Action: click(
9,
)
Action: click( )
Action: click(
5,
)
[Question]: Is the task completed?
Answer: No, the task is not completed.
'''
# -------------------------------------------------------------------------------------------------------
Thought_prompt = '''
You are a large language model agent stored on a mobile phone, below I will provide you with a task, a plan,
the environment of the current mobile phone interface before action (Previous UI information), action history, the environment of the current mobile phone interface(Now UI information).
Action history records completed operations, including click, input, scroll and api_call.
You need to summarize these four aspects: changes in the UI page, task progress, actions that have been completed, one next action based on UI information and action history.
[Action History] are all previous historical actions, and [current action] is the current action that causes the UI page to change.
[task progress] Where in the plan is the current page?
[One next action] You need to choose one among click, input, scroll and one api as the next action, and give one and only one operation object.
[One next action] Strictly refer to [current action] and [action history] result to do the next action.
------Below are examples:
{thought_example}
------examples ended
Let's Begin!
[Task description]: {task_description}
[Planning]: {planning}
[Previous UI information]: {ui_information}
[Now UI information]: {now_ui_information}
[Action History]: {action_history}
[Current Action]:{action}
[Answer]:
'''
Thought_example = '''
Example 1:
[Task description]: I'm going to travel from chengdu to Beijing next week. Please help me determine the flight and specific time.
[Planning]: Open the travel APP, check flight from chengdu to beijing, sort by price, take a screenshot, then open Google search, search and check the weather conditions in Beijing next week.
[Previous UI information]:
Flights
One-way / Round-trip
Multi-city
From
Chengdu (CTUA)
To
Beijing (BEIA)
Departure Date
Wednesday, 29 Nov 2023
Round-trip?
Return Date
Saturday, 2 Dec 2023
Passengers
1 passenger
Seat Class
Economy
Your Recent Searches
Search
Discover
[Now UI information]:
Chengdu (CTUA) Beijing (BEIA)
Wed, 29 Nov • 1 pax • Economy
Mon, 27 Nov
See Price
Tue, 28 Nov
See Price
Wed, 29 Nov
USD 81.49
Thu, 30 Nov
See Price
Fri, 1 Dec
See Price
Smart Combo
China Eastern Airlines
20:30
2h 45m
USD 81.49
USD 84.05/pax
23:15
CTU
Direct
/pax
PKX
Smart Combo
China Eastern Airlines
07:20
2h 40m
USD 102.53
USD 104.47/pax
10:00
CTU
Direct
/pax
PKX
Smart Combo
Be the first to know when prices drop!
Create a price alert and we’ll let you know as soon as prices have dropped significantly.
Create Price Alert
China Eastern Airlines
2h 25m
USD 118.11/pax
Stops
Airlines
Time
Cheapest
Filter
[Action History]:
{'[Action]': 'click(
Traveloka
)'}
{'[Action]': 'click(
Flights
)'}
{'[Action]': 'click( Thursday, 23 Nov 2023 )'}
{'[Action]': 'click(
)'}
{'[Action]': 'click(
)'}
{'[Action]': 'click()'}
[Current Action]: {'[Action]': 'click()'}
[Answer]:
Changes: I clicked "Search" button. The page changes from the flight search page to the flight search results page. The page contains two flight information from Chengdu to Beijing.
Actions Complete: I have opened traveloka app, clicked "flight" button, filled the form and clicked the "search" button.
Task progress: The current mission progress is check flight from chengdu to beijing.
One next action: Click on the cheapest flight to see more detailed information.
Example 2:
[Task description]: I'm going to travel from chengdu to Beijing next week. Please help me determine the flight and specific time.
[Planning]: Open the travel APP, check flight from chengdu to beijing, sort by price, take a screenshot, then open Google search, search and check the weather conditions in Beijing next week.
[Previous UI information]:
Flights
One-way / Round-trip
Multi-city
From
Chengdu (CTUA)
To
Beijing (BEIA)
Departure Date
Saturday, 2 Dec 2023
Round-trip?
Return Date
Saturday, 2 Dec 2023
Passengers
1 passenger
Seat Class
Economy
Your Recent Searches
Search
Discover
[Now UI information]:
Flights
One-way / Round-trip
Multi-city
From
Chengdu (CTUA)
To
Beijing (BEIA)
Departure Date
Saturday, 2 Dec 2023
Round-trip?
Return Date
Saturday, 2 Dec 2023
Passengers
1 passenger
Seat Class
Economy
Your Recent Searches
Search
Discover
[Action History]:
{'[Action]': 'click(
Traveloka
)'}
{'[Action]': 'click(
Flights
)'}
{'[Fail]: InvalidElementStateException action': 'input( Chengdu (CTUA) , Chengdu (CTUA))'}
[Current action]:{'[Action]': 'input( Chengdu (CTUA) , Chengdu (CTUA))'}
[Answer]:
Changes: The current page is the flight search form page in the Traveloka app. And There is no change between two pages.
Task progress: From the current action and action history, I am currently on the flight search form page, ready to search for flights from Chengdu to Beijing.
Actions completed: From the current action and action history, I have opened the traveloka app and clicked the flight button to search for flights
One next action: Because the operation of inputting information in Chengdu (CTUA) failed, I will try other operations, such as clicking Chengdu (CTUA) first. The one next action I will do is click "Chengdu (CTUA)" button to select departure city.
'''
'''
Example 3:
Task description: Help me set an alarm clock for five o'clock.
Planning: Open the clock, create a new alarm clock, and set the time to five o'clock.
Previous UI information:
)
[Answer]: I need to set the hour to five. In the last step, I tried to click on the eleven hours, but it seems that the element can't be click, now I will try to scroll the element to set the hour to five.
'''
passrate_prompt = '''
You are a large language model agent stored on a mobile phone, below I will provide you with a task, a system logcat.
You need to judge whether the task is completed based on the system logcat.
Task: {task}
Logcat: {logcat}
Ans:
'''