OVERVIEW
Virtual Assistants
Kore.ai Platform
Key Concepts
Natural Language Processing (NLP)
Accessing Platform
VIRTUAL ASSISTANTS
Virtual Assistant Builder
Virtual Assistant Types
Getting Started
Create a Simple Bot
SKILLS
Storyboard
Dialog Tasks
Introduction
Dialog Builder (New)
Dialog Builder (Legacy)
User Intent Node
Dialog Node
Entity Node
Supported Entity Types
Composite Entities
Supported Colors
Supported Company Names
Form Node
Logic Node
Message Nodes
Confirmation Nodes
Bot Action Node
Service Node
Custom Authentication
2-way SSL for Service nodes
Script Node
Agent Transfer Node
WebHook Node
Grouping Nodes
Connections & Transitions
Manage Dialogs
User Prompts
Knowledge Graph
Terminology
Building
Generation
Importing and Exporting
Analysis
Knowledge Extraction
Train
Build
Alert Tasks
Introduction
Ignore Words and Field Memory
How to Schedule a Smart Alert
Small Talk
Digital Views
Introduction
How to Configure Digital Views
Digital Forms
Overview
How to Configure Digital Forms
NATURAL LANGUAGE
Overview
Machine Learning
Introduction
Model Validation
Fundamental Meaning
Introduction
NLP Guidelines
Knowledge Graph
Traits
Introduction
How to Use Traits
Ranking and Resolver
Advanced NLP Configurations
INTELLIGENCE
Overview
Context Management
Overview
Session and Context Variables
Context Object
How to Manage Context Switching
Manage Interruptions
Dialog Management
Sub Intents & Follow-up Intents
Amend Entity
Multi-Intent Detection
Sentiment Management
Tone Analysis
Sentiment Management
Event Based Bot Actions
Default Conversations
Default Standard Responses
TEST & DEBUG
Talk to Bot
Utterance Testing
Batch Testing
Record Conversations
Conversation Testing
CHANNELS
PUBLISH
ANALYZE
Overview
Dashboard
Custom Dashboard
Overview
How to Create Custom Dashboard
Conversation Flows
NLP Metrics
ADVANCED TOPICS
Universal Bots
Overview
Defining
Creating
Training
Customizing
Enabling Languages
Store
Smart Bots
Defining
koreUtil Libraries
SETTINGS
Authorization
Language Management
PII Settings
Variables
Functions
IVR Integration
General Settings
Management
Import & Export
Delete
Bot Versioning
Collaborative Development
Plan Management
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
ADMINISTRATION
HOW TOs
Create a Simple Bot
Create a Banking Bot
Transfer Funds Task
Update Balance Task
Context Switching
Using Traits
Schedule a Smart Alert
Configure UI 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
RELEASE NOTES

グローバル変数の使用方法

Kore.ai Botプラットフォームは、Bot内で変数を宣言および使用する方法を提供します。これらの変数を使用すると、別のタスク、ノードおよびその他のBot要素で一般的に使用される値を取得できます。このハウツーでは、Bot変数を使用できるバンキングBotでシナリオを調査します。グローバル変数をどのように使用して、APIエンドポイントをパスし、開発からテストおよび本稼働環境に移行するときに簡単に変更できるかを確認します。Bot変数とは何か、およびKore.ai Botプラットフォームでの実装方法の詳細については、こちらを参照してください。コンテンツ変数での使用ケースについては、こちらを参照してください

例題

当社のバンキングBot には、以下の2つのタスクがあります。

  1. 残高の確認、指定口座番号でサービスを呼び出し、そのアカウントの残高を確認します。
  2. 残高を更新、サービスを呼び出し、指定した金額で指定口座を更新します。
  3. 上記のタスクはどちらも同じサービスを呼び出し、サービスAPI エンドポイントは開発、テストおよび本稼働環境用に変更されます。
  4. どちらのダイアログタスクにおけるサービス呼び出しの変更も面倒で、変更が正しく行われないとエラーになります。

この文書では、どのようにグローバル変数を使用してAPIエンドポイントを格納でき、サービス呼び出しに使用できるかを確認します。

Pre-requisites

  • Botビルドナレッジ
  • 以下で述べるダイアログ付きバンキングBot。
    • 残高の確認 – ユーザーに口座番号をプロンプト表示し、口座で使用できる残高を表示するダイアログタスク。
    • 口座を更新 – ユーザーに更新する必要がある口座番号、更新される金額、金額を入金または出金して口座残高を更新する必要があるかどうかをプロンプト表示するダイアログタスク。

導入

グローバル変数を宣言してAPIエンドポイントを保持すると、移行を簡単かつ迅速にする上で役立ちます。

  1. バンキングBot を開きます。
  2. 設定 -> 構成設定から、 グローバル変数セクションを選択します。
  3. グローバル変数の追加をクリックし、対応するウィンドウを開きます。
  4. 変数名変数値を入力します。この使用ケースでは、変数 accountURL と、サービスAPIコールエンドポイントを入力する値を呼び出します。
  5. 保存します。
  6. ここで、残高の確認ダイアログタスクを開きます。
  7. GetAccountBalanceサービスノードを選択します。
  8. リクエストの定義リクエストの編集をクリックします。
  9. リクエストURLを上で作成したグローバル変数と置き換えます。env プレフィックスに続き、パラメータが必要です。この場合は、 {{env.accountURL}}{{context.entities.AccountNumber}}
  10. 残高を更新ダイアログタスクを繰り返します。
  11. ここで、Botを別の環境にエクスポートおよびインポートするときには、グローバル変数の変更内容のみを心配する必要があり、変更内容は両方のダイアログタスクで有効になります。
