AWS for Industries
Personalizing gamified diabetes education for children with Amazon Bedrock
Learning that your child will be impacted by diabetes for the rest of their life is hard, and teaching them how to manage the condition in a fun and productive way adds difficulty. Generative artificial intelligence (AI) now provides an opportunity to enhance educational games to be intuitive, informative, and engaging.
We’ll provide details on a proof-of-concept application that leverages the Amazon Titan large language model (LLM) through Amazon Bedrock to personalize the education of type 1 diabetes for children in a gamified setting. The intention is to integrate generative AI with serious games (games designed to teach a certain topic) to enhance available education for young children.
Diabetes, characterized by high blood sugar, affects about 1 in 9 people in the United States, including over 300,000 children with type 1 diabetes (T1D). Without proper blood sugar control, diabetes leads to significant health problems over time, such as heart disease and kidney disease.
Gamified learning experiences to teach diabetes management have been tried previously, but suffered from limitations. These included complex, action-packed gameplay that presented a high barrier for entry—especially for younger children of the ages 4-7, a peak age range for type 1 diabetes. Such games also lacked variety—with presentations of a fixed number of pre-programmed scenarios.
The T1D Learning Camp game addresses these issues by reducing the gameplay complexity and increasing the interactivity. In the game, the user plays as a dog character who has type 1 diabetes and who is going to a sleepaway camp. At the camp, they learn how to make healthy eating choices and the effects of different foods on individuals with type 1 diabetes. A character named “Dr. Robot” acts as a guide for the player throughout the camp experience.
The game is a combination of:
- text-and-response-based conversing sections
- minigame playing sections
- island exploring sections
In conversing sections, the player engages in lessons to learn about concepts such as blood sugar and the difference between high-carbohydrate “rocket food” and low-carbohydrate “train food.” They also learn about symptoms of hyperglycemia (high blood sugar) and hypoglycemia (low blood sugar). The player converses with Dr. Robot about these topics and the foods they have been eating.
Rather than needing to manually map out hundreds of potential conversation pathways to match possible user inputs, the project leverages generative AI to create tailored responses in near real time (Figure 1).
Figure 1: Dr. Robot and the player discussing current diets in a conversing section.
In playing sections (Figure 2), the child plays minigames that include gameplay mechanics such as sorting food into “rocket” and “train” categories. They also blast away symptoms with the correct type of food (rocket or train). As users successfully sort items, they are awarded points. Future iterations of the game will include virtual medals that users will obtain when surpassing particular levels of points. This reinforces the concepts presented during conversing sections and encourages continued game play.
Figure 2: Symptom Space Destroyer minigame in a playing section.
In exploring sections, players can maneuver their character around the island and traverse between the various lessons and minigames (Figure 3). As they explore, they can also locate non-player characters who chat with them.
Figure 3: A non-player character on the island talking to the player in an exploring section.
High-Level Architecture Overview
The T1D Learning Camp game is created within the Godot game engine and calls Amazon Bedrock APIs to support the conversation between characters. Due to Godot’s use of a custom programming language, gdscript, SDKs such as Python’s Boto3 are not natively integrable.
To manually start the connection, Amazon API Gateway is configured to call an AWS Lambda function using Python to invoke Amazon Bedrock APIs and return results to Godot. This mechanism of using API Gateway enables an HTTP Request node in Godot to make these requests without needing to send a required signature (Figure 4).
Figure 4: High-Level Architecture of the T1D Learning Camp game.
To achieve the personalized chats with Dr. Robot, a custom “conversation” resource in Godot stores an array of pre-written dialog, placeholders for user responses, and space for Amazon Bedrock replies.
Prompt engineering is used to allow characters to provide contextually appropriate responses with simplified language. Parameters are added to the Amazon API Gateway request module to allow LLM settings to be specified directly from Godot. The parameters length, temperature, and top-p are used to control the responses’ maximum token length, randomness, and diversity (Figure 5).
Figure 5: Conversation structure.
Additionally, Amazon Bedrock Guardrails are used to control responses provided to the player to avoid medically inaccurate and unreliable information or medication advice, such as the quantity or timing of taking insulin. Amazon Bedrock Guardrails allow for customizable safeguards on top of the native LLM protections to accept and deliver safe prompts and responses. The conversation system in T1D Learning Camp, leveraging Amazon Titan with Guardrails, is a key example of how large language models can be used in games.
Figure 6: Dr. Robot giving a response generated with Amazon Titan. This is in reply to the player asking the question, “Can I eat watermelon all the time?”
Future Improvements
Besides using Amazon Bedrock in conversing sections, generative AI can be further leveraged to enhance the content, engagement, and accessibility of T1D Learning Camp, such as through the use of Amazon Bedrock Knowledge Bases. Amazon Bedrock Knowledge Bases is a fully-managed capability that helps you implement the entire retrieval augmented generation (RAG) workflow from ingestion to retrieval and prompt augmentation. RAG would allow the LLM to create responses that include additional details from provided type 1 diabetes resources. The application could use Amazon Simple Storage Service (Amazon S3) as a data source for the Amazon Bedrock Knowledge Base using Amazon OpenSearch Service as the vector database.
Future iterations will include the use of Amazon Transcribe, an automated speech recognition and speech-to-text machine learning service, to allow users to speak with the application rather than type. This feature would lower the barrier to entry for young children who are not proficient in writing or typing and also improve accessibility for the visually impaired.
Another planned improvement is to utilize the generative AI text-to-speech capabilities of Amazon Polly to equip game characters with more natural and understandable voices. Many currently computer built-in text-to-speech voices are robotic sounding and may be difficult for a child or the hearing impaired to understand.
Finally, improvements could be made to broaden application use to non-English speaking children. Amazon Translate could translate responses from Amazon Bedrock in conjunction with the ability to generate speech in a variety of languages through Amazon Polly. Also, the Amazon Titan Image Generator foundation model could help to dynamically generate stylized artwork of any food to personalize the experience based on user input. A child’s caregiver could create a list of food specific to the child’s diet or culture, and these generated foods could be added to or replace the base set of food items. These changes could make the game more accessible to both very young children and children of different languages, cultures, and diets (Figure 7).
Figure 7: High-level architecture of planned future improvements. Amazon S3 is used as the data source for an Amazon Bedrock Knowledge Base using Amazon OpenSearch Service as the vector database. Amazon Titan Image Generator is a foundation model within Amazon Bedrock.
Conclusion
Generative AI has the potential to change the way games interact with players, including serious games for children with various medical conditions. Ultimately, the implementation of generative AI into projects like T1D Learning Camp may be able to help improve patient outcomes, providing a more personalized, engaging, and accessible experience for children with type 1 diabetes.
Contact an AWS Representative to know how we can help accelerate your business.
To learn more about AWS for Healthcare & Life Sciences—curated AWS services and AWS Partner Network solutions used by thousands of healthcare and life sciences customers globally—visit the AWS for Healthcare & Life Sciences and AWS Healthcare Solutions webpages. You can also read more blogs about AWS healthcare stories.