Create a sample BOT using SAP Conversational AI (CAI)
We recently created an Intelligent Retail Solution Mobile e-commerce similar app, where we have built a ChatBot to answer the Consumer’s Order related Query, in the same way I have created a sample Order Tracking ChatBot.
To answer to User order specific related queries, we need to enable our bot to do the following:
1. Perform simple interactions like greetings and goodbyes
2. Understand that the user is asking either
- For the specific Order Number
- Customer doesn’t remember the Order Number
3. Answer with the appropriate action
Login to SAP Conversation AI, if not registered please do register yourself (https://cai.tools.sap/)
Click on + New bot to create a new ChatBot
You can choose one or more predefined skills for you bot. This will help you get started faster.
Just select Greetings for now
Enter a name for your bot: “trackorder-bot” would be appropriate along with the description.
Select up to six topics to improve our bot training. Topics are keywords that can define our bot like “fashion”, “games” or “jobs”.
• Depending on how to the data will be used, choose the appropriate Data Policy option.
• Set English as the default language.
• You can keep your bot public since there’s no private info involved, but you can change this setting later.
We are now ready with basic settings and setup for our bot.
There are four stages for Bot Building:
1. Train – Teach your bot what it needs to understand
2. Build – Create your conversation flow with our Bot Builder tool
3. Connect – Link your bot to one or several messaging platforms
4. Monitor – Train your bot to make it sharper and get insights into its usage
1). CREATE INTENTS TO HELP OUR BOT UNDERSTAND HUMAN LANGUAGE
An intent is a collection of sentences that all have the same meaning, even though they can be worded very differently.
When a user sends some texts to our bot, our algorithm compares it to the phrases in our intents. Then it checks whether the text is close enough to one of them and decides what the intention of the message is:
• Are you a bot?
• You reply so fast, I’m sure you must be some kind of robot.
• Am I speaking to a human or not?
All bots should understand basic things such as greetings, agreement, disagreement etc.
If we chose the predefined Greetings skill when we set up our bot, we’ll already have two intents:
@goodbye and @greetings.
As SAP Conversational AI is collaborative, you don’t have to recreate each intent every time you want to use it. We can fork an intent that someone has already created to clone it right into our bot
CREATE A NEW INTENT
By creating a Custom intent we want the bot to understand when someone is asking to track an order, there can be multiple intents based on specific requirement.
As you can see, some expressions of the @track-order intent contain a tracking number. We recommend making a mix of expressions both with and without order numbers. In the expressions containing an order number, click the expression to make sure the corresponding entity is recognized (or tagged). If the bot doesn’t recognize the entity automatically, you can highlight the order number and select the #orderid entity.
This is pure training.
In the same way, multiple Intents are created.
2). TEST OUR BOT
At this stage, our chatbot should now be able to recognize when a user is asking to track their order package and extract the order number, if it exists.
Click the TEST icon near the top right of the screen. Type a sentence you haven’t used to train our bot – for example: Please track order 60291994175.
You’ll see which intent was detected under User is referring to, and you will see the recognized entity under in the expression there is. This means our bot knows that our user is asking for tracking and which order number they want to track. If the algorithm did not detect an intent or detected an invalid intent, we need to train our bot with more expressions.
3). BUILD AND MANAGE THE CONVERSATION FLOW FOR BOT
The Build tab is where you find the Bot Builder, which helps us to construct the conversation flow of our bot using skills.
A skill has four parts:
• Readme: Where you explain the purpose of your skill
• Triggers: Where you decide when the skill should be activated
• Requirements: Where you specify which information, this skill has to collect, and what questions the user needs to ask to fulfill the requirements
• Actions: Where you define what to do once the requirements are fulfilled
Click our newly created skill, then go to the Triggers tab. We want to activate our skill when an expression contained in the @track-order-2 intent is present.
Next, go to the Requirements tab and create a first requirement. Here, we’ll ask for some information that is necessary for the action to work properly.
If the order id is present and detected by our Bot, following conversation is being updated
If order id is not present, following conversation is updated
If the order id is present, BOT follows the action provided as shown below
NOTE: If the order id is present, we have updated the Memory id as shown below in the Requirement section
This is done to ensure; BOT doesn’t get confused in following two conditions:
1. When Order Id is provided by the user
2. When Order Id is not known to the user
Now our BOT is ready to be tested, train our BOT and Test:
BOT is trained now:
Case1: When Order Id is provided by the user:
Case2: When Order Id is not known to the user:
BOT is asking for LASTNAME and the Pin Code
On entering the details, BOT replies with 2 options: Yes/No
This is a sample Order Tracking BOT, we can add more functionalities and based on Intents and Actions, BOT is trained.
4). DEPLOY OUR BOT with Fiori Launch Pad on SAP Cloud Platform
Please refer link below for the same
I hope everyone enjoyed this blog and this will help you to start with ChatBot using SAP Conversational AI, please don’t forget to put comment and share and follow?