yasserrmd commited on
Commit
dcf1562
·
verified ·
1 Parent(s): d1595b5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -5
app.py CHANGED
@@ -24,11 +24,11 @@ Your goal is to carefully reason through clinical problems for a professional au
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
 
@@ -92,7 +92,23 @@ class SinaReasonMedicalChat:
92
 
93
  # Apply the chat template with the medical system prompt
94
  messages = [
95
- {"role": "system", "content": MEDICAL_SYSTEM_PROMPT},
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  ]
97
 
98
  # Add conversation history
@@ -151,8 +167,8 @@ class SinaReasonMedicalChat:
151
 
152
  print(partial_response)
153
  # Extract thinking and response
154
- #thinking, response = self.extract_thinking_and_response(partial_response)
155
- thinking, response =None, partial_response
156
  # Show thinking phase while it's being generated
157
  if thinking and thinking != current_thinking:
158
  current_thinking = thinking
 
24
  **Never provide medical advice directly to a patient.**
25
 
26
 
27
+ First, draft your detailed thought process (inner monologue) inside thinking tag.
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 thinking, 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
 
 
92
 
93
  # Apply the chat template with the medical system prompt
94
  messages = [
95
+ {
96
+ "role": "system",
97
+ "content": [
98
+ {"type": "text", "text": MEDICAL_SYSTEM_PROMPT[:index_begin_think]},
99
+ {
100
+ "type": "thinking",
101
+ "thinking": MEDICAL_SYSTEM_PROMPT[
102
+ index_begin_think + len("[THINK]") : index_end_think
103
+ ],
104
+ "closed": True,
105
+ },
106
+ {
107
+ "type": "text",
108
+ "text": MEDICAL_SYSTEM_PROMPT[index_end_think + len("[/THINK]") :],
109
+ },
110
+ ],
111
+ }
112
  ]
113
 
114
  # Add conversation history
 
167
 
168
  print(partial_response)
169
  # Extract thinking and response
170
+ thinking, response = self.extract_thinking_and_response(partial_response)
171
+ #thinking, response =None, partial_response
172
  # Show thinking phase while it's being generated
173
  if thinking and thinking != current_thinking:
174
  current_thinking = thinking