Scenario Tutorial: Intent Grouping with Entities and Conditions

Updated on January 20, 2022

We’ve developed a simple scenario below to illustrate how entities can efficiently group several intents into a single intent, then provide versioned Bot responses with conditions.

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
  1. 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.
  2. Click on top right “+” and click “version”. This is where you customise the answer to the specific product type.
    entities 3
  3. Rename the version name. This is for personal reference and does not affect the bot performance.
  4. Edit the content for that “version” to answer a specific question (eg. regarding price of camera).
  5. Repeat steps 1-4 for the rest of the products.

The Bot 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 bot 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

Did we help you?

Learn more about KeyReply

To see our Conversational AI in action, sign-up for a guided walk-through and see how our platform can be tailored for your organization’s needs