okkk
Browse files- 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 |
-
#
|
| 364 |
context_str = "\n".join([f"- {c}" for ctxs in contexts.values() for c in ctxs])
|
| 365 |
prompt = (
|
| 366 |
-
"You are a
|
| 367 |
-
"
|
| 368 |
-
"
|
| 369 |
-
"
|
| 370 |
-
"
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
|