Spaces:
Sleeping
Sleeping
priyansh-saxena1 commited on
Commit ·
eb1b955
1
Parent(s): 2ea503f
fix: added new code
Browse files- app/graph.py +0 -30
- app/llm.py +2 -1
app/graph.py
CHANGED
|
@@ -160,36 +160,6 @@ def agent_node(state: IntakeState) -> dict:
|
|
| 160 |
}
|
| 161 |
|
| 162 |
|
| 163 |
-
def scribe_node(state: IntakeState) -> dict:
|
| 164 |
-
"""Build the final ClinicalBrief from the accumulated CombinedOutput state."""
|
| 165 |
-
state_json = state.get("clinical_state", "{}")
|
| 166 |
-
data = CombinedOutput.model_validate_json(state_json)
|
| 167 |
-
|
| 168 |
-
from datetime import datetime, timezone
|
| 169 |
-
|
| 170 |
-
brief = ClinicalBrief(
|
| 171 |
-
chief_complaint=data.chief_complaint or "Not specified",
|
| 172 |
-
hpi=HPI(
|
| 173 |
-
onset=data.onset or "Not specified",
|
| 174 |
-
location=data.location or "Not specified",
|
| 175 |
-
duration=data.duration or "Not specified",
|
| 176 |
-
character=data.character or "Not specified",
|
| 177 |
-
severity=data.severity or "Not specified",
|
| 178 |
-
aggravating=data.aggravating or "Not specified",
|
| 179 |
-
relieving=data.relieving or "Not specified",
|
| 180 |
-
),
|
| 181 |
-
ros=data.ros,
|
| 182 |
-
generated_at=datetime.now(timezone.utc).isoformat().replace("+00:00", "Z"),
|
| 183 |
-
)
|
| 184 |
-
|
| 185 |
-
return {
|
| 186 |
-
"messages": [{"role": "assistant", "content": "Your clinical summary is ready. Please wait for the doctor."}],
|
| 187 |
-
"current_node": "done",
|
| 188 |
-
"frontend_stage": "done",
|
| 189 |
-
"clinical_brief": brief.model_dump(),
|
| 190 |
-
}
|
| 191 |
-
|
| 192 |
-
|
| 193 |
# -------------------------------------------------------------- graph build --
|
| 194 |
|
| 195 |
def build_graph():
|
|
|
|
| 160 |
}
|
| 161 |
|
| 162 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
# -------------------------------------------------------------- graph build --
|
| 164 |
|
| 165 |
def build_graph():
|
app/llm.py
CHANGED
|
@@ -42,6 +42,7 @@ class CombinedOutput(BaseModel):
|
|
| 42 |
aggravating: str | None = None
|
| 43 |
relieving: str | None = None
|
| 44 |
ros: dict[str, list[str]] = {}
|
|
|
|
| 45 |
reply: str = ""
|
| 46 |
|
| 47 |
|
|
@@ -186,7 +187,7 @@ class OllamaLLM:
|
|
| 186 |
response = requests.post(self.api_url, json=payload, timeout=60)
|
| 187 |
response.raise_for_status()
|
| 188 |
data = response.json()
|
| 189 |
-
raw = data.get("
|
| 190 |
except Exception as e:
|
| 191 |
print(f"[Ollama] ERROR calling local Ollama API: {e}")
|
| 192 |
print("[Ollama] Make sure Ollama is installed and running, and the model is downloaded!")
|
|
|
|
| 42 |
aggravating: str | None = None
|
| 43 |
relieving: str | None = None
|
| 44 |
ros: dict[str, list[str]] = {}
|
| 45 |
+
emergency: bool = False
|
| 46 |
reply: str = ""
|
| 47 |
|
| 48 |
|
|
|
|
| 187 |
response = requests.post(self.api_url, json=payload, timeout=60)
|
| 188 |
response.raise_for_status()
|
| 189 |
data = response.json()
|
| 190 |
+
raw = data.get("message", {}).get("content", "").strip()
|
| 191 |
except Exception as e:
|
| 192 |
print(f"[Ollama] ERROR calling local Ollama API: {e}")
|
| 193 |
print("[Ollama] Make sure Ollama is installed and running, and the model is downloaded!")
|