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
Bot Builder
Creating a Bot
Design
Develop
Dialog Task
Working with User Intent Node
Working with the Dialog Node
Working with Entity Node
Supported Entity Types
Working with Composite Entities
Supported Time Zones
Supported Colors
Supported Company Names
Working with Message Nodes
Working with the Confirmation Nodes
Working with Service Node
Implementing Custom Authentication
Enabling 2-way SSL for Service nodes
Working with Script Node
Working with Agent Transfer Node
Working with WebHook Node
Defining Connections & Transitions
Managing Dialogs
Prompt Editor
Action & Information Task
Working with Action Tasks
Working with Information Tasks
Establishing Flows
Alert Tasks
Working with Alert Tasks
Managing Ignore Words and Field Memory
Knowledge Graph
Terminology
Building Knowledge Graph
Generation of Knowledge Graph
Importing and Exporting Knowledge Graph
Knowledge Graph Analysis
Knowledge Extraction
Natural Language
Overview
Machine Learning
ML Model
Fundamental Meaning
Knowledge Graph Training
Traits
Ranking and Resolver
NLP Detection
NLP Settings and Guidelines
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
Talking to Bot
Utterance Testing
Batch Testing
Recording 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
Universal Bots
Defining
Creating
Customizing
Enabling Languages
Smart Bots
Defining
Sample Bots
Github
Asana
Travel Planning
Flight Search
Event Based Bot Actions
Bot Settings
Bot Functions
General Settings
PII Settings
Customizing Error Messages
Bot Management
Using Bot Variables
API Guide
API Overview
API List
API Collection
SDKs
SDK Overview
SDK Security
SDK App Registration
Kore.ai Web SDK Tutorial
Message Formatting and Templates
Mobile SDK Push Notification
Web Socket Connect & RTM
Using the BotKit SDK
Installing the BotKit SDK
BotKit SDK Configuration
Events for the BotKit SDK
Functions for the BotKit SDK
BotKit SDK Tutorial – Agent Transfer
BotKit SDK Tutorial – Flight Search Sample Bot
Using an External NLP Engine
Bot Administration
Bots Admin Console
User Management
Managing Users
Managing Groups
Managing Role
Bots Management
Enrollment
Inviting Users
Sending Bulk Invites to Enroll Users
Importing Users and User Data
Synchronizing Users from Active Directory
Security & Compliance
Overview
Using Single Sign-On
Cloud Connector
Analytics
Billing
How Tos
Context Switching
Using Traits
Live Agent Transfer
Schedule a Smart Alert
Configure Agent Transfer
Custom Dashboard
Patterns for Intents & Entities
Build Knowledge Graph
  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 can be optional and can come in any order in the user utterance.

Example: Car Sales Bot: Consider the sales inquiries to car sales. Typical queries can be of the form: ‘I am interested in 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 can come from different independent entities. Composite Entities enable you to combine these independent entities or sub-entities.

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

Various patterns like AND, OR etc. can be 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 subentities can be referenced as properties of that object, i.e. to access a subentity value you can use:
{{context.entities.<<composite_entity>>.<<sub_entity>> }}
Each of the sub-entities can be accessed using the structure they were defined, as they will be 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 }}

Creating a Composite Entity

Building a composite entity involves the following steps – creating sub-entities and establishing a relationship between these sub-entities.

Create Sub-Entities

Since the Composite entity is a combination of other entities, you first need to build the individual entities in the Dialog task. To capture the Car Type from the above example, you first need to create the sub-entities that can capture the required details. For example, here’s 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 should 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 should 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 should not be used 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 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 do so, open the Properties Panel, and under the Composite Patterns section, add relevant patterns. The various patterns that can be built are similar to the ones used in defining Entity Patterns (refer here for more)

For the above composite entity patterns, following are the sample utterances and the output:

Sample Utterance Corresponding Pattern Output
I want to buy 2018 Tesla Model S @year @make @model
"Car": {
"Year": 2018,
"Make": "Tesla",
"Model": "Model S"
}
Can you send me a quote for 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 will accept only one value for the sub-entity and not a list.

How it works

When a composite entity is reached in the dialog flow:

  • all the possible subentities from the defined composite entity patterns are identified;
  • all possible instances of those subentities 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 subentity instances captured.

What that means is that the composite entity pattern is not used to identify the subentities but to match the entire pattern.

Menu