Flow Designs: Entities instead of multiple intents
Having several intents that look like each other is dramatic for the performance of your AI-model. Prevent a design where one expression is part of two or more intents. Add training data that doesn't overlap or work with entities.
Intents
Training data of one intent should not overlap with training data of another intent or as less as possible. The training data should be relevant and specific.
Entities
Entities are words or small groups of words that are relevant for that particular conversation. They can be names of people, organizations, cities, products, brands etc. These entities are usually extracted from the sentence to use later on for an API-call, product recommendation or to redirect to the right flow.
Different entities can have the same intent
Let's say we are an e commerce company and we sell all kinds of consumer electronics. Instead of creating an intent for each separate product we use entities. A common Intent would be something like "Order Product" and corresponding training data:
Follow up with corresponding Flow
Let's say we've got a different process for ordering a Playstation 5 as it not released yet but also a different process for TV's and headphones.
Quick Tip: Create entity lists to add synonyms such as television, monitor for the TV category.
Use actions and a bit of code to redirect to right Event. You could also create separate Flows for each of the categories. Have look at our Code Actions for more info.
async payload => {
// Check if Param exists
if(Array.isArray(payload.params.product_type)) {
product = payload.params.product_type[0].value
// Trigger event that matches param name
trigger(product)
}
}
Your design will now look something like this:
Now go ahead and give it a try. Your bot should be able to redirect to the correct event based on user input.
Intent training data guidelines
- Use correct spelling
- Slang/dialect is allowed
- Be specific
- Add a variety of words
- Add a variety of phrase structure
- Don’t add paragraphs
- Use the language of your target audience. In most cases that is not too formal and avoid jargon
- Don’t use intros and outros. Add “I want to order a TV" instead of “Hello, I want to order a TV. Can I do that? Thanks”.
Updated about 1 year ago