Skip to content

Commit

Permalink
Grammar/Spelling fixes (#46)
Browse files Browse the repository at this point in the history
* Update prompts.py

* Update vision_agent_prompts.py

* Update reflexion_prompts.py

* Update vision_agent_prompts.py

* Update easytool_prompts.py

* Update prompts.py

* Update vision_agent_prompts.py
  • Loading branch information
cmaloney111 authored Apr 10, 2024
1 parent b7a20cd commit b762572
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 38 deletions.
28 changes: 14 additions & 14 deletions vision_agent/agent/easytool_prompts.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
TASK_DECOMPOSE = """You need to decompose a complex user's question into some simple subtasks and let the model execute it step by step.
TASK_DECOMPOSE = """You need to decompose a user's complex question into some simple subtasks and let the model execute it step by step.
This is the user's question: {question}
This is tool list:
This is the tool list:
{tools}
Please note that:
1. You should only decompose this complex user's question into some simple subtasks which can be executed easily by using one single tool in the tool list.
2. If one subtask need the results from other subtask, you can should write clearly. For example:
2. If one subtask needs the results from another subtask, you should write clearly. For example:
{{"Tasks": ["Convert 23 km/h to X km/min by 'divide_'", "Multiply X km/min by 45 min to get Y by 'multiply_'"]}}
3. You must ONLY output in a parsible JSON format. An example output looks like:
{{"Tasks": ["Task 1", "Task 2", ...]}}
Output: """

TASK_TOPOLOGY = """Given a complex user's question, I have decompose this question into some simple subtasks. I think there exists a logical connections and order amontg the tasks. Thus you need to help me output this logical connections and order.
TASK_TOPOLOGY = """Given a user's complex question, I have decomposed this question into some simple subtasks. I think there exist logical connections and order among the tasks. Thus, you need to help me output these logical connections and order.
You must ONLY output in a parsible JSON format with the following format:
{{"Tasks": [{{"task": task, "id", task_id, "dep": [dependency_task_id1, dependency_task_id2, ...]}}]}}
The "dep" field denotes the id of the previous task which generates a new resource upon which the current task depends. If there are no dependencies, set "dep" to -1.
This is user's question: {question}
This is the user's question: {question}
These are subtasks of this question:
Expand All @@ -34,30 +34,30 @@
{tools}
Please note that:
1. You should only chooce one tool the Tool List to solve this question.
1. You should only choose one tool from the Tool List to solve this question.
2. You must ONLY output the ID of the tool you chose in a parsible JSON format. Two example outputs look like:
Example 1: {{"ID": 1}}
Example 2: {{"ID": 2}}
Output: """

CHOOSE_PARAMETER = """Given a user's question and a API tool documentation, you need to output parameters according to the API tool documentation to successfully call the API to solve the user's question.
CHOOSE_PARAMETER = """Given a user's question and an API tool documentation, you need to output parameters according to the API tool documentation to successfully call the API to solve the user's question.
Please note that:
1. The Example in the API tool documentation can help you better understand the use of the API.
2. Ensure the parameters you output are correct. The output must contain the required parameters, and can contain the optional parameters based on the question. If no paremters in the required parameters and optional parameters, just leave it as {{"Parameters":{{}}}}
2. Ensure the parameters you output are correct. The output must contain the required parameters, and can contain the optional parameters based on the question. If there are no paremters in the required parameters and optional parameters, just leave it as {{"Parameters":{{}}}}
3. If the user's question mentions other APIs, you should ONLY consider the API tool documentation I give and do not consider other APIs.
4. The question may have dependencies on answers of other questions, so we will provide logs of previous questions and answers for your reference.
5. If you need to use this API multiple times,, please set "Parameters" to a list.
6. You must ONLY output in a parsible JSON format. Two examples output looks like:
5. If you need to use this API multiple times, please set "Parameters" to a list.
6. You must ONLY output in a parsible JSON format. Two example outputs looks like:
Example 1: {{"Parameters":{{"input": [1,2,3]}}}}
Example 2: {{"Parameters":[{{"input": [1,2,3]}}, {{"input": [2,3,4]}}]}}
There are logs of previous questions and answers:
These are logs of previous questions and answers:
{previous_log}
This is the current user's question: {question}
This is API tool documentation: {tool_usage}
This is the API tool documentation: {tool_usage}
Output: """


Expand All @@ -67,15 +67,15 @@
2. We will not show the API response to the user, thus you need to make full use of the response and give the information in the response that can satisfy the user's question in as much detail as possible.
3. If the API tool does not provide useful information in the response, please answer with your knowledge.
4. The question may have dependencies on answers of other questions, so we will provide logs of previous questions and answers.
There are logs of previous questions and answers:
These are logs of previous questions and answers:
{previous_log}
This is the user's question: {question}
This is the response output by the API tool:
{call_results}
We will not show the API response to the user, thus you need to make full use of the response and give the information in the response that can satisfy the user's question in as much detail as possible.
Output: """

ANSWER_SUMMARIZE = """We break down a complex user's problems into simple subtasks and provide answers to each simple subtask. You need to organize these answers to each subtask and form a self-consistent final answer to the user's question
ANSWER_SUMMARIZE = """We break down a complex user's problems into simple subtasks and provide answers to each simple subtask. You need to organize these answers to each subtask and form a self-consistent final answer to the user's question.
This is the user's question: {question}
These are subtasks and their answers: {answers}
Final answer: """
2 changes: 1 addition & 1 deletion vision_agent/agent/reflexion_prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Question: {question}{scratchpad}"""


COT_REFLECT_INSTRUCTION = """You are an advanced reasoning agent that can improve based on self refection. You will be given a previous reasoning trial in which you were given access to relevant context and a question to answer. You were unsuccessful in answering the question either because you guessed the wrong answer with Finish[<answer>] or there is a phrasing discrepancy with your provided answer and the answer key. In a few sentences, Diagnose a possible reason for failure or phrasing discrepancy and devise a new, concise, high level plan that aims to mitigate the same failure. Use complete sentences.
COT_REFLECT_INSTRUCTION = """You are an advanced reasoning agent that can improve based on self-refection. You will be given a previous reasoning trial in which you were given access to relevant context and a question to answer. You were unsuccessful in answering the question either because you guessed the wrong answer with Finish[<answer>] or there is a phrasing discrepancy with your provided answer and the answer key. In a few sentences, diagnose a possible reason for failure or phrasing discrepancy and devise a new, concise, high level plan that aims to mitigate the same failure. Use complete sentences.
Here are some examples:
{examples}
(END OF EXAMPLES)
Expand Down
40 changes: 20 additions & 20 deletions vision_agent/agent/vision_agent_prompts.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VISION_AGENT_REFLECTION = """You are an advanced reasoning agent that can improve based on self refection. You will be given a previous reasoning trial in which you were given the user's question, the available tools that the agent has, the decomposed tasks and tools that the agent used to answer the question and the final answer the agent provided. You must determine if the agent's answer was correct or incorrect. If the agent's answer was correct, respond with Finish. If the agent's answer was incorrect, you must diagnose a possible reason for failure or phrasing discrepancy and devise a new, concise, high level plan that aims to mitigate the same failure with the tools available. Use complete sentences.
VISION_AGENT_REFLECTION = """You are an advanced reasoning agent that can improve based on self-refection. You will be given a previous reasoning trial in which you were given the user's question, the available tools that the agent has, the decomposed tasks and tools that the agent used to answer the question and the final answer the agent provided. You must determine if the agent's answer was correct or incorrect. If the agent's answer was correct, respond with Finish. If the agent's answer was incorrect, you must diagnose a possible reason for failure or phrasing discrepancy and devise a new, concise, high level plan that aims to mitigate the same failure with the tools available. Use complete sentences.
User's question: {question}
Expand All @@ -13,33 +13,33 @@
Reflection: """

TASK_DECOMPOSE = """You need to decompose a complex user's question into some simple subtasks and let the model execute it step by step.
TASK_DECOMPOSE = """You need to decompose a user's complex question into some simple subtasks and let the model execute it step by step.
This is the user's question: {question}
This is tool list:
This is the tool list:
{tools}
Please note that:
1. You should only decompose this complex user's question into some simple subtasks which can be executed easily by using one single tool in the tool list.
2. If one subtask need the results from other subtask, you can should write clearly. For example:
1. You should only decompose this user's complex question into some simple subtasks which can be executed easily by using one single tool in the tool list.
2. If one subtask needs the results from another subtask, you should write clearly. For example:
{{"Tasks": ["Convert 23 km/h to X km/min by 'divide_'", "Multiply X km/min by 45 min to get Y by 'multiply_'"]}}
3. You must ONLY output in a parsible JSON format. An example output looks like:
{{"Tasks": ["Task 1", "Task 2", ...]}}
Output: """

TASK_DECOMPOSE_DEPENDS = """You need to decompose a complex user's question into some simple subtasks and let the model execute it step by step.
TASK_DECOMPOSE_DEPENDS = """You need to decompose a user's complex question into some simple subtasks and let the model execute it step by step.
This is the user's question: {question}
This is tool list:
This is the tool list:
{tools}
This is a reflection from a previous failed attempt:
{reflections}
Please note that:
1. You should only decompose this complex user's question into some simple subtasks which can be executed easily by using one single tool in the tool list.
2. If one subtask need the results from other subtask, you can should write clearly. For example:
1. You should only decompose this user's complex question into some simple subtasks which can be executed easily by using one single tool in the tool list.
2. If one subtask needs the results from another subtask, you should write clearly. For example:
{{"Tasks": ["Convert 23 km/h to X km/min by 'divide_'", "Multiply X km/min by 45 min to get Y by 'multiply_'"]}}
3. You must ONLY output in a parsible JSON format. An example output looks like:
Expand All @@ -53,7 +53,7 @@
{tools}
Please note that:
1. You should only chooce one tool the Tool List to solve this question.
1. You should only choose one tool from the Tool List to solve this question.
2. You must ONLY output the ID of the tool you chose in a parsible JSON format. Two example outputs look like:
Example 1: {{"ID": 1}}
Expand All @@ -70,47 +70,47 @@
{reflections}
Please note that:
1. You should only chooce one tool the Tool List to solve this question.
1. You should only choose one tool from the Tool List to solve this question.
2. You must ONLY output the ID of the tool you chose in a parsible JSON format. Two example outputs look like:
Example 1: {{"ID": 1}}
Example 2: {{"ID": 2}}
Output: """

CHOOSE_PARAMETER_DEPENDS = """Given a user's question and a API tool documentation, you need to output parameters according to the API tool documentation to successfully call the API to solve the user's question.
CHOOSE_PARAMETER_DEPENDS = """Given a user's question and an API tool documentation, you need to output parameters according to the API tool documentation to successfully call the API to solve the user's question.
Please note that:
1. The Example in the API tool documentation can help you better understand the use of the API.
2. Ensure the parameters you output are correct. The output must contain the required parameters, and can contain the optional parameters based on the question. If no paremters in the required parameters and optional parameters, just leave it as {{"Parameters":{{}}}}
2. Ensure the parameters you output are correct. The output must contain the required parameters, and can contain the optional parameters based on the question. If there are no paremters in the required parameters and optional parameters, just leave it as {{"Parameters":{{}}}}
3. If the user's question mentions other APIs, you should ONLY consider the API tool documentation I give and do not consider other APIs.
4. The question may have dependencies on answers of other questions, so we will provide logs of previous questions and answers for your reference.
5. If you need to use this API multiple times,, please set "Parameters" to a list.
6. You must ONLY output in a parsible JSON format. Two examples output looks like:
5. If you need to use this API multiple times, please set "Parameters" to a list.
6. You must ONLY output in a parsible JSON format. Two example outputs look like:
Example 1: {{"Parameters":{{"input": [1,2,3]}}}}
Example 2: {{"Parameters":[{{"input": [1,2,3]}}, {{"input": [2,3,4]}}]}}
This is a reflection from a previous failed attempt:
{reflections}
There are logs of previous questions and answers:
These are logs of previous questions and answers:
{previous_log}
This is the current user's question: {question}
This is API tool documentation: {tool_usage}
This is the API tool documentation: {tool_usage}
Output: """

ANSWER_GENERATE_DEPENDS = """You should answer the question based on the response output by the API tool.
Please note that:
1. Try to organize the response into a natural language answer.
1. You should try to organize the response into a natural language answer.
2. We will not show the API response to the user, thus you need to make full use of the response and give the information in the response that can satisfy the user's question in as much detail as possible.
3. If the API tool does not provide useful information in the response, please answer with your knowledge.
4. The question may have dependencies on answers of other questions, so we will provide logs of previous questions and answers.
This is a reflection from a previous failed attempt:
{reflections}
There are logs of previous questions and answers:
These are logs of previous questions and answers:
{previous_log}
This is the user's question: {question}
Expand All @@ -121,7 +121,7 @@
We will not show the API response to the user, thus you need to make full use of the response and give the information in the response that can satisfy the user's question in as much detail as possible.
Output: """

ANSWER_SUMMARIZE_DEPENDS = """We break down a complex user's problems into simple subtasks and provide answers to each simple subtask. You need to organize these answers to each subtask and form a self-consistent final answer to the user's question
ANSWER_SUMMARIZE_DEPENDS = """We break down a user's complex problems into simple subtasks and provide answers to each simple subtask. You need to organize these answers to each subtask and form a self-consistent final answer to the user's question
This is the user's question: {question}
These are subtasks and their answers:
Expand Down
6 changes: 3 additions & 3 deletions vision_agent/tools/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
"This is the API tool documentation: {api_doc}\n"
"Please note that: \n"
"1. The Example in the API tool documentation can help you better understand the use of the API.\n"
'2. Ensure the parameters you output are correct. The output must contain the required parameters, and can contain the optional parameters based on the question. If no paremters in the required parameters and optional parameters, just leave it as {{"Parameters":{{}}}}\n'
'2. Ensure the parameters you output are correct. The output must contain the required parameters, and can contain the optional parameters based on the question. If there are no parameters in the required parameters and optional parameters, just leave it as {{"Parameters":{{}}}}\n'
"3. If the user's question mentions other APIs, you should ONLY consider the API tool documentation I give and do not consider other APIs.\n"
'4. If you need to use this API multiple times, please set "Parameters" to a list.\n'
"5. You must ONLY output in a parsible JSON format. Two examples output looks like:\n"
"5. You must ONLY output in a parsible JSON format. Two example outputs look like:\n"
"'''\n"
'Example 1: {{"Parameters":{{"keyword": "Artificial Intelligence", "language": "English"}}}}\n'
'Example 2: {{"Parameters":[{{"keyword": "Artificial Intelligence", "language": "English"}}, {{"keyword": "Machine Learning", "language": "English"}}]}}\n'
"'''\n"
"This is user's question: {question}\n"
"This is the user's question: {question}\n"
"Output:\n"
)

0 comments on commit b762572

Please sign in to comment.