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