はじめに
対話型AIプラットフォーム
チャットボットの概要
自然言語処理(NLP)
ボットの概念と用語
クイックスタートガイド
プラットフォームへのアクセス
ボットビルダーの操作
リリースノート
最新バージョン(英語)
以前のバージョン(英語)
廃止機能(英語)
コンセプト
設計
ストーリーボード
ダイアログタスク
ダイアログタスクとは
ダイアログビルダー
ノードタイプ
インテントノード
ダイアログノード
エンティティノード
フォームノード
確認ノード
ロジックノード
ボットアクションノード
サービスノード
Webhookノード
スクリプトノード
グループノード
エージェント転送ノード
ユーザープロンプト
音声通話プロパティ
イベント ハンドラー
ナレッジグラフ
ナレッジグラフの抽出
ナレッジグラフの構築
ボットにナレッジグラフを追加
グラフの作成
ナレッジグラフの構築
既存のソースからFAQを構築
特性、同義語、停止用語
変数ネームスペースの管理
更新
ノード間の質問と回答の移動
用語の編集と削除
質問と応答の編集
ナレッジグラフの分析
通知タスク
スモールトーク
デジタルスキル
デジタルフォーム
デジタルビュー
デジタルビューとは
パネル
ウィジェット
トレーニング
トレーニングとは
機械学習
機械学習とは
モデル検証
ファンダメンタルミーニング
ナレッジグラフ
示唆
ランキングおよび解決
NLPの詳細設定
NLPのガイドライン
インテリジェンス
インテリジェンスとは
コンテキスト
コンテキストインテント
割り込み
複数インテントの検出
エンティティの変更
デフォルトの会話
センチメント管理
トーン分析
テストとデバッグ
ボットと会話
発話テスト
バッチテスト
会話テスト
デプロイ
チャネル
公開
分析
ボットの分析
NLPメトリクス
会話フロー
Usage Metrics
封じ込め測定
カスタムダッシュボード
カスタムダッシュボードとは
メタタグ
カスタムダッシュボードとウィジェット
ユニバーサルボット
ユニバーサルボットとは
ユニバーサルボットの定義
ユニバーサルボットの作成
ユニバーサルボットのトレーニング
ユニバーサルボットのカスタマイズ
他言語の有効化
ストア
プラントと使用
Overview
Usage Plans
Support Plans
Invoices
管理
ボット認証
複数言語対応ボット
個人を特定できる情報の編集
ボット変数の使用
IVRのシステム連携
一般設定
ボット管理
ハウツー
会話スキルの設計
バンキングボットを作成
バンキングボット – 資金の振り替え
バンキングボット – 残高を更新
ナレッジグラフを構築
スマートアラートの予約方法
デジタルスキルの設計
デジタルフォームの設定方法
デジタルビューの設定方法
データテーブルのデータの追加方法
データテーブルのデータの更新方法
Add Data from Digital Forms
ボットのトレーニング
示唆の使用方法
インテントとエンティティのパターンの使用方法
コンテキスト切り替えの管理方法
ボットのデプロイ
エージェント転送の設定方法
ボット関数の使用方法
コンテンツ変数の使用方法
グローバル変数の使用方法
Web SDK Tutorial(英語)
Widget SDK Tutorial(英語)
ボットの分析
カスタムダッシュボードの作成方法
カスタムタグを使ってフィルタリング
管理
ボット管理者コンソール
ダッシュボード
ユーザーの管理
ユーザーの管理
グループの管理
ロール管理
ボット管理モジュール
登録
ユーザーの招待
招待状の一括送信
ユーザーデータのインポート
Active Directoryからユーザーを同期
セキュリティ/コンプライアンス
シングル サインオンの使用
セキュリティ設定
Billing(日本未対応)
  1. ホーム
  2. Docs
  3. Virtual Assistants
  4. How Tos
  5. Travel Planing Assistant
  6. Travel VA: Managing Context Switching

Travel VA: Managing Context Switching

In this Use Case, we will explore a scenario in a Travel Planning Assistant, where, sharing the context across intents, FAQs help in improving the user experience and the assistant’s efficiency. Also, we will be looking at how the context can be used within a dialog flow to determine the sequence of events.

For details on what Context Management is and how it is implemented in the Kore.ai XO Platform, refer here.

Problem Statement

