Dama03 commited on
Commit
a905e8f
·
1 Parent(s): 5be5b0f
Files changed (1) hide show
  1. medical_ai.py +15 -9
medical_ai.py CHANGED
@@ -360,17 +360,23 @@ 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
- # Prompt for BioGPT: friendly, empathetic, Cameroonian context, precise, with safety disclaimer
364
  context_str = "\n".join([f"- {c}" for ctxs in contexts.values() for c in ctxs])
365
  prompt = (
366
- "You are a helpful, friendly, and empathetic medical assistant. "
367
- "Always answer in a clear, simple, and reassuring way, as if you are talking to a patient who may be worried. "
368
- "Take into account the Cameroonian context, including local realities, resources, and common practices. "
369
- "Be precise and concise in your answers. "
370
- "At the end of each answer, always add: 'This is an AI-generated answer. Please always contact a doctor for more precision.'\n"
371
- f"Contexts:\n{context_str}\n"
372
- f"Question: {question}\n"
373
- "Answer:"
 
 
 
 
 
 
374
  )
375
  return prompt
376
 
 
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