Wednesday, 27 February 2019

Building chat-bot with SAP Conversational AI & SAP Products

Introduction


I’m going to show you a chat-bot which can help HR search employee’s salary by name and employee number on specific date.

On the high-level, I’ll need to do:

1. Create SAP UI 5 on SAP Cloud Platform
2. Create SAP Conversational AI chat-bot
3. Create server REST APIs to help chat-bot query database.
4. Create Two tables(people and salary) in SAP HANA

For this post, I will focus on the chat-bot side.
SAP HANA Tutorial and Material, SAP Study Materials, SAP HANA Certifications

It’s very easy to build your bot by leveraging SAP Conversational AI. You just need four steps!

SAP HANA Tutorial and Material, SAP Study Materials, SAP HANA Certifications

The first step is training your bot, helping it to know what do you say. Here, “Intents” means the concept of which is designed to trigger “Skills”.

For example, “I wanna know the salary” and “show me the salary” means the same intent — “salary ”. On the other hand, “Entities” means the words like “person”, “number”, “date-time”.

SAP HANA Tutorial and Material, SAP Study Materials, SAP HANA Certifications

Second, “skills” — after your chat-bot understand what do you say, you need to create your conversational flow with builder tool. You can let chat-bot take actions here.

SAP HANA Tutorial and Material, SAP Study Materials, SAP HANA Certifications

For here, we need to set up web-hook which is meaning your chat-bot can request to your APIs and get the responses!

If you choose using SAP HANA and developing with Python. You also need to open-db-tunnel at the same time when you query data from HANA.

SAP HANA Tutorial and Material, SAP Study Materials, SAP HANA Certifications

Also, you need to make sure your REST APIs are good to respond. You can use software like Postman to check.

SAP HANA Tutorial and Material, SAP Study Materials, SAP HANA Certifications

We can use ngrok to help us connect our localhost APIs via the Internet. (Don’t forget to set it in setting page)

SAP HANA Tutorial and Material, SAP Study Materials, SAP HANA Certifications

Third, just choose the platform which you want to deploy!

SAP HANA Tutorial and Material, SAP Study Materials, SAP HANA Certifications

Finally, the last step is helping you to trace what did your chat-bot receive and what kind of skills did it trigger.

SAP HANA Tutorial and Material, SAP Study Materials, SAP HANA Certifications

Results:

Let me show the tables I created on SAP HANA here. We can see there’s an employee named tim cook and his employee_id is i000000 with several salary data.

SAP HANA Tutorial and Material, SAP Study Materials, SAP HANA Certifications

Let’s focus on salary on January 2019, it’s 9999.

SAP HANA Tutorial and Material, SAP Study Materials, SAP HANA Certifications

You can see payment date 2019–01–01 is 9999 in each query.

SAP HANA Tutorial and Material, SAP Study Materials, SAP HANA Certifications

Let’s change the salary to 13579!

SAP HANA Tutorial and Material, SAP Study Materials, SAP HANA Certifications

SAP HANA Tutorial and Material, SAP Study Materials, SAP HANA Certifications

Woohoo, It shows 13579!

2 comments: