Skip to content

Commit

Permalink
📄 prompts
Browse files Browse the repository at this point in the history
  • Loading branch information
Leolty committed Dec 20, 2023
1 parent ae78735 commit 1b79650
Show file tree
Hide file tree
Showing 7 changed files with 237 additions and 0 deletions.
26 changes: 26 additions & 0 deletions prompt/general/eval.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
eval_prompt = """
Below is a markdown table regarding "[TITLE]":
[TABLE]
You're tasked with answering the following question:
[QUESTION]
You have 2 answers derived by two different methods. Answer A was derived by prompting the AI to think step-by-step. Answer B was derived by interacting with a Python Shell.
Answer A is [COT_ANSWER].
Answer B is [AGENT_ANSWER].
Your task is to determine which is the correct answer. It is crucial that you strictly adhere to the following evaluation process:
1. **Preliminary Evaluation**: Begin by evaluating which of the two answers directly addresses the question in a straightforward and unambiguous manner. A direct answer provides a clear response that aligns closely with the query without introducing additional or extraneous details. If one of the answers is not a direct response to the question, simply disregard it.
2. **Nature of the Question**: If both answers appear to be direct answers, then evaluate the nature of the question. For tasks involving computation, counting, and column-locating, especially when for extensive table, the Python Shell (Answer B) might be more precise. However, always remain cautious if the Python Shell's output appears off (e.g., error messages, success notifications, etc.). Such outputs may not be trustworthy for a correct answer.
3. **Final Verdict**: Finally, after thorough evaluation and explanation, provide your verdict strictly following the given format:
- Use "[[A]]" if Answer A is correct.
- Use "[[B]]" if Answer B is correct.
Note:
1. Each method has its own strengths and weaknesses. Evaluate them with with an unbiased perspective. When in doubt, consider the nature of the question and lean towards the method that is most suited for such queries.
2. Ensure that your verdict is provided after evaluation, at the end.
"""
28 changes: 28 additions & 0 deletions prompt/general/resort_check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
sort_prompt = """
You are an advanced AI capable of analyzing and understanding information within tables. Read the table below regarding "[TITLE]":
[TABLE]
Note: Only selected rows from the beginning and end of the table are displayed for brevity. Intermediate rows are omitted and represented by "..." for clarity.
The table column headings are provided below, separated by semicolons:
[HEADINGS]
In order to optimize the interpretability and readability of the data, follow these guidelines to determine the most suitable sorting method:
Sorting Guidelines:
1. Evaluate columns based on data types such as numerical, alphabetical, chronological, categorical, or other relevant sorting methods.
2. Identify any patterns or relationships in the data that would be highlighted by certain sorting methods.
3. Consider column position, as those on the left may sometimes have sorting priority.
4. If applicable, consider sorting by multiple columns in a prioritized sequence.
Provide your decision using one of the following statements:
- For sorting using a single column: "Sort by: [Name of Column]".
- For sorting using multiple columns: "Sort by: [Primary Column Name], [Secondary Column Name], ...".
- If no specific sorting seems advantageous: "Sort by: N/A".
Your response should strictly follow the formats provided.
"""
15 changes: 15 additions & 0 deletions prompt/general/transpose_check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
header_check_prompt = """
You are an advanced AI capable of analyzing and understanding information within tables. Read the table below regarding "[TITLE]".
[TABLE]
Headings of a table are labels or titles given to rows or columns to provide a brief description of the data they contain.
Based on the given table, the headings of the table are more likely to be:
(A) [FIRST_ROW]
(B) [FIRST_COLUMN]
(C) None of the above
Directly give your choice. Ensure the format is only "Choice: (A)/(B)/(C)" form, no other form, without any explanation.
"""
73 changes: 73 additions & 0 deletions prompt/tabfact/agent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
agent_prefix = """
You are working with a pandas dataframe in Python. The name of the dataframe is `df`. Your task is to use `python_repl_ast` to check whether the statement is true or false.
Tool description:
- `python_repl_ast`: A Python shell. Use this to execute python commands. Input should be a valid python command. When using this tool, sometimes the output is abbreviated - ensure it does not appear abbreviated before using it in your answer.
Guidelines:
- **Aggregated Rows**: Be cautious of rows that aggregate data such as 'total', 'sum', or 'average'. Ensure these rows do not influence your results inappropriately.
- **Data Verification**: Before concluding the final answer, always verify that your observations align with the original table and question.
Strictly follow the given format to respond:
Statement: the input statement you must check
Thought: you should always think about what to do to interact with `python_repl_ast`
Action: can **ONLY** be `python_repl_ast`
Action Input: the input code to the action
Observation: the result of the action
... (this Thought/Action/Action Input/Observation can repeat N times)
Thought: after verifying the table, observations, and the statement, I am confident in the final answer
Final Answer: the final answer to the original input statement (Yes/No)
Notes for final answer:
- Ensure the final answer format is only "Final Answer: Yes/No" form, no other form.
- Ensure the final answer is only a Yes or No, without any explanation.
- Ensure to have a concluding thought that verifies the table, observations and the statement before giving the final answer.
You are provided with a table regarding "[TITLE]". This is the result of `print(df.to_markdown())`:
[TABLE]
**Note**: All cells in the table should be considered as `object` data type, regardless of their appearance.
Begin!
Statement: [QUESTION]
"""

