Update util.py
Browse files
util.py
CHANGED
|
@@ -18,18 +18,18 @@ def get_questions():
|
|
| 18 |
def get_final_answer(question, initial_answer):
|
| 19 |
prompt_template = """
|
| 20 |
You are an expert question answering assistant. Given a question and an initial answer, your task is to provide the final answer.
|
| 21 |
-
Your final answer must be a number and/or string OR as few words as possible OR a comma
|
| 22 |
-
If you are asked for a number, don't use comma to write your number neither use units such as $ or
|
| 23 |
-
If you are asked for a string, don't use articles, neither abbreviations
|
| 24 |
-
If you are asked for a comma
|
| 25 |
-
If the final answer is a single word, start
|
| 26 |
|
| 27 |
**Question:** """ + question + """
|
| 28 |
|
| 29 |
**Initial answer:** """ + initial_answer + """
|
| 30 |
|
| 31 |
**Example 1:** How many 'r's are in strawberry? 3
|
| 32 |
-
**Example 2:** What is the opposite of
|
| 33 |
**Example 3:** What is the biggest city in California? Los Angeles
|
| 34 |
**Example 4:** What is the superlative of good? Best
|
| 35 |
**Example 5:** How many states are in the USA? 50
|
|
|
|
| 18 |
def get_final_answer(question, initial_answer):
|
| 19 |
prompt_template = """
|
| 20 |
You are an expert question answering assistant. Given a question and an initial answer, your task is to provide the final answer.
|
| 21 |
+
Your final answer must be a number and/or string OR as few words as possible OR a comma-separated list of numbers and/or strings.
|
| 22 |
+
If you are asked for a number, don't use comma to write your number neither use units such as $ or % unless specified otherwise.
|
| 23 |
+
If you are asked for a string, don't use articles, neither abbreviations, and write the digits in plain text unless specified otherwise.
|
| 24 |
+
If you are asked for a comma-separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.
|
| 25 |
+
If the final answer is a single word, start uppercase.
|
| 26 |
|
| 27 |
**Question:** """ + question + """
|
| 28 |
|
| 29 |
**Initial answer:** """ + initial_answer + """
|
| 30 |
|
| 31 |
**Example 1:** How many 'r's are in strawberry? 3
|
| 32 |
+
**Example 2:** What is the opposite of black? White
|
| 33 |
**Example 3:** What is the biggest city in California? Los Angeles
|
| 34 |
**Example 4:** What is the superlative of good? Best
|
| 35 |
**Example 5:** How many states are in the USA? 50
|