A Structured Prompt Design Algorithm for Contextual Health Data Extraction in Elderly Virtual Companion Systems
Abstract
As AI-based virtual companions become increasingly integral to elderly care, the ability to deliver personalized, context-aware responses remains a critical challenge. The existing frameworks proposed a centralized personal health information system. However, the integration with Large Language Models remains unspecified, since it is unclear how that information should be used when the LLM generates a response. This paper addresses this gap by proposing a six-step structured prompt design pipeline that systematically extracts and injects health data into LLM queries. The steps are intent classification, key extraction, health data retrieval, context assembly, LLM inference, and response filtering. This paper contributes a reusable prompt template. It also compares capabilities with three categories of existing approaches. The evaluated models include Llama 3.2 1B Instruct, Llama 3.2 3B Instruct, Gemma 3 4B Instruct, Qwen 3 4B Instruct, and Phi-4 Mini Instruct, all deployed locally through Ollama. The results demonstrate that the proposed algorithm addresses several limitations of existing approaches. Furthermore, the proposed approach provides a practical and replicable mechanism for enhancing the personalization of AI-based virtual companions for elderly users. Preliminary pilot findings suggest that the proposed approach shows potential for enhancing response safety. However, further empirical validation of its safety remains an important area for future investigation.
Authors: Prissadang Suta, Pornchai Mongkolnam