Chatbot Overview
Conversational Bots
Intents & Entities
Intelligent Bots
Kore.ai's Approach
Kore.ai Conversational Platform
Bot Concepts and Terminology
Natural Language Processing (NLP)
Bot Types
Bot Tasks
Starting with Kore.ai Platform
How to Access Bot Builder
Working with Kore.ai Bot Builder
Building your first Bot
Getting Started with Building Bots
Using the Dialog Builder Tool
Creating a Simple Bot
Release Notes
Latest Updates
Older Releases
Deprecations
Bot Builder
Creating a Bot
Design
Develop
Storyboard
Dialog Task
User Intent Node
Dialog Node
Entity Node
Supported Entity Types
Composite Entities
Supported Time Zones
Supported Colors
Supported Company Names
Form Node
Logic Node
Message Nodes
Confirmation Nodes
Service Node
Custom Authentication
2-way SSL for Service nodes
Script Node
Agent Transfer Node
WebHook Node
Grouping Nodes
Connections & Transitions
Managing Dialogs
User Prompts
Alert Tasks
Alert Tasks
Ignore Words and Field Memory
Digital Forms
Digital Views
Knowledge Graph
Terminology
Building
Generation
Importing and Exporting
Analysis
Knowledge Extraction
Small Talk
Action & Information Task
Action Tasks
Information Tasks
Establishing Flows
Natural Language
Overview
Machine Learning
ML Model
Fundamental Meaning
NLP Settings and Guidelines
Knowledge Graph Training
Traits
Ranking and Resolver
NLP Detection
Advanced NLP Configurations
Bot Intelligence
Overview
Context Management
Session and Context Variables
Context Object
Dialog Management
Sub-Intents
Amend Entity
Multi-Intent Detection
Sentiment Management
Tone Analysis
Sentiment Management
Default Conversations
Default Standard Responses
Channel Enablement
Test & Debug
Talk to Bot
Utterance Testing
Batch Testing
Record Conversations
Publishing your Bot
Analyzing your Bot
Overview
Dashboard
Custom Dashboard
Conversation Flows
Bot Metrics
Advanced Topics
Bot Authorization
Language Management
Collaborative Development
IVR Integration
Data Table
Universal Bots
Defining
Creating
Training
Customizing
Enabling Languages
Smart Bots
Defining
Sample Bots
Github
Asana
Travel Planning
Flight Search
Event Based Bot Actions
koreUtil Libraries
Bot Settings
Bot Functions
General Settings
PII Settings
Customizing Error Messages
Manage Sessions
Bot Management
Bot Versioning
Using Bot Variables
API Guide
API Overview
API List
API Collection
SDKs
SDK Overview
SDK Security
SDK App Registration
Web SDK Tutorial
Message Formatting and Templates
Mobile SDK Push Notification
Widget SDK Tutorial
Widget SDK – Message Formatting and Templates
Web Socket Connect & RTM
Using the BotKit SDK
Installing
Configuring
Events
Functions
BotKit SDK Tutorial – Agent Transfer
BotKit SDK Tutorial – Flight Search Sample Bot
Using an External NLP Engine
Bot Administration
Bots Admin Console
Dashboard
User Management
Managing Users
Managing Groups
Managing Role
Bots Management
Enrollment
Inviting Users
Bulk Invites
Importing Users
Synchronizing Users from AD
Security & Compliance
Using Single Sign-On
Security Settings
Cloud Connector
Analytics
Billing
How Tos
Creating a Simple Bot
Creating a Banking Bot
Transfer Funds Task
Update Balance Task
Context Switching
Using Traits
Schedule a Smart Alert
Configure Digital Forms
Add Form Data into Data Tables
Configuring Digital Views
Add Data to Data Tables
Update Data in Data Tables
Custom Dashboard
Custom Tags to filter Bot Metrics
Patterns for Intents & Entities
Build Knowledge Graph
Global Variables
Content Variables
Using Bot Functions
Configure Agent Transfer
  1. Home
  2. Docs
  3. Bots
  4. Bot Building
  5. Dialog Task
  6. Working with Composite Entities

Working with Composite Entities

Composite Entities help you capture multiple entity values in a user utterance. These multiple entity values are optional and come in any order in the user utterance.

Let us consider the below example.

Car Sales Bot: Consider the sales inquiries to car sales. Typical queries can be of the form: I am interested in the Tesla Model S 2018 model or What would a red Tesla 2010 model cost or Tell me about Tesla Model S. As you can see, the bot typically needs to process a combination of details like Make, Model, Year and Color to respond to those queries.

Each of these multiple values or details come from different independent entities. Composite Entities enable you to combine these independent entities or sub-entities.

Composite Entity Patterns: These patterns help you to establish the relationship between the sub-entities. Sub-entities are included in the composite entity using the @ tag, i.e.,@subentity in the composite entity pattern. These sub-entities must be pre-defined and should not be part of the current dialog flow. The sub-entities come from other Dialog Tasks too.