Consider a Travel Planning VA trying to address the following scenarios:

  • Sharing content across intents – Once the user has entered his/her booking number, they should not be prompted for it again in the course of the conversation.
    User: I want to change my seat.
    VA: Sure, may I have your booking number?
    // (initiating Change Seat Task)
    User: It’s 2343544
    VA: What is the new seat you would prefer?
    User: I want extra legroom. What options do I have?
    // (transferring to Get seat task)
    VA: What is your booking number?

    Ideally, Get Seat should not be asking for the flight number again.
  • Context-based dialog flow – Based upon the context, the flow of a given task might change with the assistant making an explicit call to another task as a sub-dialog.
    Extending the above example:

User: I want to change my seat.
VA: Sure, may I have your booking number?
// (initiating Change Seat Task)
User: It’s 2343544
VA: What is the new seat you would prefer?
User: Seat 12A, please.
// (transferring to Get seat task)
VA: Your current seat is 25B.
VA: I have changed your seat to Seat 12A.

Ideally, Get Seat  should not ask for the flight number and should not display the current seat message. It should happen in the background between the two tasks, without user knowledge.

  • Follow-up Intents – Access to certain tasks could be restricted due to security reasons or business requirements. Additionally, other tasks could be made inaccessible to the user; or even to the assistant.
    For example, updating seats should be restricted to the Change Seat flow. An Update Booking task should not be available directly to the User nor any other task in the assistant.
  • Sharing context between intent and FAQs – During a task, the user might ask a generic question but within the context.
    For example, while changing seats, the user might ask if there is a fee; and the assistant needs to respond with the FAQ related to seat change  rates.
  • Sharing content across FAQs – A specific question might be a follow up of a previous query.
    For example, “Are there any charges for a flight change? ?” followed by “What are the charges?”The charges reference is to the flight change.

Having this problem statement in view, this document provides a detailed step-by-step approach to achieving all the above-mentioned scenarios using – context tags and variables, input pre-conditions and output context, and emit entity value features of the Platform.

Prerequisites

  • Knowledge on how to build a virtual assistant
  • A Virtual Assistant with the Dialog Tasks mentioned below – see an overview here.
  • Check Flight Status – This task prompts the user to enter their flight number and displays its status.
  • Change Flight – This task prompts the user for their Current Flight and New Flight, then performs the flight change.

  • Update Booking – A Dialog Task that asks the user for the number of the booking to update and the update that needs to be made, then performs the update.

  • Knowledge Graph – Frequently asked questions that the assistant handles.

Implementation

Let us consider each of the above scenarios one by one.

Sharing content across intents

Sharing content needs to be handled differently in the two cases mentioned:

  • Task-driven transition – This can be handled at the time of development by invoking the corresponding intent and passing the data through entity pre-assignment
  • User-driven transition – This is a bit complex since we have no way of knowing when, during the current task flow, the user would make such a request and it requires a combination of tags, entity emission, and extraction.

Task-driven Context switching

The following is the scenario where the Change Flight dialog invokes the Check Flight Status task to ensure that the flight is available to book. 

We will be using the Context Variables and Entity Pre-Assignments to achieve this.

Steps:

We need to invoke Check Flight Status  from Change Flight, check flight availability  and proceed accordingly

  1. Open the Change Flight dialog task,
  2. Add a Dialog Node, Bot Action Node with a Script Node, and a Message Node as follows:
    1. Dialog Node will invoke the Check Flight Status  using the Entity Pre-Assignments to populate:
      1. Flight Number – entity required in the Check Flight Status  dialog set to context.entities.currentflight
      2. Add Key/Value – pair context.type and change identifying the Change Flight  intent. This will be checked in the Check Flight Status  dialog as shown in the next step to modify the flow.
      3. Ensure that the Transition Option is set to Initiate Check_Flight_Status,., once complete return to this node.
    2. Message Node to display a message that the new flight is not available to book. Connect this message back to the New Flight Entity node, so that the user be prompted to select a different flight.
    3. Script NodeCheckStatus to check the status of the new flight to change to, and proceed accordingly. The Status of the new flight is obtained from a BotContext variable that will be populated by the Check Flight Status dialog task. 

JavaScript:

var nextStep = “”;
if (context.session.BotUserSession.Status >= context.entities.seat)
   nextStep = “update”;
context.nextStep = nextStep;

      • Connection Settings Bot Action Connections should indicate to proceed to UpdateBooking in case the new flight is available (if the context.nextStep is updated from the above script) else go to the message node.

Next, let us modify the Check Flight Status  dialog to check for the change tag and populate the Bot Context variable if needed.

  1. Open the Check Flight Status dialog
  2. Open the Flight Status Confirmation (the final message node) node
  3. Under Bot Responses section open the Manage Responses dialog

