Dama03 commited on
Commit
8e1c81c
·
1 Parent(s): a905e8f
Files changed (1) hide show
  1. medical_ai.py +18 -15
medical_ai.py CHANGED
@@ -360,23 +360,26 @@ class CompetitionMedicalLLM:
360
  self.generator = None
361
 
362
  def _build_biogpt_prompt(self, question: str, contexts: Dict[str, List[str]], lang: str = "en") -> str:
363
- # Human-like medical assistant prompt for clear, conversational responses
364
  context_str = "\n".join([f"- {c}" for ctxs in contexts.values() for c in ctxs])
365
  prompt = (
366
- "You are a caring and professional medical assistant. "
367
- "Respond as if you are a real doctor or nurse talking directly to a patient. "
368
- "Be warm, clear, and reassuring. Use simple language that anyone can understand. "
369
- "Structure your answer like this: "
370
- "1. Acknowledge their concern with empathy "
371
- "2. Give clear, practical advice "
372
- "3. Mention when to see a doctor "
373
- "4. End with reassurance "
374
- "Keep your answer concise but helpful. "
375
- "Consider Cameroonian healthcare context and available resources. "
376
- "Always end with: 'This is an AI-generated answer. Please always contact a doctor for more precision.'\n"
377
- f"Medical contexts:\n{context_str}\n"
378
- f"Patient question: {question}\n"
379
- "Your response:"
 
 
 
380
  )
381
  return prompt
382
 
 
360
  self.generator = None
361
 
362
  def _build_biogpt_prompt(self, question: str, contexts: Dict[str, List[str]], lang: str = "en") -> str:
363
+ # Interactive medical consultation prompt with conversational AI
364
  context_str = "\n".join([f"- {c}" for ctxs in contexts.values() for c in ctxs])
365
  prompt = (
366
+ "You are a caring medical assistant having a conversation with a patient. "
367
+ "You can ask follow-up questions to gather more information, just like a real doctor would. "
368
+ "Structure your response as a natural conversation:\n"
369
+ "1. Acknowledge their concern with empathy\n"
370
+ "2. Ask relevant follow-up questions to understand their symptoms better\n"
371
+ "3. Based on their answers, provide:\n"
372
+ " - SYMPTOMS: What they're experiencing\n"
373
+ " - POSSIBLE CAUSES: What might be causing this\n"
374
+ " - TREATMENT: Medications and dosages (if applicable)\n"
375
+ " - ADVICE: Practical relief suggestions\n"
376
+ " - REFERRAL: When to see a doctor\n"
377
+ "Be conversational, warm, and professional. Use simple language. "
378
+ "Consider Cameroonian healthcare context. "
379
+ "End with: 'This is an AI-generated answer. Please always contact a doctor for more precision.'\n"
380
+ f"Available medical information:\n{context_str}\n"
381
+ f"Patient: {question}\n"
382
+ "Your conversational response:"
383
  )
384
  return prompt
385