TUTORIAL ON BOT DEVELOPMENT USING AMAZON LEX
Introduction
Artificial intelligence (AI) has influenced our everyday activities by providing advanced applications and devices, called intelligent agents, which can perform various functions [1]. Intelligent agents can perform a list of tasks ranging from labor work to sophisticated operations [2]. A chatbot is an artificial intelligence program and a human computer interaction (HCI) model. Chatbots have recently become popular due to the widespread use of messaging services and the advancements of natural language processing (NLP). Natural language processing (NLP) is the ability of a computer program to understand human language as it is spoken and written [3]. Alan Turing has been considered as the father of chatbot: He is the one who developed the Turing test [4]. The timeline of the evolution of the bot is presented in table 1.
Table 1: The Timeline Evolution of Bots
S/N | AI Bots | Year |
1 | Turning Test | 1950 |
2 | Eliza | 1966 |
3 | Parry | 1972 |
4 | Racter | 1983 |
5 | Alice | 1995 |
6 | Jabberwacky | 2005 |
7 | IBM Watson | 2006 |
8 | Siri | 2010 |
9 | Google Now | 2012 |
10 | Slackbot | 2014 |
11 | Amazon Alexa | 2015 |
12 | Messenger Bot | 2016 |
In this tutorial, we will walk you through a simple bot that will aid a university inquiry process. The tools we used in this exercise are:
Amazon Lex
Amazon Lex is a service for building conversational interfaces into applications using voice and text [5]. It is powered by the same deep learning technologies that enable Amazon Alexa, allowing developers to create sophisticated, natural language chatbots quickly. Amazon Lex is ideal for creating virtual agents, customer service bots, and other interactive applications that can help automate tasks and improve user engagement [6]. The homepage of Amazon Lex is shown in figure 1. Click the link to access Amazon Lex. [Link].
After accessing the link, you sign into the console by clicking the link to the top-right of the homepage. You can sign in as a root user (full access to all services and resources in the account without any restrictions) or an IAM user (specific permissions granted by policies defined by the root user or an admin) by providing the required email address and password.
Figure 1: The homepage of Amazon Lex
Figure 2: The homepage of Amazon Lex
After signing on to the console as presented in figure 2, kindly click on Amazon Lex to get started. Click the “create bot” to initiate the bot development process. There are three creation options:
- Create a blank bot (Develop a simple bot without any predefined languages, intents, or slot types.).
- Start from an example (A sample bot comes with preset languages, intents, and slot types, which you can modify as needed.)
- Start with transcripts (Automatically create intents from uploaded conversation transcripts. Note that only the English (US) language is supported when starting with a transcript.)
We will use the “create a blank bot” option in this tutorial. Provide the name of the bot and a description. Select the IAM permissions and Children’s Online Privacy Protection Act (COPPA) options that suit you. You can configure how long a session is maintained while the user is idle.
The building blocks for chatbot development are:
- Intent: An action that the user wants to perform
- Utterances: How a user might convey the intent. These are phrases you expect a user to speak or type to invoke an intent.
- Slot: A piece of information that Amazon Lex needs to fulfil an intent. There are pre-defined slot types available on Amazon Lex. Users can also build custom slot types that match their needs.
The following steps present how to build a chatbot for university admission inquiry:
- Create a blank bot. Use all the preferred options as stated in earlier sections of this article.
- Create an intent: Provide the intent name (I prefer “admission inquiry”), and add a brief description (“an intent for admission inquiry”).
- Provide sample utterances that will invoke the “admission inquiry” intent. Here are some samples: “Hello”, “Hi”, “Admission Check”, “Inquiry”, “Admission Office” and other related phrases.
- Create slot values based on your utterances within the given intent. For example: You may want to know where the prospect/student is from, and you create a slot with the variable name “location” whose slot type is “Amazon.Country”. You must provide a prompt (see this as a trigger or clue for your users) to ensure the user understands your request. In this case, we can use this statement as a prompt: “Kindly provide your home country?”. Then one can create another slot to know the student’s preferred study campus by creating another slot with the variable name “campus” whose slot type is “Amazon.City”. The developer can see the pictorial view of the bot by clicking on the conversation flow available on the intent page as shown in figure 3. The conversation flow image for this exercise is shown in Figure 4.
Figure 3: The Homepage of the Intent page on Amazon Lex
Figure 4: The pictorial view of the conversation flow.
- Finally, the user can obtain the desired request when a fulfilment is complete. In the bot, this is done when the bot provides the university admission office URL so the user can navigate to the official site to continue the admission process.
- The option “lambda function”
- will not be treated in this tutorial however I will comment on this. The lambda function can be used to initialize and validate user input.
- After you are done with your bot development, click on the “build” button to compile the bot and you can test the bot by clicking on the “Test” button.
Conclusion
In this tutorial, we learnt how to build chatbots using Amazon Lex. The evolution of bot was discussed and concepts related to conversational AI like intent, utterances, and slots were explained. A bot development exercise was implemented to see how we could develop a bot for university admission inquiry.
References
- Adamopoulou, E., & Moussiades, L. (2020). An overview of chatbot technology. In IFIP international conference on artificial intelligence applications and innovations (pp. 373-383). Springer, Cham.
- Adamopoulou, E., & Moussiades, L. (2020). Chatbots: History, technology, and applications. Machine Learning with applications, 2, 100006.
- Zhou, M., Duan, N., Liu, S., & Shum, H. Y. (2020). Progress in neural NLP: modeling, learning, and reasoning. Engineering, 6(3), 275-290.
- Natale, S. (2021). Deceitful media: Artificial intelligence and social life after the Turing test. Oxford University Press, USA.
- Sreeharsha, A. S. S. K., Kesapragada, S. M., & Chalamalasetty, S. P. (2022). Building chatbot using amazon lex and integrating with a chat application. Interantional journal of scientific research in engineering and management, 6(04), 1-6.
- Samuel, I., Ogunkeye, F. A., Olajube, A., & Awelewa, A. (2020). Development of a voice chatbot for payment using amazon lex service with eyowo as the payment platform. In 2020 International Conference on Decision Aid Sciences and Application (DASA) (pp. 104-108). IEEE.