Add the following JavaScript. This script populates the Bot Context variable and updates the seat  if the request comes from the Change Flight task, else displays the usual flight status message.

if (context.type == "change")
  BotUserSession.put('Sear', context.CheckFlightStatus.response.body.Seat);
else
  print ('The status of your flight is  ' + context.CheckFlightStatus.response.body.Status);

Talk to the Bot to see the changes in action.

User triggered context switching

While asking to change their flight, users might ask for the status of the flight that they want to switch to. 

Let us see how this can be achieved. We will be using historic tags – system generated and custom tags. The historic tags get transmitted from one intent to another automatically.

Steps:

First, modify the Change Flight task  to populate the appropriate tags and configure the Hold and Resume settings:

  1. Open the Change Flight  dialog
  2. Open the properties panel of CurrentFlightentity
  3. From the NLP tab, set the Auto emit the entity values captured flag. This will ensure that the Current Flight  number is saved in the context. Since it is the first value being emitted by this intent, it would be positioned next to the intent name in the tags array
  4. Next, open the Manage Interruptions dialog from the more (vertical ellipses) option
  5. Customize the settings for this task as Allow hold and resume and set the Hold Options to Hold the current task and resume back once the new task is completed and the Resume Options to Resume the on hold task without any specific message to the user.

Next, modify the Check Flight Status dialog to capture the data sent by the Change Flight task

  1. Open the Check Flight Status  dialog
  2. Add a Script nodeCheckFlightNumberto check if the Flight Number is available in the context, after the Intent node

Add the following script. This script checks for the Intent “Change Flight”, captures the flight number and populates the FlightNumber entity with that value.
var i = koreUtil._.indexOf(context.historicTags[0].tags, 'Change Flight'); context.entities.FlightNumber = context.historicTags[0].tags[i+1]

Run the VA and see the changes taking effect.

Follow up Intents

The Update Booking intent should be invoked only through the Change Flight task. There are two things that can be done:

  1. Restricting user access:
    1. Open the Update Booking dialog
    2. Access Dialog Settings from the more (vertical ellipses) option
    3. Set Options to Sub intent only dialog
    4. This will restrict user access to this dialog, this dialog will not be available either directly or from the Help option.
  2. Restricting task access:
    1. Open the Update Booking dialog
    2. Open the UpdateBooking intent, NLP Properties tab
    3. Under the Manage Context section add “Change” to the Intent Preconditions.
      This will ensure that this dialog will be executed only if Change exists in the context.
    4. Open the Change Flight  dialog
    5. Open the ChangeFlight intent node, NLP Properties tab
    6. Under the Manage Context section add “Change” to the Context Output as expected by the Update Booking dialog
    7. Now the Update Booking can not be triggered by any other dialog.

Sharing context across FAQs

The following Knowledge Graph is used in this scenario:

Primary Question: What are the compensations for a canceled flight?

Primary Question: What are the charges for changing flights?

Alternate: What are the charges?

In the second question, the word charges is in the context of changing flights. To enable it, all you need is to set a flag. For each question answered the Context tags are set automatically, we just instruct the Platform to use them appropriately.

  1. Go to Natural Language > Thresholds & Configurations
  2. Expand the Knowledge Graph tab
  3. Scroll down and set the Qualify Contextual Paths tag. With this setting, the KG engine will qualify a question if any of the available context tags are part of that particular FAQ path.
  4. Run the assistant and see the effect.

Sharing context between intents and FAQs

The following Knowledge Graph is used in this scenario:

Primary Question: What are your flight change rates?

Alternate: what are the rates?

The use case here is that the user might, while changing flights, ask about the rates. This should result in the appropriate FAQ being triggered to answer the query.

The default setting for the Interruption Behavior for FAQs will ensure that the FAQs are attended to while a Dialog Task is in progress

But this will not solve the use case described. It would answer the direct question – “What are the flight change rates” but not “What are the rates”. The reason being the FAQ not picking the context. To ensure that the context is picked by the FAQ:

  1. The Change Flight task is already emitting the change tag, the same will be used in this case
  2. Go to Natural Language > Thresholds & Configurations
  3. Expand the Knowledge Graph tab
  4. Scroll down and set the Qualify Contextual Paths tag (if not already set as per the previous use case)
  5. Run the assistant and see the changes taking effect.

Travel VA: Managing Context Switching

In this Use Case, we will explore a scenario in a Travel Planning Assistant, where, sharing the context across intents, FAQs help in improving the user experience and the assistant’s efficiency. Also, we will be looking at how the context can be used within a dialog flow to determine the sequence of events.

For details on what Context Management is and how it is implemented in the Kore.ai XO Platform, refer here.

