Sync from GitHub via hub-sync
Browse files- learning_engine.py +11 -4
learning_engine.py
CHANGED
|
@@ -62,7 +62,8 @@ def grade_answer(card: Card, user_answer: str) -> GradeResult:
|
|
| 62 |
if not (user_answer or "").strip():
|
| 63 |
return new_grade(
|
| 64 |
0,
|
| 65 |
-
f"
|
|
|
|
| 66 |
card["topic"],
|
| 67 |
)
|
| 68 |
|
|
@@ -83,12 +84,18 @@ def grade_answer(card: Card, user_answer: str) -> GradeResult:
|
|
| 83 |
"2 = partially relevant but misses the key idea; 3 = mostly correct with "
|
| 84 |
"a minor gap; 4-5 = correct and complete. If the answer is factually "
|
| 85 |
"wrong, score 0-2 (NOT 3). "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
"Return ONLY a JSON object with keys: "
|
| 87 |
-
"score (integer 0-5), explanation (string
|
| 88 |
"missed_concept (short string naming what they got wrong, or \"\"). "
|
| 89 |
"Example (return ONE object exactly like this, no other text):\n"
|
| 90 |
-
'{"score": 1, "explanation": "
|
| 91 |
-
'
|
|
|
|
| 92 |
{"role": "user", "content":
|
| 93 |
f"Question: {card['question']}\nReference answer: {card['answer']}\n"
|
| 94 |
f"Student answer: {user_answer}\nGrade it."},
|
|
|
|
| 62 |
if not (user_answer or "").strip():
|
| 63 |
return new_grade(
|
| 64 |
0,
|
| 65 |
+
f"You didn't answer this one — no worries, take a look at the "
|
| 66 |
+
f"reference answer and give it another go: {card['answer']}",
|
| 67 |
card["topic"],
|
| 68 |
)
|
| 69 |
|
|
|
|
| 84 |
"2 = partially relevant but misses the key idea; 3 = mostly correct with "
|
| 85 |
"a minor gap; 4-5 = correct and complete. If the answer is factually "
|
| 86 |
"wrong, score 0-2 (NOT 3). "
|
| 87 |
+
"Score strictly, but write the feedback warmly. Speak DIRECTLY to the "
|
| 88 |
+
"student in the second person ('you', 'your answer') with an "
|
| 89 |
+
"encouraging coaching tone — acknowledge what they got right before what "
|
| 90 |
+
"they missed. NEVER write in the third person or refer to them as 'the "
|
| 91 |
+
"student' / 'the student's response'. "
|
| 92 |
"Return ONLY a JSON object with keys: "
|
| 93 |
+
"score (integer 0-5), explanation (string spoken to the student), "
|
| 94 |
"missed_concept (short string naming what they got wrong, or \"\"). "
|
| 95 |
"Example (return ONE object exactly like this, no other text):\n"
|
| 96 |
+
'{"score": 1, "explanation": "Good instinct, but that\'s the wrong '
|
| 97 |
+
'location — the Calvin cycle actually runs in the stroma. Try linking '
|
| 98 |
+
'it to where the enzymes sit.", "missed_concept": "the specific location"}'},
|
| 99 |
{"role": "user", "content":
|
| 100 |
f"Question: {card['question']}\nReference answer: {card['answer']}\n"
|
| 101 |
f"Student answer: {user_answer}\nGrade it."},
|