Anupriya commited on
Commit
83edd7c
·
1 Parent(s): 34771bf
Files changed (1) hide show
  1. writting.py +18 -29
writting.py CHANGED
@@ -109,35 +109,24 @@ def validate_response():
109
  return jsonify({"error": "Both 'topic' and 'response' fields are required."}), 400
110
 
111
  # Define the prompt for GPT to evaluate the response
112
- # validation_prompt = (
113
- # f"You are a writing teacher. Evaluate the sentence formation, grammar, and overall writing quality of the following response. "
114
- # f"Provide constructive feedback highlighting any errors in grammar, spelling, punctuation, and sentence structure. "
115
- # f"If the response is well-written, acknowledge its strengths. "
116
- # f"Topic: '{topic}'. Response: '{response_text}'."
117
- # )
118
-
119
-
120
-
121
- validation_prompt = (
122
- "You are a kind writing teacher for children (age 9–12). "
123
- "Use very simple English (CEFR A2). "
124
- "Give feedback in at most 8 lines; each line under 12 words. "
125
- "Use active voice. Avoid hard words (no 'analyze', 'implications', etc.). "
126
- "If the student copied the topic or wrote too little, say: "
127
- "'Please write in your own words.' and give one starter line. "
128
- "Format EXACTLY like this:\n"
129
- "Title: Simple Feedback\n"
130
- "What is good:\n"
131
- "- <two short points>\n"
132
- "Needs fixing:\n"
133
- "- <two short points>\n"
134
- "Example fix:\n"
135
- "- <rewrite one short sentence>\n"
136
- "Score: <number>/10\n"
137
- "Rules: Do not use angle brackets in the output. "
138
- f"Topic: {topic}\n"
139
- f"Student response: {response_text}"
140
- )
141
 
142
  messages = [
143
  {"role": "system", "content": "You are a helpful writing teacher."},
 
109
  return jsonify({"error": "Both 'topic' and 'response' fields are required."}), 400
110
 
111
  # Define the prompt for GPT to evaluate the response
112
+ validation_prompt = (
113
+ f"You are a strict writing teacher. "
114
+ f"Score: <number>/10\n\n"
115
+ f"Check the student's response for grammar, spelling, punctuation, and sentence structure. "
116
+ f"Give feedback in simple, clear English that a 10-year-old can understand. "
117
+ f"Keep the feedback neat and easy to read. "
118
+ f"Use this exact format:\n\n"
119
+ f"What is good:\n"
120
+ f"- <two short points about strengths>\n"
121
+ f"Needs fixing:\n"
122
+ f"- <two short points about mistakes>\n"
123
+ f"How to improve:\n"
124
+ f"- <one short, clear tip or rewrite>\n"
125
+
126
+ f"Topic: '{topic}'. Response: '{response_text}'."
127
+ )
128
+
129
+
 
 
 
 
 
 
 
 
 
 
 
130
 
131
  messages = [
132
  {"role": "system", "content": "You are a helpful writing teacher."},