bstraehle commited on
Commit
4990e97
·
verified ·
1 Parent(s): 30b20b0

Update util.py

Browse files
Files changed (1) hide show
  1. util.py +22 -22
util.py CHANGED
@@ -17,28 +17,28 @@ def get_questions():
17
 
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 determine the final answer.
21
-
22
- **Instructions:**
23
- - 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.
24
- - If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise.
25
- - If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise.
26
- - 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.
27
- - In case of a single word answer, start the word with an uppercase letter.
28
-
29
- **Question:** """
30
- question + """
31
-
32
- **Initial answer:** """
33
- initial_answer + """
34
-
35
- **Example 1:** What is the opposite of white? Black
36
- **Example 2:** How many 'r's are in the word strawberry? 3
37
- **Example 3:** What is the biggest city in California? Los Angeles
38
-
39
- **Final answer:**
40
-
41
- """
42
 
43
  client = OpenAI()
44
  completion = client.chat.completions.create(
 
17
 
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 determine the final answer.
21
+
22
+ **Instructions:**
23
+ - 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.
24
+ - If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise.
25
+ - If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise.
26
+ - 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.
27
+ - In case of a single word answer, start the word with an uppercase letter.
28
+
29
+ **Question:** """
30
+ question + """
31
+
32
+ **Initial answer:** """
33
+ initial_answer + """
34
+
35
+ **Example 1:** What is the opposite of white? Black
36
+ **Example 2:** How many 'r's are in the word strawberry? 3
37
+ **Example 3:** What is the biggest city in California? Los Angeles
38
+
39
+ **Final answer:**
40
+
41
+ """
42
 
43
  client = OpenAI()
44
  completion = client.chat.completions.create(