agent_prefix_with_omitted_rows_guideline= """
You are working with a pandas dataframe in Python. The name of the dataframe is `df`. Your task is to use `python_repl_ast` to check whether the statement is true or false.
Tool description:
- `python_repl_ast`: A Python shell. Use this to execute python commands. Input should be a valid python command. When using this tool, sometimes the output is abbreviated - ensure it does not appear abbreviated before using it in your answer.
Guidelines:
- **Aggregated Rows**: Be cautious of rows that aggregate data such as 'total', 'sum', or 'average'. Ensure these rows do not influence your results inappropriately.
- **Data Verification**: Before concluding the final answer, always verify that your observations align with the original table and question.
Strictly follow the given format to respond:
Statement: the input statement you must check
Thought: you should always think about what to do to interact with `python_repl_ast`
Action: can **ONLY** be `python_repl_ast`
Action Input: the input code to the action
Observation: the result of the action
... (this Thought/Action/Action Input/Observation can repeat N times)
Thought: after verifying the table, observations, and the statement, I am confident in the final answer
Final Answer: the final answer to the original input statement (Yes/No)
Notes for final answer:
- Ensure the final answer format is only "Final Answer: Yes/No" form, no other form.
- Ensure the final answer is only a Yes or No, without any explanation.
- Ensure to have a concluding thought that verifies the table, observations and the statement before giving the final answer.
You are provided with a table regarding "[TITLE]". This is the result of `print(df.to_markdown())`:
[TABLE]
Notes for table:
1. All cells in the table should be considered as `object` data type, regardless of their appearance.
2. Some intermediate rows in the table might be omitted for brevity. Do not attempt to fetch these as you cannot handle too long content.
Begin!
Question: [QUESTION]
"""
11 changes: 11 additions & 0 deletions prompt/tabfact/cot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cot_prompt = """
You are an advanced AI capable of analyzing and understanding information within tables. Read the table below regarding "[TITLE]".
[TABLE]
Based on the given table, check the following statement is true or false:
[QUESTION]
Let's think step by step to verify the statement, and then give the final answer. Ensure the final answer format is only "Final Answer: Yes/No" form, no other form. And ensure the final answer is only a Yes or No, without any explanation.
"""
73 changes: 73 additions & 0 deletions prompt/wtq/agent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
agent_prefix = """
You are working with a pandas dataframe in Python. The name of the dataframe is `df`. Your task is to use `python_repl_ast` to answer the question posed to you.
Tool description:
- `python_repl_ast`: A Python shell. Use this to execute python commands. Input should be a valid python command. When using this tool, sometimes the output is abbreviated - ensure it does not appear abbreviated before using it in your answer.
Guidelines:
- **Aggregated Rows**: Be cautious of rows that aggregate data such as 'total', 'sum', or 'average'. Ensure these rows do not influence your results inappropriately.
- **Data Verification**: Before concluding the final answer, always verify that your observations align with the original table and question.
Strictly follow the given format to respond:
Question: the input question you must answer
Thought: you should always think about what to do to interact with `python_repl_ast`
Action: can **ONLY** be `python_repl_ast`
Action Input: the input code to the action
Observation: the result of the action
... (this Thought/Action/Action Input/Observation can repeat N times)
Thought: after verifying the table, observations, and the question, I am confident in the final answer
Final Answer: the final answer to the original input question (AnswerName1, AnswerName2...)
Notes for final answer:
- Ensure the final answer format is only "Final Answer: AnswerName1, AnswerName2..." form, no other form.
- Ensure the final answer is a number or entity names, as short as possible, without any explanation.
- Ensure to have a concluding thought that verifies the table, observations and the question before giving the final answer.
You are provided with a table regarding "[TITLE]". This is the result of `print(df.to_markdown())`:
[TABLE]
**Note**: All cells in the table should be considered as `object` data type, regardless of their appearance.
Begin!
Question: [QUESTION]
"""

agent_prefix_with_omitted_rows_guideline= """
You are working with a pandas dataframe in Python. The name of the dataframe is `df`. Your task is to use `python_repl_ast` to answer the question posed to you.
Tool description:
- `python_repl_ast`: A Python shell. Use this to execute python commands. Input should be a valid python command. When using this tool, sometimes the output is abbreviated - ensure it does not appear abbreviated before using it in your answer.
Guidelines:
- **Aggregated Rows**: Be cautious of rows that aggregate data such as 'total', 'sum', or 'average'. Ensure these rows do not influence your results inappropriately.
- **Data Verification**: Before concluding the final answer, always verify that your observations align with the original table and question.
Strictly follow the given format to respond:
Question: the input question you must answer
Thought: you should always think about what to do to interact with `python_repl_ast`
Action: can **ONLY** be `python_repl_ast`
Action Input: the input code to the action
Observation: the result of the action
... (this Thought/Action/Action Input/Observation can repeat N times)
Thought: after verifying the table, observations, and the question, I am confident in the final answer
Final Answer: the final answer to the original input question (AnswerName1, AnswerName2...)
Notes for final answer:
- Ensure the final answer format is only "Final Answer: AnswerName1, AnswerName2..." form, no other form.
- Ensure the final answer is a number or entity names, as short as possible, without any explanation.
- Ensure to have a concluding thought that verifies the table, observations and the question before giving the final answer.
You are provided with a table regarding "[TITLE]". This is the result of `print(df.to_markdown())`:
[TABLE]
Notes for table:
1. All cells in the table should be considered as `object` data type, regardless of their appearance.
2. Some intermediate rows in the table might be omitted for brevity. Do not attempt to fetch these as you cannot handle too long content.
Begin!
Question: [QUESTION]
"""
11 changes: 11 additions & 0 deletions prompt/wtq/cot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cot_prompt = """
You are an advanced AI capable of analyzing and understanding information within tables. Read the table below regarding "[TITLE]".
[TABLE]
Based on the given table, answer the following question:
[QUESTION]
Let's think step by step, and then give the final answer. Ensure the final answer format is only "Final Answer: AnswerName1, AnswerName2..." form, no other form. And ensure the final answer is a number or entity names, as short as possible, without any explanation.
"""

0 comments on commit 1b79650

Please sign in to comment.