Problem Statement

Consider a Travel Planning VA trying to address the following scenarios:

  • Sharing content across intents – Once the user has entered his/her booking number, they should not be prompted for it again in the course of the conversation.
    User: I want to change my seat.
    VA: Sure, may I have your booking number?
    // (initiating Change Seat Task)
    User: It’s 2343544
    VA: What is the new seat you would prefer?
    User: I want extra legroom. What options do I have?
    // (transferring to Get seat task)
    VA: What is your booking number?

    Ideally, Get Seat should not be asking for the flight number again.
  • Context-based dialog flow – Based upon the context, the flow of a given task might change with the assistant making an explicit call to another task as a sub-dialog.
    Extending the above example:

User: I want to change my seat.
VA: Sure, may I have your booking number?
// (initiating Change Seat Task)
User: It’s 2343544
VA: What is the new seat you would prefer?
User: Seat 12A, please.
// (transferring to Get seat task)
VA: Your current seat is 25B.
VA: I have changed your seat to Seat 12A.

Ideally, Get Seat  should not ask for the flight number and should not display the current seat message. It should happen in the background between the two tasks, without user knowledge.

  • Follow-up Intents – Access to certain tasks could be restricted due to security reasons or business requirements. Additionally, other tasks could be made inaccessible to the user; or even to the assistant.
    For example, updating seats should be restricted to the Change Seat flow. An Update Booking task should not be available directly to the User nor any other task in the assistant.
  • Sharing context between intent and FAQs – During a task, the user might ask a generic question but within the context.
    For example, while changing seats, the user might ask if there is a fee; and the assistant needs to respond with the FAQ related to seat change  rates.
  • Sharing content across FAQs – A specific question might be a follow up of a previous query.
    For example, “Are there any charges for a flight change? ?” followed by “What are the charges?”The charges reference is to the flight change.

Having this problem statement in view, this document provides a detailed step-by-step approach to achieving all the above-mentioned scenarios using – context tags and variables, input pre-conditions and output context, and emit entity value features of the Platform.

Prerequisites

  • Knowledge on how to build a virtual assistant
  • A Virtual Assistant with the Dialog Tasks mentioned below – see an overview here.
  • Check Flight Status – This task prompts the user to enter their flight number and displays its status.
  • Change Flight – This task prompts the user for their Current Flight and New Flight, then performs the flight change.

  • Update Booking – A Dialog Task that asks the user for the number of the booking to update and the update that needs to be made, then performs the update.

  • Knowledge Graph – Frequently asked questions that the assistant handles.

Implementation

Let us consider each of the above scenarios one by one.

Sharing content across intents

Sharing content needs to be handled differently in the two cases mentioned:

  • Task-driven transition – This can be handled at the time of development by invoking the corresponding intent and passing the data through entity pre-assignment
  • User-driven transition – This is a bit complex since we have no way of knowing when, during the current task flow, the user would make such a request and it requires a combination of tags, entity emission, and extraction.

Task-driven Context switching

The following is the scenario where the Change Flight dialog invokes the Check Flight Status task to ensure that the flight is available to book. 

We will be using the Context Variables and Entity Pre-Assignments to achieve this.

Steps:

We need to invoke Check Flight Status  from Change Flight, check flight availability  and proceed accordingly

  1. Open the Change Flight dialog task,
  2. Add a Dialog Node, Bot Action Node with a Script Node, and a Message Node as follows:
    1. Dialog Node will invoke the Check Flight Status  using the Entity Pre-Assignments to populate:
      1. Flight Number – entity required in the Check Flight Status  dialog set to context.entities.currentflight
      2. Add Key/Value – pair context.type and change identifying the Change Flight  intent. This will be checked in the Check Flight Status  dialog as shown in the next step to modify the flow.
      3. Ensure that the Transition Option is set to Initiate Check_Flight_Status,., once complete return to this node.
    2. Message Node to display a message that the new flight is not available to book. Connect this message back to the New Flight Entity node, so that the user be prompted to select a different flight.
    3. Script NodeCheckStatus to check the status of the new flight to change to, and proceed accordingly. The Status of the new flight is obtained from a BotContext variable that will be populated by the Check Flight Status dialog task. 

JavaScript:

var nextStep = “”;
if (context.session.BotUserSession.Status >= context.entities.seat)
   nextStep = “update”;
context.nextStep = nextStep;

      • Connection Settings Bot Action Connections should indicate to proceed to UpdateBooking in case the new flight is available (if the context.nextStep is updated from the above script) else go to the message node.

