mirror of
https://dev.azure.com/globalhealthx/EMR/_git/helix-engage-server
synced 2026-05-18 20:08:19 +00:00
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Bug 553 (partial) — AI Panel 'Patient History' returned 'not in system' even though the caller had 7 calls + an appointment. The model was hallucinating instead of chaining lookup tools. UUID safety: LLMs drop hyphens / swap chars on 36-char ids once the context wears thin. To keep the model off the UUID path for 'this caller' questions: - lookup_appointments, lookup_call_history, lookup_lead_activities now accept their id arguments OPTIONALLY - when omitted, the sidecar resolves leadId from ctx and patientId from the lead record (cached per-request) - new lookup_lead_activities tool rounds out the patient-history trio (call history + activity log + appointments) System prompt (ccAgentHelper) tightened: - chain call history + activities + appointments for history questions - call lookup tools with NO arguments when using the current caller - don't re-type UUIDs seen in CURRENT CONTEXT - say 'feature not set up yet' when KB section is empty (packages, etc.) instead of 'I couldn't find that' All agent tools now emit structured [AI-TOOL] trace lines with full UUIDs printed — tail sidecar logs to see which tool the model chose, whether the model passed an id or used the context fallback, and how many records came back. If the model ever hallucinates a UUID, the resolved= field on the log line will echo it and count=0 will flag the miss immediately.