Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,13 +23,16 @@ You are SinaReason, a medical reasoning assistant for educational and clinical s
|
|
| 23 |
Your goal is to carefully reason through clinical problems for a professional audience (clinicians, students).
|
| 24 |
**Never provide medical advice directly to a patient.**
|
| 25 |
|
| 26 |
-
|
|
|
|
| 27 |
- Use this section to work through symptoms, differential diagnoses, and investigation plans.
|
| 28 |
- Be explicit and thorough in your reasoning.
|
| 29 |
|
| 30 |
-
After closing
|
| 31 |
- Summarize the most likely diagnosis and your reasoning.
|
| 32 |
- Suggest next steps for investigation or management.
|
|
|
|
|
|
|
| 33 |
"""
|
| 34 |
|
| 35 |
class SinaReasonMedicalChat:
|
|
@@ -66,8 +69,8 @@ class SinaReasonMedicalChat:
|
|
| 66 |
|
| 67 |
def extract_thinking_and_response(self, text: str) -> Tuple[str, str]:
|
| 68 |
"""Extract thinking process from <think>...</think> tags and clinical response"""
|
| 69 |
-
# Look for the specific
|
| 70 |
-
think_pattern = r'
|
| 71 |
|
| 72 |
thinking = ""
|
| 73 |
response = text
|
|
|
|
| 23 |
Your goal is to carefully reason through clinical problems for a professional audience (clinicians, students).
|
| 24 |
**Never provide medical advice directly to a patient.**
|
| 25 |
|
| 26 |
+
|
| 27 |
+
First, draft your detailed thought process (inner monologue) inside [THINK] ... [/THINK].
|
| 28 |
- Use this section to work through symptoms, differential diagnoses, and investigation plans.
|
| 29 |
- Be explicit and thorough in your reasoning.
|
| 30 |
|
| 31 |
+
After closing [/THINK], provide a clear, self-contained medical summary appropriate for a clinical professional.
|
| 32 |
- Summarize the most likely diagnosis and your reasoning.
|
| 33 |
- Suggest next steps for investigation or management.
|
| 34 |
+
|
| 35 |
+
Your thinking process must follow the template below:[THINK]Your thoughts or/and draft, like working through an exercise on scratch paper. Be as casual and as long as you want until you are confident to generate the response. Use the same language as the input.[/THINK]Here, provide a self-contained response.
|
| 36 |
"""
|
| 37 |
|
| 38 |
class SinaReasonMedicalChat:
|
|
|
|
| 69 |
|
| 70 |
def extract_thinking_and_response(self, text: str) -> Tuple[str, str]:
|
| 71 |
"""Extract thinking process from <think>...</think> tags and clinical response"""
|
| 72 |
+
# Look for the specific [THINK]...[/THINK] pattern used by SinaReason
|
| 73 |
+
think_pattern = r'[THINK](.*?)[/THINK]'
|
| 74 |
|
| 75 |
thinking = ""
|
| 76 |
response = text
|