Spaces:
Build error
Build error
json is coming back
Browse files108 unmodified lines109110111112113114115116117118119120121122123124125126127108 unmodified lines# Call LLMresponse = llm.complete(prompt)raw = getattr(response, 'text', str(response))msg = "📡 Raw LLM response received"log.append(msg)print(msg, flush=True)yield history, None, "\n".join(log)# Final assistant messageif isinstance(raw, str):try:raw = json.loads(raw)except Exception:pass # Optionally handle or log the errorassistant_msg = format_response_for_user(raw)history = history + [{"role": "assistant", "content": assistant_msg}]msg = "✅ Final response appended"108 unmodified lines109110111112113114115116117118119120121108 unmodified lines# Call LLMresponse = llm.complete(prompt)raw = responseif isinstance(raw, str):try:raw = json.loads(raw)except Exception:# If not JSON, wrap in a dict or handle gracefullyraw = {"diagnoses": [], "confidences": [], "follow_up": raw}assistant_msg = format_response_for_user(raw)history = history + [{"role": "assistant", "content": assistant_msg}]msg = "✅ Final response appended"
app.py+3-9