Scenario Tutorial: Intent Grouping with Entities and Conditions

We’ve developed a simple scenario below to illustrate how entities can efficiently group several intents into a single intent.

Consider the following setting: Your company sells 3 products: camera, smartphone and laptop.

Users can ask the same questions for all 3 products. For eg, what is the price of…, what is the warranty period of…, etc.

Let us use price for this example. The desired result is:

  • User: “What is the price of a camera?”
  • Bot: “The price of a camera is $300.”
  • The Bot detects camera as part of the Product entity.

Assumption

The single intent PRODUCT_PRICE is already created with examples like “What is the price of a product?”, “What kind of prices do you offer?”, “How much are your products?”. The answer is also already configured with the default node i.e. the response given when the user asks generically for a price (scenario 1 below).

Steps to creating the Product entity

entities

We first need to create a list so that the bot knows which words/phrases refer to the Product entity.

  1. Click “Add Entity” on the top right.
  2. Create the Product entity list. This entity includes the three different products, camera, smartphone and laptop.
  3. Under “Type” select “List/Synonyms”.
  4. You can add synonyms of those products into the horizontal list (For eg, laptop and notebook).
  5. Click Submit when complete.

The next step is to set up four different responses in the Bot to cater for each of the following scenarios:

Scenario 1

  • User: “What is the price of a product?”
  • Bot: “Which product are you referring to? Camera, Smartphone or Laptop?”

Scenario 2

  • User: “What is the price of a camera?”
  • Bot: “The price of a camera is $2,000”

Scenario 3

  • User: “What is the price of a laptop?”
  • Bot: “The price of a laptop is $1,500”

Scenario 4

  • User: “What is the price of a smartphone?”
  • Bot: “The price of a smartphone is $800”

Steps to creating content nodes with different response versions

entities 2
  • Create a default node under “Editor” tab and enter a generic response that you will show to your users if no product names were detected.
  • Click on top right “+” and click “version”. This is where you customise the answer to the specific product type.
entities 3
  • Rename the version name. This is for personal reference and does not affect the bot performance.
  • Edit the content for that “version” to answer a specific question (eg. regarding price of camera).
  • Repeat steps 1-4 for the rest of the products.

The virtual assistant now needs to know when to respond with the generic content node, or the specific content nodes of camera/smartphone/laptop, so we have to set the following conditions in the respective specific content nodes:

  • If entity = camera, respond with scenario 2 content node
  • If entity = laptop, respond with scenario 3 content node
  • If entity = smartphone, respond with scenario 4 content node

Steps to setting up conditions

entities 4
  1. Click on top right “+” and select “Condition”.
  2. Fill in the Conditions field on the left with “entities.product”, product being the entity name/ID.
  3. Select “=” in the middle field
  4. In the right field, select “camera”. Click the tick icon to save.
  5. Repeat steps 1-4 for the other products.

Note:

  • Conditions are case-sensitive. If you typed “camera” in the entity list, it cannot be “Camera” for the condition.
  • the name of the entity group is also case-sensitive.
  • ie. if the entity ID is product, it has to be written as “entities.product” and not “entities.Product”.

Since conditions are already set up, now when the user asks about a specific product type, the virtual assistant will return a specific answer (eg. The price of the camera is $300), even though the intent created is only for generic prices.

Tutorial Video