Ahmad-Moiz commited on
Commit
9029850
1 Parent(s): e402b2d

Update text_utils.py

Browse files
Files changed (1) hide show
  1. text_utils.py +1 -12
text_utils.py CHANGED
@@ -19,20 +19,16 @@ def remove_citations(text: str) -> str:
19
 
20
  template = """You are a teacher grading a quiz.
21
  You are given a question, the student's answer, and the true answer, and are asked to score the student answer as either CORRECT or INCORRECT.
22
-
23
  Example Format:
24
  QUESTION: question here
25
  STUDENT ANSWER: student's answer here
26
  TRUE ANSWER: true answer here
27
  GRADE: CORRECT or INCORRECT here
28
-
29
  Grade the student answers based ONLY on their factual accuracy. Ignore differences in punctuation and phrasing between the student answer and true answer. It is OK if the student answer contains more information than the true answer, as long as it does not contain any conflicting statements. Begin!
30
-
31
  QUESTION: {query}
32
  STUDENT ANSWER: {result}
33
  TRUE ANSWER: {answer}
34
  GRADE:
35
-
36
  And explain why the STUDENT ANSWER is correct or incorrect.
37
  """
38
 
@@ -41,20 +37,16 @@ GRADE_ANSWER_PROMPT = PromptTemplate(input_variables=["query", "result", "answer
41
  template = """You are a teacher grading a quiz.
42
  You are given a question, the student's answer, and the true answer, and are asked to score the student answer as either CORRECT or INCORRECT.
43
  You are also asked to identify potential sources of bias in the question and in the true answer.
44
-
45
  Example Format:
46
  QUESTION: question here
47
  STUDENT ANSWER: student's answer here
48
  TRUE ANSWER: true answer here
49
  GRADE: CORRECT or INCORRECT here
50
-
51
  Grade the student answers based ONLY on their factual accuracy. Ignore differences in punctuation and phrasing between the student answer and true answer. It is OK if the student answer contains more information than the true answer, as long as it does not contain any conflicting statements. Begin!
52
-
53
  QUESTION: {query}
54
  STUDENT ANSWER: {result}
55
  TRUE ANSWER: {answer}
56
  GRADE:
57
-
58
  And explain why the STUDENT ANSWER is correct or incorrect, identify potential sources of bias in the QUESTION, and identify potential sources of bias in the TRUE ANSWER.
59
  """
60
 
@@ -82,15 +74,12 @@ GRADE_ANSWER_PROMPT_OPENAI = PromptTemplate(input_variables=["query", "result",
82
 
83
  template = """You are a teacher grading a quiz.
84
  You are given a question, the student's answer, and the true answer, and are asked to score the student answer as either CORRECT or INCORRECT.
85
-
86
  Example Format:
87
  QUESTION: question here
88
  STUDENT ANSWER: student's answer here
89
  TRUE ANSWER: true answer here
90
  GRADE: CORRECT or INCORRECT here
91
-
92
  Grade the student answers based ONLY on their factual accuracy. Ignore differences in punctuation and phrasing between the student answer and true answer. It is OK if the student answer contains more information than the true answer, as long as it does not contain any conflicting statements. Begin!
93
-
94
  QUESTION: {query}
95
  STUDENT ANSWER: {result}
96
  TRUE ANSWER: {answer}
@@ -117,4 +106,4 @@ template = """
117
  Answer in the following format: \n
118
  "Context is relevant: True or False." \n """
119
 
120
- GRADE_DOCS_PROMPT_FAST = PromptTemplate(input_variables=["query", "result", "answer"], template=template)
 
19
 
20
  template = """You are a teacher grading a quiz.
21
  You are given a question, the student's answer, and the true answer, and are asked to score the student answer as either CORRECT or INCORRECT.
 
22
  Example Format:
23
  QUESTION: question here
24
  STUDENT ANSWER: student's answer here
25
  TRUE ANSWER: true answer here
26
  GRADE: CORRECT or INCORRECT here
 
27
  Grade the student answers based ONLY on their factual accuracy. Ignore differences in punctuation and phrasing between the student answer and true answer. It is OK if the student answer contains more information than the true answer, as long as it does not contain any conflicting statements. Begin!
 
28
  QUESTION: {query}
29
  STUDENT ANSWER: {result}
30
  TRUE ANSWER: {answer}
31
  GRADE:
 
32
  And explain why the STUDENT ANSWER is correct or incorrect.
33
  """
34
 
 
37
  template = """You are a teacher grading a quiz.
38
  You are given a question, the student's answer, and the true answer, and are asked to score the student answer as either CORRECT or INCORRECT.
39
  You are also asked to identify potential sources of bias in the question and in the true answer.
 
40
  Example Format:
41
  QUESTION: question here
42
  STUDENT ANSWER: student's answer here
43
  TRUE ANSWER: true answer here
44
  GRADE: CORRECT or INCORRECT here
 
45
  Grade the student answers based ONLY on their factual accuracy. Ignore differences in punctuation and phrasing between the student answer and true answer. It is OK if the student answer contains more information than the true answer, as long as it does not contain any conflicting statements. Begin!
 
46
  QUESTION: {query}
47
  STUDENT ANSWER: {result}
48
  TRUE ANSWER: {answer}
49
  GRADE:
 
50
  And explain why the STUDENT ANSWER is correct or incorrect, identify potential sources of bias in the QUESTION, and identify potential sources of bias in the TRUE ANSWER.
51
  """
52
 
 
74
 
75
  template = """You are a teacher grading a quiz.
76
  You are given a question, the student's answer, and the true answer, and are asked to score the student answer as either CORRECT or INCORRECT.
 
77
  Example Format:
78
  QUESTION: question here
79
  STUDENT ANSWER: student's answer here
80
  TRUE ANSWER: true answer here
81
  GRADE: CORRECT or INCORRECT here
 
82
  Grade the student answers based ONLY on their factual accuracy. Ignore differences in punctuation and phrasing between the student answer and true answer. It is OK if the student answer contains more information than the true answer, as long as it does not contain any conflicting statements. Begin!
 
83
  QUESTION: {query}
84
  STUDENT ANSWER: {result}
85
  TRUE ANSWER: {answer}
 
106
  Answer in the following format: \n
107
  "Context is relevant: True or False." \n """
108
 
109
+ GRADE_DOCS_PROMPT_FAST = PromptTemplate(input_variables=["query", "result", "answer"], template=template)