Dama03 commited on
Commit
5be5b0f
·
1 Parent(s): 2004fdd
Files changed (1) hide show
  1. medical_ai.py +11 -2
medical_ai.py CHANGED
@@ -360,9 +360,18 @@ 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
- # Simple prompt for BioGPT (no special tokens needed)
364
  context_str = "\n".join([f"- {c}" for ctxs in contexts.values() for c in ctxs])
365
- prompt = f"You are a helpful medical AI assistant. Contexts:\n{context_str}\nQuestion: {question}\nAnswer:"
 
 
 
 
 
 
 
 
 
366
  return prompt
367
 
368
  def generate_expert_response(self, question: str, contexts: Dict[str, List[str]], lang: str = "en") -> str:
 
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
 
377
  def generate_expert_response(self, question: str, contexts: Dict[str, List[str]], lang: str = "en") -> str: