gpaasch commited on
Commit
8237afe
·
1 Parent(s): 0272a23

json is not needed at all for this

Browse files
Files changed (1) hide show
  1. app.py +6 -11
app.py CHANGED
@@ -5,7 +5,6 @@ from utils.voice_input_utils import update_live_transcription, format_response_f
5
  from services.embeddings import configure_embeddings
6
  from services.indexing import create_symptom_index
7
  import torchaudio.transforms as T
8
- import json
9
  import re
10
  import logging, sys
11
 
@@ -95,11 +94,13 @@ def on_submit(symptoms_text, history):
95
  context_list.append(f"{md.get('code','')}: {md.get('description','')}")
96
  context_text = "\n".join(context_list)
97
  prompt = (
98
- f"{SYSTEM_PROMPT}\n\n"
99
- f"User symptoms: '{cleaned}'\n\n"
100
- f"Relevant ICD-10 context:\n{context_text}\n\n"
101
- "Respond with valid JSON."
 
102
  )
 
103
  msg = "✏️ Prompt built"
104
  log.append(msg)
105
  print(msg, flush=True)
@@ -114,12 +115,6 @@ def on_submit(symptoms_text, history):
114
  print(msg, flush=True)
115
  yield history, None, "\n".join(log)
116
 
117
- # Parse JSON
118
- cleaned_raw = re.sub(r",\s*([}\]])", r"\1", raw)
119
- log.append(msg)
120
- print(msg, flush=True)
121
- yield history, raw, "\n".join(log)
122
-
123
  # Final assistant message
124
  assistant_msg = format_response_for_user(raw)
125
  history = history + [{"role": "assistant", "content": assistant_msg}]
 
5
  from services.embeddings import configure_embeddings
6
  from services.indexing import create_symptom_index
7
  import torchaudio.transforms as T
 
8
  import re
9
  import logging, sys
10
 
 
94
  context_list.append(f"{md.get('code','')}: {md.get('description','')}")
95
  context_text = "\n".join(context_list)
96
  prompt = (
97
+ f"{SYSTEM_PROMPT}\n\n",
98
+ f"User symptoms: '{cleaned}'\n\n",
99
+ f"Relevant ICD-10 context:\n{context_text}\n\n",
100
+ "Respond with your top 3 ICD-10 codes and their confidence scores.\n\n",
101
+ "Think step by step and explain your reasoning.\n",
102
  )
103
+
104
  msg = "✏️ Prompt built"
105
  log.append(msg)
106
  print(msg, flush=True)
 
115
  print(msg, flush=True)
116
  yield history, None, "\n".join(log)
117
 
 
 
 
 
 
 
118
  # Final assistant message
119
  assistant_msg = format_response_for_user(raw)
120
  history = history + [{"role": "assistant", "content": assistant_msg}]