Various patterns like AND, OR, etc,. are built similar to the ones used in defining Entity Patterns (refer here for more).

The Composite Entity values take the form of a JSON object wherein the sub-entities are referenced as properties of that object, i.e. to access a sub-entity value, you can use:
{{context.entities.<<composite_entity>>.<<sub_entity>> }}
You can access each of the sub-entities using the structure they are defined, as they are accessed when used independently of the composite entity. For example, if the sub-entity is of the type Airport, then one can access the airport name thus: {{context.entities.<<composite_entity>>.<<sub_entity>>.AirportName }}

Create a Composite Entity

Building a composite entity involves the following steps:

  1. Create sub-entities
  2. Establish a relationship between these sub-entities.

Create Sub-Entities

Since the Composite Entity is a combination of other entities, you need to build individual entities in the dialog task. To capture the Car Type from the above example, you must create sub-entities that capture the required details. For example, here is a sample mapping of sub-entities for the car entity:

Related Entity Entity Type
Make List of Items: To capture the name of the car brand from the user utterance. As a developer, you must build this list in the entity.
Model List of Values: To capture the name of the model from the user utterance. As a developer, you must build this list in the entity.
Year of Make Number: To capture the year of manufacturing from the user utterance. Bots recognize numbers automatically.
Color Color: To captures the color from the user utterance. Bots recognize colors automatically.

Note: Sub-entities can only be combined into a composite entity and are recommended not to use for any other purpose in the dialog task. If you are creating sub-entities in the current dialog task, remove all transitions to these sub-entities, so that they are not a part of the dialog task flow.

Define a Composite Entity

Add a Composite Entity after a relevant node in the dialog task. To make this entity capture multiple entity values, you need to create Composite Patterns. To create, follow the below steps:

  1. On the Entity window, click the NLP Properties tab.
  2. On the NLP Properties tab, under the Composite Patterns for Entity section, add relevant patterns. The various patterns built are similar to the ones used in defining Entity Patterns (refer here for more).

    For the above composite entity patterns, the following are the sample utterances and the output:
Sample Utterance Corresponding Pattern Output
I want to buy a 2018 Tesla Model S @year @make @model
"Car": {
"Year": 2018,
"Make": "Tesla",
"Model": "Model S"
}
Can you send me a quote for the 2018 Tesla Model S preferably Red? @year @make @model preferably @color
"Car": {
"Year": 2018,
"Make": "Tesla",
"Model": "Model S"
“Color”: “Red”
}
How are the ratings for Tesla Model S? @Make @Model
"Car": {
"Make": "Tesla",
"Model": "Model S"
}

You can also define the Synonyms and Patterns as with any other entity.

Limitations

  • Sub-entity Types of String, Description, Location, and Date cannot be part of a composite entity.
  • Make sure that the sub-entities are not part of the dialog flow in the task using the composite entity.
  • If the sub-entity allows multi-items, the parent composite entity accepts only one value for the sub-entity and not a list.

Passing Values

You can pass values to composite entities using the entity pre-assignment from source Dialog tasks, refer here for more on entity pre-assignment.

In terms of composite entities following scenarios can be addressed:

  1. From composite to standard entity: Works as long as the target is of the same entity type as the one used in the source composite.
    For example, context.entities.targetMyCity = context.entities.sourceComposite.sourceTravelCity
  2. From composite to composite: As long as the target is of the same entity type as the one used in the source composite.
    For example, context.entities.sourceComposite.destinationCity = context.entities.targetCompsite.myCity
  3. From standard to composite: As long as the target is of the same entity type as the one used in the source composite.
    For example, context.entities.targetCompsite.myCity = context.entities.sourceCity

Post v8.0.07, you can use the Entity Pre-Assignments and Entity Post-Assignments from the Dialog Node, Instance Properties as shown in the image below (the numbers in the below image correspond to the number in the above use case):

JSON Object for Composite Entity

In v8.0 of the platform, the Composite Entity is enhanced to handle the JSON object as input. This helps in handling the scenarios where the enabled channels send data as a JSON object. For example, MS Teams and Cisco Spark channels. The user input received from these channels is stored as a JSON object in the Context object under the respective composite entity name.

To enable the composite entity to handle JSON object data, do not add any Patterns from the NLP Properties tab.

How it Works?

When a composite entity reaches the dialog flow:

  • If the input is received as a JSON object, the input JSON object is added to the Context object under the corresponding entity without any analysis.
  • If the input is received as a text input
    • All the possible sub-entities from the defined composite entity patterns are identified.
    • All possible instances of those sub-entities are located in the user utterance and the location recorded.
    • The composite entity patterns are then evaluated to identify the specific pattern that matches the set of sub-entity instances captured.

    i.e. the composite entity pattern is not used to identify the sub-entities but to match the entire pattern.

Menu