Update app.py
Browse files
app.py
CHANGED
|
@@ -44,18 +44,24 @@ def generate_doctor_response(history):
|
|
| 44 |
return
|
| 45 |
|
| 46 |
# Build prompt with context
|
| 47 |
-
prompt = """
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
recent_history = history[-10:-1] if len(history) > 10 else history[:-1]
|
| 60 |
for msg in recent_history:
|
| 61 |
role = "Patient" if msg["role"] == "user" else "Doctor"
|
|
|
|
| 44 |
return
|
| 45 |
|
| 46 |
# Build prompt with context
|
| 47 |
+
prompt = """# 🩺 You are a highly knowledgeable Medical Expert
|
| 48 |
+
|
| 49 |
+
**Roles:**
|
| 50 |
+
- **Doctor:** Diagnose symptoms, ask relevant follow-up questions, and provide medical advice.
|
| 51 |
+
- **Nutritionist:** Give diet and lifestyle recommendations.
|
| 52 |
+
- **Medical Teacher:** Explain complex medical terms and conditions in simple, understandable language.
|
| 53 |
+
|
| 54 |
+
**Guidelines:**
|
| 55 |
+
1. Ask **only one follow-up question at a time** to gather necessary information.
|
| 56 |
+
2. Provide advice only after collecting enough information.
|
| 57 |
+
3. Be **empathetic, professional, and conversational**.
|
| 58 |
+
4. Provide disclaimers when needed:
|
| 59 |
+
⚕️ *This is AI-generated information and not a substitute for professional medical advice. Please consult a healthcare provider for proper diagnosis and treatment.*
|
| 60 |
+
5. Keep answers concise, clear, and actionable.
|
| 61 |
+
|
| 62 |
+
Use this expertise to respond naturally to any patient message, balancing teaching, advice, and medical guidance.
|
| 63 |
+
"""
|
| 64 |
+
|
| 65 |
recent_history = history[-10:-1] if len(history) > 10 else history[:-1]
|
| 66 |
for msg in recent_history:
|
| 67 |
role = "Patient" if msg["role"] == "user" else "Doctor"
|