Entities
1. Introduction
Entities are data points or values that you can extract from a conversation/user query. This allows you to customize what kind of information you are collecting, how you want to associate it and even add your own custom set of values if needed. Also when a group of values leads to the same answer you can use entities rather than creating FAQs for all the variables.
For Instance, the enrolment procedure for all the courses in an institute is the same. A common user query may be “How can I enrol for the Artificial Intelligence course?” Similarly, there can be a number of queries in the same context for different courses. Here rather than creating different FAQs for each subject you can create an entity set with custom values and add all the course names to it and it will give relevant answers each time the query is triggered.
1.1 Availability
This functionality is provided to all our customers. It can be accessed by clicking on the Train tab in the left panel and selecting Entities
1.2 Terms and Definitions
Terms |
Definitions |
Entity |
It is a data point or value which you can extract from a conversation/user query. This helps you to customize what kind of information you are collecting or how you want to associate it or want to add some custom value to it. For more information on entities and intents. |
FAQ |
Frequently Asked Questions (FAQs) are the standard queries relevant to a product or a service. For more information on FAQs . |
Intent |
Intention/Purpose of the user in the conversational flow. |
Context |
Based on the previous conversation of the user on the bot it maintains the relevance of the communication. |
System Defined Entities |
These are commonly used entities that are pre-defined in the system |
Custom Entities |
These are the entities that can be defined by the user as per their use case. |
2 Entity Management
2.1 Creating an entity
Click on Train and select the Entity section to manage entities. You will see a button here – “Add Entity” which launches this popup box as shown below in order for you to create an entity type for use in the conversations.
2.2 Naming your Entities
You can give any name to your entity related to the information you are collecting, for e.g – booking_date, courses, products, etc. The only restriction being you cannot add a space or a slash character in the name. Also, it cannot be the same as a built-in entity type like – number, date, time, etc. The name is important because this will be used extensively for using the extracted values in the conversation.
You can define multiple entities of the same type in cases where the usage is different or we want different values to be associated there. For example – For a travel bot, I can have booking_date and travel_date as separate entities although both are of Date and Time types.
3. Types of Entities
IF you look at the drop-down for entity types, you would see a lot of options to select from. They can be categorized as built-in or system-defined entity types or custom-defined entity types [Custom Values option].
3.1 Built-in or System entities
These are the common entity types we have seen being used and handled as a separate types so that it is convenient for the bot admins to start using these right away for the standard use-cases. All options other than the Custom Values would fall into the Built-in or system entity types. Some of the notable ones are – Number, email address, phone numbers, date and time and its different variants including duration and ranges, amount, quantity, URLs and others.
3.2 Custom entities
This is a special type of entity where you can define a type and then define values that are custom to your bot, organization or domain.
You can add the various values of a particular type in different rows, in case there are variations of a particular value, those can also be added by a comma separating those options.
In the example below, if you are building a bot for an online course site, courses will be a data type commonly used in various conversations. So, you can define the various courses listed out and then intents can be a linked-to request for a course also in which case the user input will be matched to the defined type and persisted.
4. Entities usage
Entities can be associated with FAQs primarily to look for specific pieces of data/information from the user intent. You can define which entities to look for in the particular intent. You can also define which of the entities are mandatory for the intent to qualify. If those values are not retrieved, the bot will prompt the user to enter these and only then continue to the response resolution.
Entities can also be used specifically in the Request User data section to extract the values. You can also now request for multiple entities in a single query and then the bot will intelligently associate the values appropriately as per the defined types. In case the values are missed, they can be prompted again.
Once defined, these entities can be used to associate with an intent where the information will automatically be collected as per the entity definition and be tagged to that entity. To refer to the extracted values associated with an entity anywhere in a flow, you can just do that via {{context.booking_date}}.
As we mentioned earlier, entity values can be referred to by using double braces notation {{context.booking_date}}. Some of the entity types here are complex entities and have parts to the values they contain. You can refer to them by qualifying the entity name along with the specific part. Just to highlight this aspect, let’s say we were just interested to know or use the month value of booking_date above. We can do that by using {{context.booking_date.month}}.
These options would automatically come up in the auto-complete. Here are some of the other options for a date –
4.1 Scenario
Query: How can I enrol for Machine Learning Course?
Now there may be the same procedure for enrolling in a set of subjects. Let’s say
Database Management, Artificial Intelligence, Machine learning, Data Mining, and IoT. The procedure to enrol for each of them is the same. Instead of creating 5 FAQs, you can create an Entity of type Course with the name of all the courses in it.
Creating an Entity Named Course. From Train Tab navigate to entities and click on ‘Add Entity’
Now in one FAQ, you can tag that entity
4.2 Deletion of entities
One should be very careful while deleting entities if they are being used in intent or in the paths. If these are deleted, it could lead to unstable flow behaviour or inconsistent values. Ensure that the entity to be deleted is not used anywhere in the flows or intents and then proceed for deletion.
4.3 Renaming of entities
Renaming of entities is allowed but there is a restriction that the entity must not be in use in intent or flow before, else again as is the case with delete, it might lead to inconsistent behaviour.