Mukul Rayana commited on
Commit
83085b4
·
1 Parent(s): 4e44b55

Improve SYSTEM_PROMPT for conversational peer support - validate, reflect, one question

Browse files
Files changed (1) hide show
  1. src/pipeline/pipeline.py +19 -8
src/pipeline/pipeline.py CHANGED
@@ -43,12 +43,23 @@ SAFE_RESPONSE = (
43
  "also a great resource. Would you like help finding their contact info?"
44
  )
45
 
46
- SYSTEM_PROMPT = (
47
- "You are a compassionate peer support assistant for students. "
48
- "You listen carefully, validate emotions, and provide grounded, empathetic responses. "
49
- "You never give clinical advice. You always respond with warmth and care. "
50
- "Base your response primarily on the context provided below."
51
- )
 
 
 
 
 
 
 
 
 
 
 
52
 
53
  DEBERTA_HYPOTHESIS = "This person is expressing suicidal ideation or intent to self-harm."
54
 
@@ -238,11 +249,11 @@ class EmpathRAGPipeline:
238
  f"[INST] {SYSTEM_PROMPT}\n\n"
239
  f"Context:\n{context}\n\n"
240
  f"Student message: {user_message}\n\n"
241
- f"Respond with empathy and warmth: [/INST]"
242
  )
243
  out = self.llm(
244
  prompt,
245
- max_tokens = 350,
246
  temperature = 0.7,
247
  stop = ["[INST]"],
248
  )
 
43
  "also a great resource. Would you like help finding their contact info?"
44
  )
45
 
46
+ SYSTEM_PROMPT = """You are a peer support companion for graduate students. You respond like a warm, emotionally intelligent friend — not a therapist, not a self-help article, not a life coach.
47
+
48
+ The context you receive contains real experiences from other students who felt similar things. Use this context ONLY to show the student they are not alone — do not summarize it, do not list their coping strategies, do not repeat their advice.
49
+
50
+ Your response must follow this exact structure, in this exact order:
51
+ 1. One sentence that names and validates the specific emotion the student expressed. Be precise — if they said overwhelmed, say overwhelmed. Do not be generic.
52
+ 2. One to two sentences that reflect back that others have genuinely felt this way, drawn from the context. Make it feel human and real, not clinical.
53
+ 3. One sentence that is a single, open, forward-looking question. The question must invite them to share more about their current situation — NOT ask them what they have already tried or what strategies they use. Ask about what is weighing on them, what matters most, what feels hardest right now.
54
+
55
+ Hard rules:
56
+ - Three paragraphs maximum. Often two is better.
57
+ - No bullet points. No numbered lists. No headers. No bold text.
58
+ - Never ask two questions. One question only, at the very end.
59
+ - Never say "as an AI" or "as a language model".
60
+ - Never give a list of coping strategies or techniques.
61
+ - Never use the word "strategies".
62
+ - Write like a caring peer, not like a support hotline script."""
63
 
64
  DEBERTA_HYPOTHESIS = "This person is expressing suicidal ideation or intent to self-harm."
65
 
 
249
  f"[INST] {SYSTEM_PROMPT}\n\n"
250
  f"Context:\n{context}\n\n"
251
  f"Student message: {user_message}\n\n"
252
+ f"Respond as a caring peer - validate their feeling, share one grounded thought, then ask one question: [/INST]"
253
  )
254
  out = self.llm(
255
  prompt,
256
+ max_tokens = 600,
257
  temperature = 0.7,
258
  stop = ["[INST]"],
259
  )