To restrict when an intent is used based on particular rules (mandatory/forbidden words, opening hours, previously visited intents) use Necessary Conditions to make sure the chatbot only answers this way when you want it answered this way.
Necessary conditions help the chatbot AI to determine if a certain intent should be used in an answer or not.
Let's say somebody is having a conversation with your chatbot about your store and they ask you if your store is open. You could have two intents to answer this question:
- We are currently open until 17:00 today. Feel free to drop by!
- We're closed at the moment. Our opening hours are Mon-Fri, 08:00-17:00.
For the AI, these two intents might trigger very similar probability matches based on the language used by your customer. A Necessary Condition intent will allow the AI to pick one right answer with certainty.
The Maths: How intents matching works
When the chatbot AI examines your customer question with all the example questions or keywords across intents, it assigns a match score to each and picks the highest score, provided it is above a certain number.
The above two intents in the example would have match scores between 90-100% when the customer asks the question "When are you open?".
A necessary condition will differentiate which answer to use for the customer. It works like a multiplier.
If the customer asks the question during the day; while both questions get a 90% match score, only the first one should be used to answer the customer.
- The first intent is multiplied by 1 during opening hours (90 x 1 = 90)
- The second intent is multiplied by 0 during opening hours (90 x 0 = 0)
You can put a Necessary Condition on the first intent to say it should only be used during Opening Hours, and the second, only when outside of Opening Hours.