Using Medical Algorithms for Task-Oriented Dialogue in LLM-Based Medical Interviews