3

Build SAP Conversational AI Chatbot for Creating Sales Orders – Part 1: Train

 1 year ago
source link: https://blogs.sap.com/2022/05/25/build-sap-conversational-ai-chatbot-for-creating-sales-orders-part-1-train/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
May 25, 2022 4 minute read

Build SAP Conversational AI Chatbot for Creating Sales Orders – Part 1: Train

1 2 110

SAP Conversational AI is powerful platform to build chatbots. You can chat with your bot to query the weather, enjoy a joke, and even more, create a sales order. Here I’d like to share with you how to build a sales bot (for creating sales orders) using the community edition of SAP Conversational AI.  In this blog series, I’ll show you how to build a chatbot from scratch and how to let the bot call API to create a sales order (with 1 item).

1-Process-1.jpg

As the first one in a blog series, this blog post will focus on bot training. In this blog post, you’ll learn how bots understand human inputs and how to train your bots.

Note:

SAP Conversational AI is available in community and enterprise editions. You can directly access the community edition at https://cai.tools.sap/ and test almost all features. To access the enterprise edition, you need to subscribe to SAP Conversational AI using your BTP account (See Subscribe to SAP Conversational AI). Here are the differences between these two editions:

2-Enterprise-Edition-vs-Community-Edition.png

(Screenshot from Introduction | SAP Help Portal)

Now let’s get started.

Step 1: Create a new bot

1. Open https://cai.tools.sap/ and log in.

2. Click “New Bot”. Perform basic settings for the bot. The following table lists an example.

What do you want your chatbot to do? Perform Actions
Select predefined skills for your bot Don’t choose
Create your bot Your bot name: Sales Order Helper
Data Policy

Type of data: Non-personal

Store conversation data: Store

Bot visibility Private

3. Choose “Create”. The following page is displayed.

Create-Bot.png

(Some parts of the screenshot are blurred for protecting user information)

Step 2: Create intents and add expressions

Before building any business logic, we need to make the bot “understand” user input. For example, when I enter “I want to create sales order for customer 10100001”, the bot should know a sales order is expected to be created for a customer whose id is “10100001”. To achieve that, we need to create an intent and add expressions for the intent. By learning a variety of expressions, the bot is potentially equipped to perceive the intent.

1. On the “Train” tab, choose “New Intent” and enter an intent name. For example, it can be named as “create-sales-orders”.

Create-Intent.png

2. Next, add expressions for this intent and label entities in each expression.

In the following screenshot, the expression “I want to create sales order for customer 10100001, 5 PC of product TG11, sales area 1010/10/00” is added. When you expand the expression, some words have been automatically extracted as entities and labelled. For example, “5” has been detected as an entity and labeled as “Number” by default.

Also, you can create custom entities (by highlighting words or phrases) and label them as needed. For example, for business processing purposes, you can highlight “TG11” and label it as “Product”, and label “10100001” as “Soldto-Party” in a similar way.

Label-Expression-2.png

After labeling, the expression will be like:

After-Labelled-1.png

You are ready to go on once you have one expression for an intent. But for better performance, you can add more expressions. The richer expressions you have, the more precisely your bot can understand user input.

Step 3: Train the bot

Whenever you modify the expressions in an intent, the training status changes from green to yellow.

Outdated-Training.png

Click “Train” to let the bot learn from the newest expression dataset.

Step 4: Test bot processing of expressions

Okay, now the bot is ready to automatically extract the entities from user input. Is there a way to test it? The answer is of course yes. The SAP Conversational AI platform provides a convenient way to test the expressions.

Choose the “Expression Analysis” side menu (or press Shift+Alt+E).

Where-is-Expression-Analysis.png

After entering an expression, you can see extracted entities and values below.

9-Expression-Analysis.png

You can also talk with your bot after opening the “Chat Preview” side menu.

Where-is-Chat-Preview.png

Enter a sentence to test the bot directly. For now, the bot has no business logic for user input, so it will react with a fallback response, which is “I trigger the fallback skill because I don’t understand or I don’t know what I’m supposed to do…”. But you can click the yellow information button to open the JSON view of the bot.

11-Yellow-Information-Button.png

The JSON view shows the entities that have been extracted, and we will use these entities in next blog post to build the business logic.

12-JSON-View-of-Chat-Preview.png

Okay that’s all for the part 1 of our blog series. In this blog post, we learned how to let the bot get the entities from the user input and how to test the bot. Hope you enjoy it.

In the next blog post, I’ll show you how to build business logic based on the extracted entities. If you have any questions or ideas, please feel free to comment under this blog post. And also please feel free to follow this blog post or my profile to receive new article notification. See you soon 🙂

Series Navigation

Part 1: Train (Current article)

Part 2: Build (Planned)

Related Information

SAP Conversational AI

Create Your Chatbot – SAP Help Portal


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK