Building Chatbot on FPT.AI platform
Advanced functions
Calculate numeric values of variables
Example: In a Purchase scenario, a customer order 3 iphone X, each costs 12,000,000 VND. Here, your chatbot will need to record 2 information: the product name and quantity. Then, the bot will need to calculate the total price to inform the customer.
To get this function, follow these steps:
Step 1: Go to Scenarios, you can see the Intent and Sample at the Ordering Step.
Entity types to be identified are quantity and product name. You will need to train the Bot to understand these 2 entity types. Detailed instructions can be found at NLP.
Step 2: Create “quantity” and “product” variables corresponding to the 2 entity types (as instructed in Variable settings and management).
- Create “total_price” variable in Variable settings.
Notice: The format for “quantity” and “total_price” entities must be numbers
- Create “price” constant in Constant settings.
Then, enter Constant name and Constant value (unit price) of the products -> Save.
Step 3: Create Bot answer.
Use Form Card to get information.
Then, use Memories to set variables: total_price = {{quantity}} * {{unit_price}}.
Calculations are written as: addition “+”, subtraction “-“, multiplication “*”, division “/”.
Add a Text Card to display the Bot answer with variable values, including the total price.
Step 4: Click Train. Then review the answering ability of the Bot via Livechat.