OVERVIEW
Virtual Assistants
Kore.ai Platform
Key Concepts
Natural Language Processing (NLP)
Accessing Platform
VIRTUAL ASSISTANTS
Virtual Assistant Builder
Virtual Assistant Types
Getting Started
Create a Simple Bot
SKILLS
Storyboard
Dialog Tasks
Introduction
Dialog Builder (New)
Dialog Builder (Legacy)
User Intent Node
Dialog Node
Entity Node
Supported Entity Types
Composite Entities
Supported Colors
Supported Company Names
Form Node
Logic Node
Message Nodes
Confirmation Nodes
Bot Action Node
Service Node
Custom Authentication
2-way SSL for Service nodes
Script Node
Agent Transfer Node
WebHook Node
Grouping Nodes
Connections & Transitions
Manage Dialogs
User Prompts
Knowledge Graph
Terminology
Building
Generation
Importing and Exporting
Analysis
Knowledge Extraction
Train
Build
Alert Tasks
Introduction
Ignore Words and Field Memory
How to Schedule a Smart Alert
Small Talk
Digital Views
Introduction
How to Configure Digital Views
Digital Forms
Overview
How to Configure Digital Forms
NATURAL LANGUAGE
Overview
Machine Learning
Introduction
Model Validation
Fundamental Meaning
Introduction
NLP Guidelines
Knowledge Graph
Traits
Introduction
How to Use Traits
Ranking and Resolver
Advanced NLP Configurations
INTELLIGENCE
Overview
Context Management
Overview
Session and Context Variables
Context Object
How to Manage Context Switching
Manage Interruptions
Dialog Management
Sub Intents & Follow-up Intents
Amend Entity
Multi-Intent Detection
Sentiment Management
Tone Analysis
Sentiment Management
Event Based Bot Actions
Default Conversations
Default Standard Responses
TEST & DEBUG
Talk to Bot
Utterance Testing
Batch Testing
Record Conversations
Conversation Testing
CHANNELS
PUBLISH
ANALYZE
Overview
Dashboard
Custom Dashboard
Overview
How to Create Custom Dashboard
Conversation Flows
NLP Metrics
ADVANCED TOPICS
Universal Bots
Overview
Defining
Creating
Training
Customizing
Enabling Languages
Store
Smart Bots
Defining
koreUtil Libraries
SETTINGS
Authorization
Language Management
PII Settings
Variables
Functions
IVR Integration
General Settings
Management
Import & Export
Delete
Bot Versioning
Collaborative Development
Plan Management
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
ADMINISTRATION
HOW TOs
Create a Simple Bot
Create a Banking Bot
Transfer Funds Task
Update Balance Task
Context Switching
Using Traits
Schedule a Smart Alert
Configure UI 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
RELEASE NOTES

How to use Global Variables

Kore.ai bots platform provides a way to declare and use variables within the bot. These variables can be used to capture values that are commonly used by different tasks, nodes, and other bot elements

In this How-To, we will explore a scenario in a Banking Bot, where Bot Variables can be used. We will see how Global Variables can be used to pass API endpoints and change them easily when migrating from development to testing to production environments.

For details on what Bot Variables are and how they are implemented in the Kore.ai Bots platform, refer here. For a use case with Content Variables, refer here.

Problem Statement

In our Banking Bot, we have two tasks:

  1. Get Balance which makes a service call with a given account number to get the balance in that account
  2. Update Balance which makes a service call to update a given account with the specified amount.
  3. Both the above tasks call the same service and the service API endpoint changes for development, testing, and production environments.
  4. Changing the service call in both the Dialog Tasks is cumbersome and leading to errors, if the change is not done properly.

In this document, we will see how Global Variable can be used to store the API endpoint and use it for the service calls.

Pre-requisites

  • Bot building knowledge
  • A Banking Bot with the dialogs as mentioned below:
    • Get Balance – Dialog task prompting the user for their Account Number and displaying the available balance in the account.
    • Update Account – Dialog task prompting the user for Account Number that needs to be updated, the Amount to be updated and whether the amount needs to be credited or debited and updating the Account balance accordingly.

Implementation

Declaring a Global Variable to hold the API endpoint will help the transition easier and faster.

  1. Open the Banking Bot.
  2. Select the Build tab from the top menu
  3. From Configurations select the Environment Variables section.
  4. Click Add Variable to open the corresponding window.
  5. Enter Variable Name and Variable Value. For this use case, were are calling the Variable accountURL, and for value, we are entering the Service API call endpoint.
  6. Save.
  7. Now open the Get Balance Dialog Task.
  8. Select the GetAccountBalance Service Node.
  9. Click Edit Request under the Request Definition
  10. Replace the request URL with the Global Variable created above. using the env prefix followed by any parameters needed. In this case:
    {{env.accountURL}}{{context.entities.AccountNumber}}
  11. Repeat for Update Balance Dialog Task.
  12. Now when you Export and Import the Bot to another environment, all you need to worry about is to change the value of the Global Variable and the changes will be effective in both the Dialog Tasks.