More than making a great business case, this chatbot was made to bring the most out of Lex. I wanted to tackle several doubts and issues I ran into while developing a previous (pet-project) chatbot, also, I wanted to really know how the Lex/Polly integration was going to work over Facebook Messenger, all of this of course while making a very fun project for one of my ever favorite artists!
What it does
It knows all about El Dorado tour (her new album), also about albums, songs, release dates, random gifs, and with the help of Polly it can recite a little snippet of a song, generated on the fly. It can handle properly such normal interactions like "hello" and "thanks", and with the help of Twinword's sentiment analysis API, it can distinguish in the same intent if a given statement is positive, neutral or negative (I love you, you are amazing! Vs. you suck, I hate you!) and respond accordingly.
Note 1: Currently this chatbot is not publicly accessible, but it can be used through Facebook ID stef.devpost.1 as it was added as a Tester.
Note 2: When in doubt of what instructions you can give to the chatbot just type examples or commands! :)
How I built it
I started by just playing around with Lex GUI in AWS Console, however, I soon realized this wasn't the most effective way to develop the chatbot. Boto3 helped me a lot there, since it allows me to create a bot from scratch with its intents, custom slot types and the associated lambda function. Little by little, I was adding more services to it... I needed some assets, so I included S3, I wanted my bot to mock some Shakira singing, so I added Polly, of course, roles and policies also where taking into account... Then I remembered about sentiment analysis and thought this could be a fit for processing how people feel about my chatbot.
Concretely, AWS Lex powers up this chatbot through 10 intents:
|Intent name||Functionality||What's interesting?|
||Creates an audio file from
||As of today, in the official Lex docs 'voice' and 'audio' are mentioned, but there aren't any examples. I wanted to include it here just to experiment the whole generate/store/reproduce flow.|
||This intent is created for the solely purpose of handling hate/love feelings towards the chatbot. I didn't want to create two intents for hate and love, so this one uses a sentiment analysis API.||Until developing this project, sentiment analysis felt to me like something very demanding and time-consuming to include in a project. Although, here I do it very simplistic, it wasn't such a hassle to implement.|
||Reply based on context (slots), uses slot validations,
||Custom slot types values generated from the datasource itself.|
||These intents provide plain simple answers, necessary to fulfill some basic "human" interactions.||IMHO, chatbots should be capable of replying to simple nice human things like "Thanks".|
Challenges I ran into
Several! And not just me, I also saw some fellow participants asking some very interesting questions on Slack and the discussion forum. Lex is a new technology, and there will be many more people using it and so I thought it was a good idea to gather (almost) all of them in this blog post
P.S. My real issue was taking too long to realize that Response cards are not rendered in the Amazon Lex Test Console!
Accomplishments that I'm proud of
I read a lot about the experiences people have had with some chatbots and I'm very proud of tackling the most painful factors for chatbot users; I saw people frustratingly trying to fetch instructions or some guidance on how to use the chatbot. Also, IMHO is not really nice to punish users for expressing as humans (aren't chatbots about it anyway?), and I mean, for example, if my chatbot successfully fulfilled a user's need, and if the user thanks the chatbot for it, the chatbot should also reply warmly to the user, I strongly believe a chatbot should handle the most basic human interactions (hello, please, thanks) and my chatbot conveys it.
Technically speaking, I'm really proud that ALL my chatbot can be setup in a few steps (Everything before the deployment in Facebook Messenger) and I do think it is a very nice reference for other people learning Lex.
What I learned
I learned a lot, both technically, because I'm really a noobie about AI, ML, DL, NLP topics, I refreshed a lot my Python, I made a great effort bringing up the chatbot as automated as possible... I made my first sentiment analysis experiment! ...And for a while now, I have a very cool pet project, really, this was a very fun challenge!
What's next for The Unofficial Shakira Chatbot
- Somewhere, I have a problem with encoding from Lex to Lambda (Not the other way around) since many of the songs have spanish accents. That really is the very next thing.
- I should find a way to receive cities in a friendlier way. As of today, people should type, for example, New York, not NYC.
- Give this bot such a personality and fluency while adding more functionalities that even Shakira herself would like to chat with it!