3.1 Contexts

Definition :

The dictionary definition gives “Set of circumstances in which an event occurs”. In the context of our AI, the meaning is the same and in practice it is a subset of AI rules that we associate with part of our chatbot. Your ChatBot will therefore have different AIs depending on the context of the discussion.

It's also a good way to organize the rules by topic.

Exemple: In the case of our Real Estate ChatBot, we could have specific contexts for “Purchase”, “Sale”, “Rental” and “Financing”.

To activate Contexts on your chatbot, you have to do it in the advanced settings.

The main context is the “default context”. We call “Secondary Contexts” the additional contexts that you create.

The default context must always remain the main context of the chatbot.

For a Secondary Context to be taken into account / saved, it must contain at least one AI rule.

A Context is associated with a sequence in the parameters of the sequence (access by the gear icon on the far right in the title bar of the sequence in question).

The rules of a context apply as soon as a sequence to which it is associated is triggered.

In a context, if no default sequence is defined, if the AI ​​does not find a matching rule in this context, it launches a search in the default context. And if there is still no matching rule in the default context, the default response from the default context is displayed.

If a default sequence has been defined in the secondary context:

Search in the AI of the secondary context -> if no response -> Default response from the secondary context.

If a default sequence has not been defined in the secondary context:

Search in the AI of the secondary context -> if no response -> Search in the AI of the default context -> if no response -> Default response of the default context.

TIPS: Priority keywords are very useful for getting out of a Context.

Before discovering the Tunnels, we will focus on a very useful feature in the management of keywords: the Keyword Libraries.

Aide en ligne :

Introduction to the Context


3.2 Keywords Librairies

Definition :

These are sets of words that you can save and use as keywords in multiple chatbots and / or in different contexts within the same bot.

Library management is done in the AI tab of your chatbot.

To create one, make a list of Keywords or Expressions as if it were a regular AI rule but without Priority Keywords or Negative Phrases. You can then add it to any AI rule in your bots.

TIPS: the modifications are taken into account wherever the Library is used.

This feature is particularly useful when managing different bots that have the same theme.

Exemple: You are a digital agency specializing in real estate.

You could create the following Libraries:

And you will be able to use these Libraries in any bots that need to identify these types of assets.

And it also works from channel to channel. You can use your libraries on your Web chatbots and Messenger interchangeably.

Obviously, you cannot use the same Library several times within the same context.

Online help:

NLP's keywords libraries


3.3 Tunnels

Definition of a Tunnel:

This is a priority AI rule that triggers a search in another context. Optionally, an intermediate sequence can be started.

This intermediate sequence can be used, among other things, to store data in passing in a variable without displaying anything in the chatbot.

Definition of a Variable :

This is data that the chatbot will store in its memory. A variable is defined by its name and by its value.

Example: The Variable with the name “property_type” can take the value

Aide en ligne :

Tout savoir sur les variables

It is a complex logic to master, but it is a very powerful tool. It will indeed make it possible to detect several intents in the same sentence. The Tunnel in the default context detects a first Intent and then searches the AI rules of another context for the second Intent.

It is also possible to put Tunnels in the secondary context and therefore to detect a third Intent. In theory, using Cascading Tunnels you can detect as many intentions as you want in the same sentence. But from a practical point of view, it is better to limit yourself to three intentions.

The best way to understand how it works is to study a practical case.

Exemple:

Also in our London real estate chatbot, we want to detect, in natural language, the type of transaction, the type of property and the district concerned in order to be able to launch a search in an ad database.

It is therefore necessary, not only for the chatbot to understand a sentence such as “I am looking for an apartment for sale in Camden” but also to translate this information into data that can be understood by the search engine.

Cascading tunnels and their intermediate sequences will be able to solve this problem.

The general idea is to detect each intent one after the other.

We will need 3 contexts: the default context in which we will detect the “Transaction type” intention, a “Asset type” context to detect this intention and finally a “District” Context for this intention.

Default context

We create a first Tunnel “Purchase” with the keywords corresponding to this intention and which will launch a search in the Context “Type of asset”.

And we use the intermediate sequence to store the information by assigning the value "purchase" to the variable "transaction_type".

We then create a “Sale” Tunnel with the corresponding keywords and which will also launch a search in the “Type of asset” Context.

And we use the intermediate sequence to store the information by assigning, this time, the value "sale" to the variable "transaction_type".

We can therefore see that we can have 2 different tunnels which refer to the same context, but since their intermediate sequences and their keywords are different, they detect two different intentions.

The chatbot can now therefore make the difference between “I am looking to sell my apartment in Camden” and “I want to buy an apartment in camden”.

Context “Type of asset”

We create a “Apartment” Tunnel with the corresponding keywords and which will launch a search in the “District” Context.

And we use the intermediate sequence to store the information by assigning the value "apartment" to the variable "asset_type".

We then create a “House” Tunnel with the corresponding keywords and which will also launch a search in the “District” Context.

And we use the intermediate sequence to store the information by assigning, this time, the value "house" to the variable "asset_type".

The chatbot can now make the difference between “I'm looking to sell my apartment in Camden” and “I'm looking for a house for sale in Camden”

Context “District”

In this context, we create simple AI rules to detect each district, each of which will refer to sequences in which we will store the name of the district in the variable “ district".

To summarize:

In the default context, the chatbot detects the type of transaction then searches for the type of asset in the "Type of asset" context and finally detects the district in the "District" context.

And at each step, the chatbot stores the corresponding info in variables.

So if the user writes “I'm looking to buy an apartment in Camden” the chatbot will detect the intentions and translate them as follows:

  • transaction_type = purchase

  • asset_type = apartment

  • district = camden

The chatbot can then launch the search in the database because this is information that can be used by the search engine.


Detecting multiple intents in a typed sentence is a headache for all AIs around the world. With tunnels, our platform finally offers a pragmatic and effective solution to this problem.


3.4 How do I find which rules are in conflict?

The more advanced an AI, the longer the setup time and the more likely it is to have conflicting rules. Indeed, as soon as we add a new element (keyword, rule, context, tunnels), we must potentially manage all the conflicts that this generates in cascade.

To help you resolve conflicts between several rules, we still have a handy tool that are context and expression variables:

  • {{BN_ACTIVE_EXPRESSION}} qwhich displays the last Expression (or keyword) that was triggered

  • {{BN_ACTIVE_CONTEXT}} which displays the last Context that was triggered

When you identify a problem in your AI it is often because the bot gave the wrong answer. You will have a possible solution by adding a "text" element with these two variables in the sequence of the wrong answer and replicating the error. This will tell you which Key Word or Phrase triggered this response as well as the Context in which the mistake was made.

When you start to use tunnels it may happen that the ChatBot gets stuck in an infinite loop (Ex: In Context A, a Tunnel launches a search in Context B and finds another tunnel that links to the first context.)

In this case, our platform detects the problem, stops the ChatBot and displays, in the conversation, the Sequence and the Context that triggered the infinite loop.

Building deep AI is iterative work and there is no other solution than to spend a lot of time on it. It can range from a few days to several weeks depending on the complexity.

This information should therefore be taken into account when drawing up your specifications and planning.


<< Previous part Contents Next Part >>

Donwload the PDF


Did this answer your question?