You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (entry["drug_a"].lower() ==drug_1.lower() andentry["drug_b"].lower() ==drug_2.lower()) or (entry["drug_a"].lower() ==drug_2.lower() andentry["drug_b"].lower() ==drug_1.lower()):
"instruction": "Analyze ONLY the medicines listed above. Use clinical_reference_data as supporting evidence only. Return ONLY valid JSON matching the required output schema. Do not summarize the reference data."
103
109
}, indent=2)
104
110
111
+
105
112
response=requests.post(
106
113
"http://localhost:11434/api/chat",
107
114
json={
108
115
"model": "qwen2.5",
109
116
"messages": [
110
-
{"role": "system", "content": system_prompt},
111
-
{"role": "user", "content": user_message}
117
+
{
118
+
"role": "system",
119
+
"content": system_prompt
120
+
},
121
+
{
122
+
"role": "user",
123
+
"content": f"CLINICAL REFERENCE DATA (use as evidence only, do not summarize):\n\n{retrieved_context}"
124
+
},
125
+
{
126
+
"role": "assistant",
127
+
"content": "I have reviewed the clinical reference data. I will use it as supporting evidence only. I am ready to analyze the medicines you specify and return JSON in the required schema."
128
+
},
129
+
{
130
+
"role": "user",
131
+
"content": f"Now analyze this prescription and return ONLY valid JSON:\n\n{json.dumps({'medicines': medicines, 'patient_history': {'age': patient_history.age, 'weight': patient_history.weight, 'known_allergies': patient_history.known_allergies, 'current_medications': patient_history.current_medications, 'conditions': patient_history.conditions}}, indent=2)}"
0 commit comments