update prompt

This commit is contained in:
heroding77
2023-12-24 16:18:32 +08:00
parent f59b64d647
commit b8355bd364
2 changed files with 161 additions and 48 deletions

View File

@@ -156,8 +156,8 @@ class PlanningModule(BaseAgent):
# Send decompse task prompt to LLM and get task list
def task_decompose_format_message(self, task, action_list, files_and_folders):
tool_list = get_open_api_description_pair()
sys_prompt = self.prompt['_LINUX_SYSTEM_TASK_DECOMPOSE_PROMPT']
user_prompt = self.prompt['_LINUX_USER_TASK_DECOMPOSE_PROMPT'].format(
sys_prompt = self.prompt['_SYSTEM_TASK_DECOMPOSE_PROMPT']
user_prompt = self.prompt['_USER_TASK_DECOMPOSE_PROMPT'].format(
system_version=self.system_version,
task=task,
action_list = action_list,
@@ -173,11 +173,11 @@ class PlanningModule(BaseAgent):
# Send replan task prompt to LLM and get task list
def task_replan_format_message(self, reasoning, current_task, current_task_description, action_list, files_and_folders):
sys_prompt = self.prompt['_LINUX_SYSTEM_TASK_REPLAN_PROMPT'].format(
sys_prompt = self.prompt['_SYSTEM_TASK_REPLAN_PROMPT'].format(
current_task = current_task,
current_task_description = current_task_description
)
user_prompt = self.prompt['_LINUX_USER_TASK_REPLAN_PROMPT'].format(
user_prompt = self.prompt['_USER_TASK_REPLAN_PROMPT'].format(
system_version=self.system_version,
reasoing = reasoning,
action_list = action_list,
@@ -329,8 +329,8 @@ class RetrievalModule(BaseAgent):
return action_description_pair
def action_code_filter_format_message(self, action_code_pair, task_description):
sys_prompt = self.prompt['_LINUX_SYSTEM_ACTION_CODE_FILTER_PROMPT']
user_prompt = self.prompt['_LINUX_USER_ACTION_CODE_FILTER_PROMPT'].format(
sys_prompt = self.prompt['_SYSTEM_ACTION_CODE_FILTER_PROMPT']
user_prompt = self.prompt['_USER_ACTION_CODE_FILTER_PROMPT'].format(
task_description=task_description,
action_code_pair=action_code_pair
)
@@ -349,7 +349,7 @@ class ExecutionModule(BaseAgent):
super().__init__()
# 模型,环境,数据库
self.llm = llm
self.tool = ToolAgent(config_path=self.con)
self.tool = ToolAgent()
self.environment = environment
self.action_lib = action_lib
self.system_version = system_version
@@ -415,8 +415,8 @@ class ExecutionModule(BaseAgent):
# Send skill create message to LLM
def skill_create_format_message(self, task_name, task_description):
sys_prompt = self.prompt['_LINUX_SYSTEM_SKILL_CREATE_PROMPT']
user_prompt = self.prompt['_LINUX_USER_SKILL_CREATE_PROMPT'].format(
sys_prompt = self.prompt['_SYSTEM_SKILL_CREATE_PROMPT']
user_prompt = self.prompt['_USER_SKILL_CREATE_PROMPT'].format(
system_version=self.system_version,
task_description=task_description,
working_dir= self.environment.working_dir,
@@ -431,8 +431,8 @@ class ExecutionModule(BaseAgent):
# Send invoke generate message to LLM
def invoke_generate_format_message(self, class_code, task_description, pre_tasks_info):
class_name, args_description = self.extract_class_name_and_args_description(class_code)
sys_prompt = self.prompt['_LINUX_SYSTEM_INVOKE_GENERATE_PROMPT']
user_prompt = self.prompt['_LINUX_USER_INVOKE_GENERATE_PROMPT'].format(
sys_prompt = self.prompt['_SYSTEM_INVOKE_GENERATE_PROMPT']
user_prompt = self.prompt['_USER_INVOKE_GENERATE_PROMPT'].format(
class_name = class_name,
task_description = task_description,
args_description = args_description,
@@ -447,8 +447,8 @@ class ExecutionModule(BaseAgent):
# Send skill amend message to LLM
def skill_amend_format_message(self, original_code, task, error, code_output, current_working_dir, files_and_folders, critique):
sys_prompt = self.prompt['_LINUX_SYSTEM_SKILL_AMEND_PROMPT']
user_prompt = self.prompt['_LINUX_USER_SKILL_AMEND_PROMPT'].format(
sys_prompt = self.prompt['_SYSTEM_SKILL_AMEND_PROMPT']
user_prompt = self.prompt['_USER_SKILL_AMEND_PROMPT'].format(
original_code = original_code,
task = task,
error = error,
@@ -466,8 +466,8 @@ class ExecutionModule(BaseAgent):
# Send task judge prompt to LLM and get JSON response
def task_judge_format_message(self, current_code, task, code_output, current_working_dir, files_and_folders):
sys_prompt = self.prompt['_LINUX_SYSTEM_TASK_JUDGE_PROMPT']
user_prompt = self.prompt['_LINUX_USER_TASK_JUDGE_PROMPT'].format(
sys_prompt = self.prompt['_SYSTEM_TASK_JUDGE_PROMPT']
user_prompt = self.prompt['_USER_TASK_JUDGE_PROMPT'].format(
current_code=current_code,
task=task,
code_output=code_output,
@@ -488,8 +488,8 @@ class ExecutionModule(BaseAgent):
# Send error analysis prompt to LLM and get JSON response
def error_analysis_format_message(self, current_code, task, code_error, current_working_dir, files_and_folders):
sys_prompt = self.prompt['_LINUX_SYSTEM_ERROR_ANALYSIS_PROMPT']
user_prompt = self.prompt['_LINUX_USER_ERROR_ANALYSIS_PROMPT'].format(
sys_prompt = self.prompt['_SYSTEM_ERROR_ANALYSIS_PROMPT']
user_prompt = self.prompt['_USER_ERROR_ANALYSIS_PROMPT'].format(
current_code=current_code,
task=task,
code_error=code_error,
@@ -561,6 +561,49 @@ class ExecutionModule(BaseAgent):
"description": description
}
return info
def generate_call_api_code(self, tool_sub_task,tool_api_path,context="No context provided."):
self.sys_prompt = self.prompt['_SYSTEM_TOOL_USAGE_PROMPT'].format(
openapi_doc = json.dumps(self.generate_openapi_doc(tool_api_path)),
tool_sub_task = tool_sub_task,
context = context
)
self.user_prompt = self.prompt['_USER_TOOL_USAGE_PROMPT']
self.message = [
{"role": "system", "content": self.sys_prompt},
{"role": "user", "content": self.user_prompt},
]
return self.llm.chat(self.message)
def generate_openapi_doc(self, tool_api_path):
# init current api's doc
curr_api_doc = {}
curr_api_doc["openapi"] = self.open_api_doc["openapi"]
curr_api_doc["info"] = self.open_api_doc["info"]
curr_api_doc["paths"] = {}
curr_api_doc["components"] = {"schemas":{}}
api_path_doc = {}
#extract path and schema
if tool_api_path not in self.open_api_doc["paths"]:
curr_api_doc = {"error": "The api is not existed"}
return curr_api_doc
api_path_doc = self.open_api_doc["paths"][tool_api_path]
curr_api_doc["paths"][tool_api_path] = api_path_doc
find_ptr = {}
if "get" in api_path_doc:
findptr = api_path_doc["get"]
elif "post" in api_path_doc:
findptr = api_path_doc["post"]
api_params_schema_ref = ""
if (("requestBody" in findptr) and
("content" in findptr["requestBody"]) and
("application/json" in findptr["requestBody"]["content"]) and
("schema" in findptr["requestBody"]["content"]["application/json"]) and
("$ref" in findptr["requestBody"]["content"]["application/json"]["schema"])):
api_params_schema_ref = findptr["requestBody"]["content"]["application/json"]["schema"]["$ref"]
if api_params_schema_ref != None and api_params_schema_ref != "":
curr_api_doc["components"]["schemas"][api_params_schema_ref.split('/')[-1]] = self.open_api_doc["components"]["schemas"][api_params_schema_ref.split('/')[-1]]
if __name__ == '__main__':

View File

@@ -1,7 +1,50 @@
prompt = {
'execute_prompt' : {
# Invoke generate prompt in linux
'_LINUX_SYSTEM_INVOKE_GENERATE_PROMPT' : '''
# Code generate and invoke prompt in os
'_SYSTEM_GENERATE_AND_INVOKE_PROMPT': '''
You are helpful assistant to assist in writing Python tool code for tasks completed on operating systems. Your expertise lies in creating Python classes that perform specific tasks, adhering to a predefined format and structure.
Your goal is to generate Python tool code in the form of a class. The code should be structured to perform a user-specified task on the current operating system. The class must be easy to use and understand, with clear instructions and comments.
You should only respond with a python code and a invoke statement in XML format in the format as described below:
1. Code Structure: Begin with the necessary import statement: from jarvis.action.base_action import BaseAction. Then, define the class using the class name which is the same as the task name provided by the user.
2. Initialization Code: Initialization Code: In the __init__ method of the class, only "self._description" is initialized. This attribute succinctly summarizes the main function and purpose of the class.
3. Code used to accomplish the Task: Note that you should avoid using bash for the current task if you can, and prioritize using some of python's basic libraries for the current task. If the task involves os bash operations, instruct the use of the subprocess library, particularly the run method, to execute these operations. All core code used to accomplish the task should be encapsulated within the __call__ method of the class.
4. Parameters of __call__ method: The parameter design of __call__ methods should be comprehensive and generic enough to apply to different goals in all the same task scenarios. The parameters of the __call__ method are obtained by parsing and abstracting the task description, and the goals of the specific task can not be hard-coded into the method.
5. Detailed Comments: Provide comprehensive comments throughout the code. This includes describing the purpose of the class, and the function of parameters, especially in the __call__ method.
And the code you write should also follow the following criteria:
1. The class must start with from jarvis.action.base_action import BaseAction.In addition you need to import all the third-party libraries used in your code.
2. The class name should be the same as the user's task name.
3. In the __init__ method, only self._description should be initialized. And self._description must be general enough to encapsulate the functionality of the current class. For example, if the current task is to change the name of the file named test in the folder called document to test1, then the content of this attribute should be written as: Rename the specified file within a designated folder to a new, predetermined filename.
4. The __call__ method must allow flexible arguments (*args, **kwargs) for different user requirements. The __call__ method can not hardcode specific task details, but rather, it should abstract them into parameters that can be passed in by the user, these parameters can be obtained by parsing and abstracting the task description. For example, if the class is meant to download and play music, the __call__ method should take parameters like the download link, destination folder, and file name, instead of having these details fixed in the code. Please ensure that the class is structured to easily accommodate different types of tasks, with a clear and flexible parameter design in the __call__ method. In addition, the parameter design should be comprehensive and versatile enough to be applicable to handling different targets under all the same task scenarios.
5. For tasks involving os bash commands, use the subprocess library to execute these commands within the Python class.
6. The code should include detailed comments explaining the purpose of the class, and the role of each parameter.
7. If a file or folder creation operation is involved, the name of the file or folder should contain only English, numbers and underscores.
8. You need to note that for different system languages, some system paths may have different names, for example, the desktop path in Chinese system languages is ~/桌面 while the desktop path in English system languages is ~/Desktop.
9. If your code involves operating (reading or writing or creating) files or folders under a specified path, be sure to change the current working directory to that specified path before performing file-related operations.
10. If the user does not specifically request it (specify an absolute path), all your file operations should be relative to the user's working directory, and all created files should be stored in that directory and its subdirectories as a matter of priority. And once a file or directory query is involved, the priority is to query from below the default initial working directory.
11. The working directory given by the user can not be hardcoded in your code, because different user can have different working directory at different time.
12. If you need to access the user's working directory, you should make the user's working directory a parameter that can be passed to the __call__ method. If the user provides a value for the working directory as a parameter, then use the path provided by the user as the working directory path. Otherwise, you can obtain it using methods like os.getcwd().
13. You only need to write the class, don't instantiate it and call the __call__ method. If you want to write an example of how to use the class, be sure to put the example in the comments.
14. The description of parameters in the __call__ method must follow a standardized format: Args: [description of input parameters], Returns: [description of the method's return value].
15. In the __call__ method, you need to print the task execution completion message if the task execution completes.
16. Please note that the code you generate is mainly used under the operating system, so it often involves system-level operations such as reading and writing files. You need to write a certain fault-tolerant mechanism to handle potential problems that may arise during these operations, such as Problems such as file non-existence and insufficient permissions.
17. If the __call__ method needs a return value to help perform the next task, for example, if a task needs to return a list or value to facilitate the next task to receive, then let the __call__ method return. Otherwise, there is no need to return
18. If the __call__ method involves file operations, then the file's path must be passed as a parameter to the __call__ method, in particular, if you are operating multiple files, pass the paths of these files as parameters in the form of a list. If it involves moving files, then both the source and destination paths must be provided as parameters to the __call__ method, since the source and destination may not be in the same directory.
19. If the current task requires the use of the return results from a preceding task, then its corresponding call method must include a parameter specifically for receiving the return results of the preceding task.
Now you will be provided with the following information, please write python code to accomplish the task and be compatible with system environments, versions and language according to these information.
''',
'_USER_GENERATE_AND_INVOKE_PROMPT': '''
User's information is as follows:
System Version: {system_version}
System language: simplified chinese
Working Directory: {working_dir}
Task Name: {task_name}
Task Description: {task_description}
Information of Prerequisite Tasks: {pre_tasks_info}
Relevant Code: {relevant_code}
''',
# Invoke generate prompt in os
'_SYSTEM_INVOKE_GENERATE_PROMPT' : '''
You are an AI trained to assist with Python programming tasks, with a focus on class and method usage.
Your goal is to generate a Python __call__ method invocation statement based on provided class name, task descriptions, and method parameter details.
You should only respond with the python code in the format as described below:
@@ -23,7 +66,7 @@ prompt = {
8. The code comments include an example of a class invocation. You can refer to this example, but you should not directly copy it. Instead, you need to adapt and fill in the details of this invocation according to the current task and the information returned from previous tasks.
Now you will be provided with the following information, please generate your response according to these information:
''',
'_LINUX_USER_INVOKE_GENERATE_PROMPT' : '''
'_USER_INVOKE_GENERATE_PROMPT' : '''
User's information are as follows:
Class Name: {class_name}
Task Description: {task_description}
@@ -32,8 +75,8 @@ prompt = {
Working Directory: {working_dir}
''',
# Skill amend prompt in linux
'_LINUX_SYSTEM_SKILL_AMEND_PROMPT' : '''
# Skill amend prompt in os
'_SYSTEM_SKILL_AMEND_PROMPT' : '''
You are an AI expert in Python programming, with a focus on diagnosing and resolving code issues.
Your goal is to precisely identify the reasons for failure in the existing Python code and implement effective modifications to ensure it accomplishes the intended task without errors.
You should only respond with the python code in the format as described below:
@@ -53,7 +96,7 @@ prompt = {
10. In User's information, 'Working Directory' represents the root directory of the working directory, and 'Current Working Directory' represents the directory where the current task is located.
Now you will be provided with the following information, please give your modified python code according to these information:
''',
'_LINUX_USER_SKILL_AMEND_PROMPT' : '''
'_USER_SKILL_AMEND_PROMPT' : '''
User's information are as follows:
Original Code: {original_code}
Task: {task}
@@ -65,14 +108,14 @@ prompt = {
Critique On The Code: {critique}
''',
# Skill create prompt in linux
'_LINUX_SYSTEM_SKILL_CREATE_PROMPT' : '''
You are helpful assistant to assist in writing Python tool code for tasks completed on Linux operating systems. Your expertise lies in creating Python classes that perform specific tasks, adhering to a predefined format and structure.
Your goal is to generate Python tool code in the form of a class. The code should be structured to perform a user-specified task on a Linux operating system. The class must be easy to use and understand, with clear instructions and comments.
# Skill create prompt in os
'_SYSTEM_SKILL_CREATE_PROMPT' : '''
You are helpful assistant to assist in writing Python tool code for tasks completed on operating systems. Your expertise lies in creating Python classes that perform specific tasks, adhering to a predefined format and structure.
Your goal is to generate Python tool code in the form of a class. The code should be structured to perform a user-specified task on the current operating system. The class must be easy to use and understand, with clear instructions and comments.
You should only respond with the python code in the format as described below:
1. Code Structure: Begin with the necessary import statement: from jarvis.action.base_action import BaseAction. Then, define the class using the class name which is the same as the task name provided by the user.
2. Initialization Code: Initialization Code: In the __init__ method of the class, only "self._description" is initialized. This attribute succinctly summarizes the main function and purpose of the class.
3. Code used to accomplish the Task: Note that you should avoid using bash for the current task if you can, and prioritize using some of python's basic libraries for the current task. If the task involves Linux bash operations, instruct the use of the subprocess library, particularly the run method, to execute these operations. All core code used to accomplish the task should be encapsulated within the __call__ method of the class.
3. Code used to accomplish the Task: Note that you should avoid using bash for the current task if you can, and prioritize using some of python's basic libraries for the current task. If the task involves os bash operations, instruct the use of the subprocess library, particularly the run method, to execute these operations. All core code used to accomplish the task should be encapsulated within the __call__ method of the class.
4. Parameters of __call__ method: The parameter design of __call__ methods should be comprehensive and generic enough to apply to different goals in all the same task scenarios. The parameters of the __call__ method are obtained by parsing and abstracting the task description, and the goals of the specific task can not be hard-coded into the method.
5. Detailed Comments: Provide comprehensive comments throughout the code. This includes describing the purpose of the class, and the function of parameters, especially in the __call__ method.
And the code you write should also follow the following criteria:
@@ -80,7 +123,7 @@ prompt = {
2. The class name should be the same as the user's task name.
3. In the __init__ method, only self._description should be initialized. And self._description must be general enough to encapsulate the functionality of the current class. For example, if the current task is to change the name of the file named test in the folder called document to test1, then the content of this attribute should be written as: Rename the specified file within a designated folder to a new, predetermined filename.
4. The __call__ method must allow flexible arguments (*args, **kwargs) for different user requirements. The __call__ method can not hardcode specific task details, but rather, it should abstract them into parameters that can be passed in by the user, these parameters can be obtained by parsing and abstracting the task description. For example, if the class is meant to download and play music, the __call__ method should take parameters like the download link, destination folder, and file name, instead of having these details fixed in the code. Please ensure that the class is structured to easily accommodate different types of tasks, with a clear and flexible parameter design in the __call__ method. In addition, the parameter design should be comprehensive and versatile enough to be applicable to handling different targets under all the same task scenarios.
5. For tasks involving Linux bash commands, use the subprocess library to execute these commands within the Python class.
5. For tasks involving os bash commands, use the subprocess library to execute these commands within the Python class.
6. The code should include detailed comments explaining the purpose of the class, and the role of each parameter.
7. If a file or folder creation operation is involved, the name of the file or folder should contain only English, numbers and underscores.
8. You need to note that for different system languages, some system paths may have different names, for example, the desktop path in Chinese system languages is ~/桌面 while the desktop path in English system languages is ~/Desktop.
@@ -91,14 +134,13 @@ prompt = {
13. You only need to write the class, don't instantiate it and call the __call__ method. If you want to write an example of how to use the class, be sure to put the example in the comments.
14. The description of parameters in the __call__ method must follow a standardized format: Args: [description of input parameters], Returns: [description of the method's return value].
15. In the __call__ method, you need to print the task execution completion message if the task execution completes.
16. Please note that the code you generate is mainly used under the Linux operating system, so it often involves system-level operations such as reading and writing files. You need to write a certain fault-tolerant mechanism to handle potential problems that may arise during these operations, such as Problems such as file non-existence and insufficient permissions.
16. Please note that the code you generate is mainly used under the operating system, so it often involves system-level operations such as reading and writing files. You need to write a certain fault-tolerant mechanism to handle potential problems that may arise during these operations, such as Problems such as file non-existence and insufficient permissions.
17. If the __call__ method needs a return value to help perform the next task, for example, if a task needs to return a list or value to facilitate the next task to receive, then let the __call__ method return. Otherwise, there is no need to return
18. If the __call__ method involves file operations, then the file's path must be passed as a parameter to the __call__ method, in particular, if you are operating multiple files, pass the paths of these files as parameters in the form of a list. If it involves moving files, then both the source and destination paths must be provided as parameters to the __call__ method, since the source and destination may not be in the same directory.
19. If the current task requires the use of the return results from a preceding task, then its corresponding call method must include a parameter specifically for receiving the return results of the preceding task.
20.
Now you will be provided with the following information, please write python code to accomplish the task and be compatible with system environments, versions and language according to these information.
''',
'_LINUX_USER_SKILL_CREATE_PROMPT' : '''
'_USER_SKILL_CREATE_PROMPT' : '''
User's information is as follows:
System Version: {system_version}
System language: simplified chinese
@@ -107,8 +149,8 @@ prompt = {
Task Description: {task_description}
''',
# Task judge prompt in linux
'_LINUX_SYSTEM_TASK_JUDGE_PROMPT' : '''
# Task judge prompt in os
'_SYSTEM_TASK_JUDGE_PROMPT' : '''
You are an AI program expert to verify Python code against a user's task requirements.
Your goal is to determine if the provided Python code accomplishes the user's specified task based on the feedback information, And score the code based on the degree of generalizability of the code.
You should only respond with the JSON result in the format as described below:
@@ -131,7 +173,7 @@ prompt = {
9. If the task is not completed, it may be because the code generation and calling did not consider the information returned by the predecessor task. This information may be used as input parameters of the __call__ method.
Now you will be provided with the following information, please give the result JSON according to these information:
''',
'_LINUX_USER_TASK_JUDGE_PROMPT' : '''
'_USER_TASK_JUDGE_PROMPT' : '''
User's information are as follows:
Current Code: {current_code}
Task: {task}
@@ -141,8 +183,8 @@ prompt = {
Files And Folders in Current Working Directiory: {files_and_folders}
''',
# Code error judge prompt in linux
'_LINUX_SYSTEM_ERROR_ANALYSIS_PROMPT' : '''
# Code error judge prompt in os
'_SYSTEM_ERROR_ANALYSIS_PROMPT' : '''
You are an expert in analyzing Python code errors, you are able to make an accurate analysis of different types of errors, and your return results adhere to a predefined format and structure.
Your goal is to analyze the errors that occur in the execution of the code provided to you, and determine whether the type of error is one that requires external additions (e.g., missing dependency packages, environment configuration issues, version incompatibility, etc.) or one that only requires internal changes to the code (e.g., syntax errors, logic errors, data type errors).
You should only respond with the JSON result in the format as described below:
@@ -159,7 +201,7 @@ prompt = {
6. The value of type can only be 'replan' or 'amend'.
7. In User's information, 'Working Directory' represents the root directory of the working directory, and 'Current Working Directory' represents the directory where the current task is located.
''',
'_LINUX_USER_ERROR_ANALYSIS_PROMPT' : '''
'_USER_ERROR_ANALYSIS_PROMPT' : '''
User's information are as follows:
Current Code: {current_code}
Task: {task}
@@ -167,14 +209,42 @@ prompt = {
Current Working Directiory: {current_working_dir}
Working Directiory: {working_dir}
Files And Folders in Current Working Directiory: {files_and_folders}
'''
''',
# Tool usage prompt in os
'_SYSTEM_TOOL_USAGE_PROMPT' : '''
You are a useful AI assistant capable of accessing APIs to complete user-specified tasks, according to API documentation,
by using the provided ToolRequestUtil tool. The API documentation is as follows:
{openapi_doc}
The user-specified task is as follows:
{tool_sub_task}
The context which can further help you to determine the params of the API is as follows:
{context}
You need to complete the code using the ToolRequestUtil tool to call the specified API and print the return value
of the api.
ToolRequestUtil is a utility class, and the parameters of its 'request' method are described as follows:
def request(self, api_path, method, params=None, content_type=None):
"""
:param api_path: the path of the API
:param method: get/post
:param params: the parameters of the API, can be None
:param content_type: the content type of the API, e.g., application/json, can be None
:return: the response from the API
"""
Please begin your code completion:
''',
'_USER_TOOL_USAGE_PROMPT' : '''
from jarvis.core.tool_request_util import ToolRequestUtil
tool_request_util = ToolRequestUtil()
# TODO: your code here
'''
''
},
'planning_prompt' : {
# Task decompose prompt in linux
'_LINUX_SYSTEM_TASK_DECOMPOSE_PROMPT' : '''
# Task decompose prompt in os
'_SYSTEM_TASK_DECOMPOSE_PROMPT' : '''
You are an expert in making plans.
I will give you a task and ask you to decompose this task into a series of subtasks. These subtasks can form a directed acyclic graph, and each subtask is an atomic operation. Through the execution of topological sorting of subtasks, I can complete the entire task.
You should only respond with a reasoning process and a JSON result in the format as described below:
@@ -214,7 +284,7 @@ prompt = {
14. When decomposing subtasks, you need to pay attention to whether the current subtask involves obtaining data from external data sources (such as the Internet), such as finding cat pictures on the Internet, retrieving information on a certain web page, etc., then you need to select the relevant tool from the Tool List.
15. If the current subtask is a tool task, the task description should include the name of the specific tool.
''',
'_LINUX_USER_TASK_DECOMPOSE_PROMPT' : '''
'_USER_TASK_DECOMPOSE_PROMPT' : '''
User's information are as follows:
System Version: {system_version}
Task: {task}
@@ -224,8 +294,8 @@ prompt = {
Files And Folders in Current Working Directiory: {files_and_folders}
''',
# Task replan prompt in linux
'_LINUX_SYSTEM_TASK_REPLAN_PROMPT' : '''
# Task replan prompt in os
'_SYSTEM_TASK_REPLAN_PROMPT' : '''
You are an expert at designing new tasks based on the results of your reasoning.
When I was executing the task {current_task}: {current_task_description}, an issue occurred that is not related to the code. The user information includes a reasoning process addressing this issue. Based on the results of this reasoning, please design a new task to resolve the problem.
You should only respond with a reasoning process and a JSON result in the format as described below:
@@ -251,7 +321,7 @@ prompt = {
7. The tasks currently designed are compatible with and can be executed on the present version of the system.
8. Please note that the name of a task must be abstract. For instance, if the task is to search for the word "agent," then the task name should be "search_word," not "search_agent." As another example, if the task involves moving a file named "test," then the task name should be "move_file," not "move_test.
''',
'_LINUX_USER_TASK_REPLAN_PROMPT' : '''
'_USER_TASK_REPLAN_PROMPT' : '''
User's information are as follows:
System Version: {system_version}
reasoning: {reasoning}
@@ -263,7 +333,7 @@ prompt = {
'retrieve_prompt' : {
# action code filter prompt
'_LINUX_SYSTEM_ACTION_CODE_FILTER_PROMPT' : '''
'_SYSTEM_ACTION_CODE_FILTER_PROMPT' : '''
You are an expert in analyzing python code.
I will assign you a task and provide a dictionary of action names along with their corresponding codes. Based on the current task, please analyze the dictionary to determine if there is any action whose code can be used to complete the task. If such a code exists, return the action name that corresponds to the code you believe is best suited for completing the task. If no appropriate code exists, return an empty string.
You should only respond with the format as described below:
@@ -274,7 +344,7 @@ prompt = {
1. There may be multiple codes that meet the needs of completing the task, but I only need you to return the action name corresponding to the most appropriate code.
2. If no code can complete the task, be sure to return an empty string, rather than a name of an action corresponding to a code that is nearly but not exactly suitable.
''',
'_LINUX_USER_ACTION_CODE_FILTER_PROMPT' : '''
'_USER_ACTION_CODE_FILTER_PROMPT' : '''
User's information are as follows:
Action Code Pair: {action_code_pair}
Task: {task_description}