Next, let us modify the Check Flight Status  dialog to check for the change tag and populate the Bot Context variable if needed.

  1. Open the Check Flight Status dialog
  2. Open the Flight Status Confirmation (the final message node) node
  3. Under Bot Responses section open the Manage Responses dialog

Add the following JavaScript. This script populates the Bot Context variable and updates the seat  if the request comes from the Change Flight task, else displays the usual flight status message.

if (context.type == "change")
  BotUserSession.put('Sear', context.CheckFlightStatus.response.body.Seat);
else
  print ('The status of your flight is  ' + context.CheckFlightStatus.response.body.Status);

Talk to the Bot to see the changes in action.

User triggered context switching

While asking to change their flight, users might ask for the status of the flight that they want to switch to. 

Let us see how this can be achieved. We will be using historic tags – system generated and custom tags. The historic tags get transmitted from one intent to another automatically.

Steps:

First, modify the Change Flight task  to populate the appropriate tags and configure the Hold and Resume settings:

  1. Open the Change Flight  dialog
  2. Open the properties panel of CurrentFlightentity
  3. From the NLP tab, set the Auto emit the entity values captured flag. This will ensure that the Current Flight  number is saved in the context. Since it is the first value being emitted by this intent, it would be positioned next to the intent name in the tags array
  4. Next, open the Manage Interruptions dialog from the more (vertical ellipses) option
  5. Customize the settings for this task as Allow hold and resume and set the Hold Options to Hold the current task and resume back once the new task is completed and the Resume Options to Resume the on hold task without any specific message to the user.

Next, modify the Check Flight Status dialog to capture the data sent by the Change Flight task

  1. Open the Check Flight Status  dialog
  2. Add a Script nodeCheckFlightNumberto check if the Flight Number is available in the context, after the Intent node

Add the following script. This script checks for the Intent “Change Flight”, captures the flight number and populates the FlightNumber entity with that value.
var i = koreUtil._.indexOf(context.historicTags[0].tags, 'Change Flight'); context.entities.FlightNumber = context.historicTags[0].tags[i+1]

Run the VA and see the changes taking effect.

Follow up Intents

The Update Booking intent should be invoked only through the Change Flight task. There are two things that can be done:

  1. Restricting user access:
    1. Open the Update Booking dialog
    2. Access Dialog Settings from the more (vertical ellipses) option
    3. Set Options to Sub intent only dialog
    4. This will restrict user access to this dialog, this dialog will not be available either directly or from the Help option.
  2. Restricting task access:
    1. Open the Update Booking dialog
    2. Open the UpdateBooking intent, NLP Properties tab
    3. Under the Manage Context section add “Change” to the Intent Preconditions.
      This will ensure that this dialog will be executed only if Change exists in the context.
    4. Open the Change Flight  dialog
    5. Open the ChangeFlight intent node, NLP Properties tab
    6. Under the Manage Context section add “Change” to the Context Output as expected by the Update Booking dialog
    7. Now the Update Booking can not be triggered by any other dialog.

Sharing context across FAQs

The following Knowledge Graph is used in this scenario:

Primary Question: What are the compensations for a canceled flight?

Primary Question: What are the charges for changing flights?

Alternate: What are the charges?

In the second question, the word charges is in the context of changing flights. To enable it, all you need is to set a flag. For each question answered the Context tags are set automatically, we just instruct the Platform to use them appropriately.

  1. Go to Natural Language > Thresholds & Configurations
  2. Expand the Knowledge Graph tab
  3. Scroll down and set the Qualify Contextual Paths tag. With this setting, the KG engine will qualify a question if any of the available context tags are part of that particular FAQ path.
  4. Run the assistant and see the effect.

Sharing context between intents and FAQs

The following Knowledge Graph is used in this scenario:

Primary Question: What are your flight change rates?

Alternate: what are the rates?

The use case here is that the user might, while changing flights, ask about the rates. This should result in the appropriate FAQ being triggered to answer the query.

The default setting for the Interruption Behavior for FAQs will ensure that the FAQs are attended to while a Dialog Task is in progress

But this will not solve the use case described. It would answer the direct question – “What are the flight change rates” but not “What are the rates”. The reason being the FAQ not picking the context. To ensure that the context is picked by the FAQ:

  1. The Change Flight task is already emitting the change tag, the same will be used in this case
  2. Go to Natural Language > Thresholds & Configurations
  3. Expand the Knowledge Graph tab
  4. Scroll down and set the Qualify Contextual Paths tag (if not already set as per the previous use case)
  5. Run the assistant and see the changes taking effect.
メニュー