During the pandemic, I wanted to create an Alexa skill that would help entertain my elderly mother and others like her, to help keep her mind occupied and assist in coping with loneliness. The Aging and Engaging competition provided the chance to finally do this. My Friend SAGE was inspired by a newspaper article I read about ELIZA, an early natural language processing computer program created in 1964 and widely regarded as a prototype AI. The program was able to convince people into thinking they were chatting with a real person. I decided to use the original conversational techniques deployed by ELIZA, but deliver them with 21st-century AI technology.

What could be more engaging than a friendly chat?

What it does

MY FRIEND SAGE is an easy-to-use self-improvement skill to entertain seniors who want to stay sharp mentally. SAGE delights users with always-available human-like, personalized, contextual, short, friendly, chat. Every conversation is UNIQUE!.

You can talk about anything you like, but you will have the best conversations with SAGE by talking about yourself and sharing your feelings. For example, you might say; "Sage I'm feeling great", or you might say;"I'm feeling a bit down today Sage". SAGE uses world-class AI, to flex, accommodate and process complex human input into delightfully, contextualized, person-centric, responses.

New users on another person's device can also be engaged by introducing themselves into the conversation. The new user can simply say something like “My name is not John, It's Jack” and the personalization of context by the AI is instantly updated.

Returning users are quickly re-engaged, easily invoking personalized conversations from outside of the skill. For example, if the user starts their own conversation by saying "Alexa tell My Friend Sage I’m feeling a bit lonely today ” or "Alexa Ask My Friend Sage For A Chat ” the user will immediately be re-immersed in a personalized, contextualized conversation.

In order to help scale, attention retention, and encourage frequent usage, conversations are kept to 3 minutes. After this time SAGE politely excuses itself and quits the conversation.

In conclusion, SAGE provides engaging, entertaining, friendly chats to help keep minds stimulated and sharp. Just like with humans, every conversation is unique!

How I built it

The skill was built entirely by myself using the Jovo platform to create the Alexa skill in javascript. The business logic is stored on Lambda while a small amount of user data is held in a DynamoDb table.

I used the OpenAi API with the Davinci endpoint for the AI component. By researching therapeutic techniques online I crafted specialized conversational prompts to start contextual conversations. In addition, I developed a method to dynamically inject the prompts with user names to personalize these conversations.

I used APL to highlight and make further accessible the responses given by SAGE. Video backgrounds are used in order to enhance the feeling of a dynamic rather than static experience.

Alexa's Progressive response method was used with an array of responses while the API was called, to help keep the conversation feeling like it was taking place at human speed.

I also built a content filter to moderate conversations and ensure that we are able to meet certification guidelines for Alexa. A special intent was also devised to protect against unwanted “prompt injection” attacks.

Timed functionality is built in to keep conversations to a length of 3 minutes (assisting in keeping dev costs down and keeping user interest maintained)

Challenges we ran into

To invoke a chat with AI is relatively easy, but making a “safe” moderated and robust chatbot that is financially efficient, but still able to hold context and personality is much more difficult. As well as passing the requirement for moderation in the Alexa certification process, OpenAi requires you to have your application approved by them before going into a live production environment. This requires that care is taken to use conversational filtering and to moderate your application against misuse, in order to conform to their stringent AI safety guidelines. I was pleased to pass both Alexa certification and gain approval from OpenAi in the final week of the challenge.

Challenges included getting API responses fast enough to respond to the users in a “conversation manner” and ensuring all responses are returned before Alexa times out. I tested out a number of different AI engines and even tried using a version of the original ELIZA program, which was surprisingly good at conversing. Keeping the context, while keeping token usage down. Capturing the full meaning of the user's answers within the limitations of the AMAZON.SearchQuery built-in slot also presented some issues.

Accomplishments that we're proud of

While the skill contains APL, it delivers an equally engaging and delightful in a "voice-only" or "voice-first" environment, which I believe to be the litmus test of all conversational applications. Using a skill set of conversational design techniques I have learned over the last few years to produce a personalized and well-paced conversation that is not repetitive and is close enough to human style to make users, including myself, feel like they are talking with another person. In particular, I was proud of achieving personalized content returned by the AI by dynamically injecting user names into the prompts

What we learned

I found the best Alexa skills do one thing and do it very well - after all, you wouldn’t expect a Weatherbot to play chess with you! I initially had some ideas around including gamification, but quickly ditched them to focus on making best-in-class conversational ai.

Using AI has a financial cost associated with it. Without careful consideration of these costs and a monetization plan, a successful skill could end up costing you a lot of money!

I had very a very enjoyable experience building this skill. During testing, I had some wonderful, natural, and delightful conversations with the AI. Working with AI is unpredictable but incredibly rewarding. I believe we are truly moving from chatbots to conversational AI. Talking with AI can be engaging, entertaining, and fun - AI sometimes has a sense of humor - or at least it would appear so!

What's next for My Friend Sage

To assist in improving and exercising users' recall and memory, I intend to experiment with storing more contextual information, so users, if they wish, may return to a previous topic of conversation. Monetization via Alexa ISP is also planned.

Built With

Share this project: