본 방법에서는 사용자 경험과 봇 효율성을 개선하는 데 도움이 되는 FAQ를 통해 여러 의도에 걸쳐 컨텍스트를 공유하는 뱅킹 봇 시나리오를 살펴보겠습니다. 또한 대화 흐름 내에서 컨텍스트를 사용하여 이벤트 순서를 결정하는 방법에 대해서도 살펴봅니다. 컨텍스트 관리의 정의와 Kore.ai 봇 플랫폼에서 컨텍스트 관리가 어떻게 구현되는지에 대한 자세한 내용은 여기를 참조하세요.

문제 설명

뱅킹 봇이 다음과 같은 시나리오를 해결하려고 한다고 생각해 보세요.

  • 여러 의도에 걸쳐 콘텐츠 공유 – 사용자가 자신의 계좌 번호를 입력한 후에는 대화 중에 동일한 메시지가 다시 표시되지 않습니다.
    User: I want to transfer $200 from my account
    Bot: Sure, may I have your account number?
    // (initiating Transfer Amount task)
    User: It’s 2343544
    Bot: What is the payee account number
    User: Wait, do I have sufficient funds
    // (transferring to Get Balance task)
    Bot: What is your account number

    이상적으로, 잔액 가져오기는 계좌 번호를 요청하지 않아야 합니다.
  • 컨텍스트 기반 대화 흐름 – 상황에 따라 봇에서 다른 작업을 하위 대화로 명시적으로 호출함에 따라 주어진 작업의 흐름이 변경될 수 있습니다. 위의 예제 확장:
    User: I want to transfer $200 from my account
    Bot: Sure, may I have your account number?
    // (initiating Transfer Amount task)
    User: It’s 2343544
    Bot: What is the payee account number
    User: 4355403
    Bot: What is your account number?
    // (transferring to Get Balance task to check for sufficient funds)
    User: It’s 2343544
    Bot: Current balance is $1200
    Bot: Amount $200 has been debited from your account.
    //(resuming Transfer Amount task)

    이상적으로, 잔액 가져오기는 계좌 번호를 묻지 않고 잔액 메시지를 표시하지 않아야 합니다. 이 작업은 사용자 지식 없이 두 작업 사이의 백그라운드에서 일어나야 합니다.
  • 후속 조치 의도 – 보안상의 이유 또는 비즈니스 요건으로 인해 특정 작업에 대한 액세스가 제한될 수 있습니다. 예를 들어, 계좌 잔액 업데이트를 이체 금액 흐름으로 제한해야 합니다. 계좌 업데이트 작업은 사용자 또는 봇의 다른 작업에 직접 사용할 수 없습니다.
  • 의도와 FQA 간 컨텍스트 공유 – 작업 중에 사용자는 컨텍스트 내에서 일반적인 질문을 할 수 있습니다. 예를 들어, 금액을 이체하는 동안 사용자가 이율에 대해 질문할 수 있으며 봇은 자금 이체율과 관련된 FAQ에 응답해야 합니다.
  • FAQ에서 콘텐츠 공유 – 특정 질문은 이전 쿼리의 후속 질문일 수 있습니다. 예를 들어 “신용 카드에 대한 이자율은 무엇입니까?“와 같은 질문은 “요금은 얼마입니까?“에 이어지는 신용 카드에 대한 요금 참조 사항입니다.

본 문서에서는 컨텍스트 태그 및 변수, 사전 조건 입력 및 컨텍스트 출력, 플랫폼의 엔티티 값 기능을 사용하여 위에서 언급한 모든 시나리오를 달성하기 위한 자세한 단계별 접근 방법을 제공합니다.

전제 조건

  • 봇 구축 지식
  • 아래 언급된 것과 같은 대화 상자가 있는 뱅킹 봇:
    • 잔액 가져오기 – 대화 작업이 사용자에게 계좌 번호를 묻고 계정에서 사용할 수 있는 잔액을 표시합니다.
    • 자금 이체– 대화 작업은 사용자에게 지급인 및 수취인 계좌 번호와 이체할 금액을 묻고, 지급인 계좌에서 수취인 계좌로 지정된 금액을 이체합니다.
    • 계좌 업데이트 – 대화 작업이 사용자에게 업데이트해야 하는 계좌 번호, 업데이트할 금액, 금액이 신용 거래인지 신용 거래가 아닌지 여부를 묻고 이에 따라 계좌 잔액을 업데이트합니다.
    • 지식 모음 – 은행과 관련된 자주 묻는 질문입니다.

구현

다음 시나리오를 각각 하나씩 살펴보겠습니다.

여러 의도에 걸쳐 콘텐츠 공유

다음과 같이 언급된 두 가지 경우에 콘텐츠 공유를 다르게 처리해야 합니다:

  • 봇 기반 전환 – 이는 봇 개발 시 해당 의도를 호출하고 엔티티 사전 할당을 통해 데이터를 전달하여 처리할 수 있습니다
  • 사용자 기반 전환 – 이는 현재 작업 흐름 중에 사용자가 이러한 요청을 언제 수행할지 알 방법이 없으며 태그, 엔티티 산출 및 추출의 조합이 필요하기 때문에 다소 복잡합니다.

작업 기반 컨텍스트 전환

다음은 이체 금액 대화에서 잔액 가져오기 작업을 호출하여 지급인 계좌에 이체할 자금이 충분한지 확인하는 시나리오입니다.   이를 위해 봇 범위 컨텍스트 변수와 엔티티 사전 할당을 사용하겠습니다. 단계: 이체 금액에서 잔액 가져오기를 호출하고 자금을 확인한 후 그에 따라 진행해야 합니다

  1. 이체 금액 대화를 엽니다
  2. 다음과 같이 대화 노드, 스크립트 노드메시지 노드를 추가합니다:
    1. 대화 노드는 엔티티 사전 할당을 사용하여 잔액 가져오기를 호출하여 다음을 입력합니다:
      • 계좌 번호 – 잔액 가져오기 대화에서 필수 엔티티가 지급인 계좌 번호로 설정되어 있습니다
      • 키/값 추가context.type을 이체 금액 의도를 식별하는 전환을 페어링합니다. 다음 단계에 표시된 대로 잔액 가져오기 대화에서 확인하여 플로우를 수정합니다.
      • 전환 옵션이 초기 Get_Balance로 설정되어 있는지 확인합니다. 완료되면 이 노드로 돌아갑니다
    2. 스크립트 노드CheckBalance를 사용하여 지급인 계좌의 잔액을 이체할 금액으로 확인하고 이에 따라 진행합니다. 지급인 계좌의 잔액은 잔액 가져오기 대화로 입력될 BottContext 변수에서 가져옵니다.
      • JavaScript:
        var nextStep = “”;
        if (context.session.BotUserSession.Balance >= context.entities.Amount)
           nextStep = “update”;
        context.nextStep = nextStep;

      • 연결 설정 자금이 충분한 경우 UpdateBalance로 진행합니다(위 스크립트에서 context.nextStep업데이트한 경우). 그렇지 않으면 메시지 노드로 이동합니다.
    3. 메시지 노드 : 자금 부족 메시지 표시

다음으로, 잔액 가져오기 대화를 수정하여 이체 태그를 확인하고 필요하다면 봇 컨텍스트 변수를 채웁니다.

  1. 잔액 가져오기 대화를 엽니다
  2. BalanceMessage(최종 메시지 노드) 노드를 엽니다
  3. 봇 응답 섹션에서 응답 관리 대화를 엽니다
  4. 다음 JavaScript를 추가합니다.. 이 스크립트는 이체 금액 작업에서 요청을 받은 경우 봇 컨텍스트 변수를 계좌 잔액으로 채웁니다. 그렇지 않으면 일반 잔액 메시지가 표시됩니다.
    if (context.type == "transfer")
      BotUserSession.put('Balance', context.GetAccountBalance.response.body.Balance);
    else
      print ('The Balance in your account is ' + context.GetAccountBalance.response.body.Balance);
    

봇을 실행하고 조지 내 변경 사항을 확인합니다.

사용자가 트리거 한 컨텍스트 전환

다음은 이 활용 사례의 예입니다. 사용자는 이전 금액 확인 계좌 잔액을 사용하는 동안 언제든지 이체 작업을 진행할 수 있습니다.

이를 어떻게 달성할 수 있는지 살펴보겠습니다. 시스템에서 생성한 태그와 커스텀 태그 같은 기록 태그를 사용하겠습니다. 기록 태그는 한 의도에서 다른 의도로 자동으로 전송됩니다. 단계: 먼저 이체 금액을 수정하여 적절한 태그를 입력하고 보류 및 재개 설정을 구성합니다:

  1. 이체 금액 대화를 엽니다
  2. PayerAccount 엔티티의 속성 패널을 엽니다
  3. NLP 탭에서 캡처된 엔티티 값 자동 발행을 설정합니다. 그러면 지급인 계좌 번호가 컨텍스트에 저장됩니다. 이 값은 이 의도를 통해 발행되는 첫 번째 값이므로 태그 배열에서 의도 이름 옆에 배치됩니다
  4. 그런 다음 기타(세로 타원) 옵션에서 관리 중단 대화를 엽니다.
  5. 이 작업에 대한 설정을 보류 및 재개 허용으로 커스터마이징하고 보류 옵션현재 작업을 보류하고 새 작업이 완료되면 재개하도록 설정하고 사용자에게 특정 메시지를 표시하지 않고 보류 중인 작업을 다시 시작하도록 재개 옵션을 설정합니다.

다음으로, 잔액 가져오기 대화를 수정하여 이체 금액에서 전송된 데이터를 캡처합니다

  1. 잔액 가져오기 대화를 엽니다
  2. 스크립트 노드 추가 – CheckAcId를 의도 노드 후의 컨텍스트에서 계좌 번호를 사용할 수 있는지 확인합니다.
  3. 다음 스크립트를 추가합니다.. 이 스크립트는 의도 “이체 금액”을 확인합니다. 계좌 번호를 캡처하고 AccountNumber 엔티티를 해당 값으로 입력합니다.
    var i = koreUtil._.indexOf(context.historicTags[0].tags, 'Transfer Amount');
    context.entities.AccountNumber = context.historicTags[0].tags[i+1]
    

봇을 실행하고 변경 사항이 적용되었는지 확인합니다.

후속 작업 의도

계좌 업데이트 의도는 이체 금액을 통해서만 호출되어야 합니다. 다음 두 가지 작업을 수행할 수 있습니다.

  1. 사용자 액세스 제한:
    1. 계좌 업데이트 대화를 엽니다
    2. 기타(세로 타원) 옵션에서 대화 설정에 액세스합니다
    3. 옵션하위 의도 전용 대화로 설정합니다
    4. 이렇게 하면 이 대화에 대한 사용자 액세스가 제한되며, 이 대화는 직접 또는 도움말 옵션에서 사용할 수 없습니다.
  2. 작업 액세스 제한:
    1. 잔액 업데이트 대화를 엽니다
    2. UpdateBalance 의도의, NLP 속성 탭을 엽니다
    3. 컨텍스트 관리 섹션에서 의도 전제 조건에 “이체“를 추가합니다 이렇게 하면 이체가 컨텍스트에 있는 경우에만 이 대화가 실행됩니다.
    4. 이체 금액 대화를 엽니다
    5. 이체 금액 의도 노드의, NLP 속성 탭을 엽니다
    6. 컨텍스트 관리 섹션에서 잔액 업데이트 대화에 필요한 대로 컨텍스트 출력에 “이체“를 가합니다
    7. 이제 다른 대화에서 잔액 업데이트를 트리거 할 수 없습니다.

후속 작업 의도

계좌 업데이트 의도는 이체 금액을 통해서만 호출되어야 합니다. 다음 두 가지 작업을 수행할 수 있습니다.

  1. 사용자 액세스 제한:
    1. 계좌 업데이트 대화를 엽니다
    2. 기타(세로 타원) 옵션에서 대화 설정에 액세스합니다
    3. 옵션하위 의도 전용 대화로 설정합니다
    4. 이렇게 하면 이 대화에 대한 사용자 액세스가 제한되며, 이 대화는 직접 또는 도움말 옵션에서 사용할 수 없습니다.
  2. 작업 액세스 제한:
    1. 잔액 업데이트 대화를 엽니다
    2. UpdateBalance 의도의, NLP 속성 탭을 엽니다
    3. 컨텍스트 관리 섹션에서 의도 전제 조건에 “이체“를 추가합니다 이렇게 하면 이체가 컨텍스트에 있는 경우에만 이 대화가 실행됩니다.
    4. 이체 금액 대화를 엽니다
    5. 이체 금액 의도 노드의, NLP 속성 탭을 엽니다
    6. 컨텍스트 관리 섹션에서 잔액 업데이트 대화에 필요한 대로 컨텍스트 출력에 “이체“를 가합니다
    7. 이제 다른 대화에서 잔액 업데이트를 트리거 할 수 없습니다.

여러 FAQ에 걸쳐 컨텍스트 공유

이 시나리오에서는 다음 지식 모음이 사용됩니다: 주요 질문: 신용 카드의 이자율은 어떻게 되나요? 주요 질문: 신용 카드 요금 청구액은 얼마인가요? 대체: 청구액은 얼마인가요?
활용 사례는 다음과 같습니다:

두 번째 질문에서 청구액이라는 단어는 신용 카드의 컨텍스트에 있습니다. 이 기능을 사용하려면 플래그를 설정하기만 하면 됩니다. 플랫폼이 처리합니다. 답변한 각각의 질문에 대해 컨텍스트 태그가 자동으로 설정됩니다. 이를 적절히 사용하도록 플랫폼에 지시하기만 하면 됩니다.

  1. 학습 -> 임곗값 및 설정으로 이동
  2. 지식 모음 탭 확장
  3. 아래로 스크롤 하여 문맥 경로 검증 태그를 설정합니다. 이 설정을 사용하면 사용할 수 있는 컨텍스트 태그가 특정 FAQ 경로의 일부일 경우 KG 엔진이 질문에 대해 검증합니다.
  4. 봇을 실행하여 결과를 확인합니다.

의도와 FAQ 간의 컨텍스트 공유

이 시나리오에서는 다음 지식 모음이 사용됩니다: 주요 질문: 이체율은 얼마인가요? 대체: 이체율은 어떻게 되나요? 이 활용 사례는 사용자가 이체 금액 중에 이율에 관해 물어볼 수 있다는 것입니다. 이렇게 하면 적절한 FAQ가 트리거 되어 쿼리에 응답할 수 있습니다.

FAQ의 중단 동작에 대한 기본 설정은 대화 작업이 진행 중인 동안 FAQ를 볼 수 있도록 하지만 설명된 활용 사례는 해결되지 않습니다. “이체율은 얼마인가요“라는 직접적인 질문에 답하지만 “이체율은 어떻게 되나요“라는 질문에 대해서는 답변을 제공하지 않습니다. FAQ가 컨텍스트를 선택하지 않는 이유. FAQ가 컨텍스트를 선택했는지 확인하려면:

  1. 이체 금액 작업이 이미 이체 태그를 표시하고 있으며, 이 경우에도 동일한 태그가 사용됩니다
  2. 학습 -> 임곗값 및 설정으로 이동
  3. 지식 모음 탭 확장
  4. 아래로 스크롤 하여 컨텍스트 경로 검증 태그를 설정합니다(이전 활용 사례에 따라 아직 설정되지 않은 경우)
  5. 봇을 실행하고 변경 사항이 적용되었는지 확인합니다

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

このハウツーでは、インテント全体のコンテキストを共有し、FAQがBotのユーザー体験および効率性の改善に役立つバンキングBotのシナリオを調査します。また、ダイアログフロー内でコンテキストの使用方法に注目し、イベントの順序を決定します。コンテキスト管理およびKore.ai Botプラットフォームでどのように実装されているかの詳細については、こちらを参照してください

例題

以下のシナリオに取り組むバンキングBotを検討します。

  • インテント全体のコンテンツを共有 – ユーザーが彼/彼女の口座番号を入力すると、会話の途中で再度同じプロンプトが表示されることはありません。 User: I want to transfer $200 from my account Bot: Sure, may I have your account number? // (initiating Transfer Amount task) User: It’s 2343544 Bot: What is the payee account number User: Wait, do I have sufficient funds // (transferring to Get Balance task) Bot: What is your account number 理想的には、残高の確認では口座番号は要求されるべきではありません。
  • コンテキストベースのダイアログフロー – コンテキストに基づき、指定タスクのフローはBotがサブダイアログとして別のタスクに明確にコールすると変わる場合があります。上記の拡張例User: I want to transfer $200 from my account Bot: Sure, may I have your account number? // (initiating Transfer Amount task) User: It’s 2343544 Bot: What is the payee account number User: 4355403 Bot: What is your account number? // (transferring to Get Balance task to check for sufficient funds) User: It’s 2343544 Bot: Current balance is $1200 Bot: Amount $200 has been debited from your account. //(resuming Transfer Amount task) 理想的には、残高の確認は口座番号は要求されるべきではなく、残高メッセージは表示されるべきではありません。これは、ユーザーナレッジがない2つのタスク間のバックグラウンドで発生します。
  • フォローアップインテント – セキュリティ上の理由またはビジネス要件により、特定タスクへのアクセスは制限できます。たとえば、口座残高の更新は送金金額フローに制限されるべきです。口座タスクの更新は、ユーザーまたはBot内の他のタスクに対して直接実行できません。
  • インテント間のコンテキストの共有およびFAQ – タスク中、ユーザーはコンテキスト内の一般的な質問をする場合があります。たとえば、金額を送金中、ユーザーはレートについて質問する場合があり、Botは資金送金レート関連のFAQで回答必要があります。
  • FAQ間のコンテンツの共有 – 特定の質問は以前のクエリのフォローアップの場合があります。たとえば、「クレジットカードの金利はいくらですか?」に続き、「手数料はいくらですか?」で、手数料参照はクレジットカードに対するものです。

この文書では、上記のすべてのシナリオをコンテキストタグ、変数を使用して達成するステップバイステップ式アプローチの詳細を説明し、事前条件をインプットおよびコンテキストをアウトプットし、プラットフォームのエンティティ値の機能を発します。

Pre-requisites

  • Botビルドナレッジ
  • 以下で述べるダイアログ付きバンキングBot
    • 残高の確認 – ユーザーに口座番号をプロンプト表示し、口座で使用できる残高を表示するダイアログタスク。
    • 資金の移動 – ユーザーに支払人および受取人の口座番号と移動額をプロンプト表示し、指定額を支払人口座から受取人口座へ移動するダイアログタスク。
    • 口座を更新 – ユーザーに更新する必要がある口座番号、更新される金額、金額を入金または出金して口座残高を更新する必要があるかどうかをプロンプト表示するダイアログタスク。
    • ナレッジ収集 – 銀行に関するよくある質問。

導入

上記シナリオのそれぞれを1つづつ検討します。

インテント間のコンテキスト共有

コンテンツの共有は、2つのケースで別に処理する必要があります。

  • Bot主導の遷移 – これは、対応するインテントを呼び出し、エンティティの事前課題でデータをパスすることで、Bot開発時に処理できます。
  • ユーザー主導の遷移 – 現在のタスクフロー中は、ユーザーがいつリクエストするかがわからないため少し複雑で、タグの組み合わせ、 エンティティの排出および抽出が必要です。

タスク主導のコンテキスト切り替え

以下は、送金金額ダイアログが残高の確認タスクを呼び出し、支払人口座に送金する十分な資金があるかどうかをチェックするシナリオです。 Bot範囲のコンテキスト変数とこれを達成するエンティティの事前課題を使用します。ステップ:送金金額から残高の確認を呼び出し、資金をチェックして進める必要があります。

  1. 送金金額ダイアログを開きます。
  2. 以下のように、ダイアログノードスクリプトノードメッセージノードを追加します。
    1. ダイアログノード は、エンティティ事前割当を使用して残高の確認を呼び出して、以下を入力します。
      • 口座番号支払人口座番号への残高の確認ダイアログ設定に必要なエンティティ。
      • キー/値の追加 – 送金金額インテントを特定する context.type転送のペア。これは、フローを変更する次のステップに表示される残高の確認ダイアログでチェックされます。
      • 転送オプションが Get_Balanceの開始に設定されていることを確認し、完了したら、このノードに戻ります。
    2. スクリプトノード – 支払人口座の残高を送金金額とチェック続行CheckBalance。支払人口座の残高は、残高の確認ダイアログによって入力される BotContext 変数から取得されます。
      • JavaScript:
        var nextStep = “”; if (context.session.BotUserSession.Balance >= context.entities.Amount) nextStep = “update”; context.nextStep = nextStep;

      • 資金が不十分な場合は、UpdateBalanceへ続行接続設定context.nextStep が上記スクリプトからの更新である場合)、そうでない場合はメッセージノードへ続行します。
    3. 不十分な資金メッセージを表示するメッセージノード

次に、残高の確認ダイアログを変更し、送金タグをチェックし、必要に応じて、Botコンテキスト変数を入力します。

  1. 残高の確認ダイアログを開きます。
  2. BalanceMessage (最終メッセージノード)ノードを開きます。
  3. Bot応答 セクションで、応答を管理ダイアログを開きます。
  4. 以下の JavaScriptを追加します。このスクリプトは、リクエストが送金金額タスクからの場合は、口座残高にBotコンテキスト変数を入力し、そうでない場合は、通常の残高メッセージが表示されます。
    if (context.type == "transfer") BotUserSession.put('Balance', context.GetAccountBalance.response.body.Balance); else print ('The Balance in your account is ' + context.GetAccountBalance.response.body.Balance);

Botをテストして、実行中の変更内容を確認します。

ユーザーがトリガーしたコンテキスト切り替え

以下は、この使用ケースの例です。ユーザーは金額送金中はいつでも、送金を続行する前に口座残高をチェックできます。 これを達成する方法を確認しましょう。システム生成の履歴タグとカスタムタグを使用します。履歴タグは自動的に1つのインテントから別のインテントに送信されます。ステップ:最初に、送金金額を変更し、適切なタグを入力し、一時停止と再開設定を設定します。

  1. 送金金額ダイアログを開きます。
  2. PayerAccount エンティティのプロパティパネルを開きます。
  3. NLPタブから、取得したエンティティ値を自動放出フラグを設定します。これで、支払人口座番号がコンテキストに保存されたことが確認されます。このインテントによって放出される最初の値であるため、タグアレイのインテント名の隣に配置されます。
  4. 次に、追加(垂直省略記号)オプションから、中断を管理ダイアログを開きます。
  5. このタスクの設定を一時停止と再開を許可するとしてカスタマイズし、現在のタスクを一時停止オプションから現在のタスクを一時停止し、新しいタスクが完了したら再開再開オプションユーザーにメッセージを送信することなく、保留中のタスクを再開します

次に、残高の確認ダイアログを変更し、送金金額で送信したデータを取得します。

  1. 残高の確認ダイアログを開きます。
  2. スクリプトノードCheckAcId を追加し、口座番号をインテントノードの後で使用できるかどうかをチェックします。
  3. 以下のスクリプトを追加します。このスクリプトはインテント「送金金額」をチェックします。口座番号を取得し、その値でAccountNumberエンティティを入力します。
    var i = koreUtil._.indexOf(context.historicTags[0].tags, 'Transfer Amount'); context.entities.AccountNumber = context.historicTags[0].tags[i+1]

Botを実行して、有効になる変更内容を確認します。

インテントのフォローアップ

口座を更新インテントは、送金金額でのみ呼び出す必要があります。できることが、2つあります。

  1. ユーザーアクセスの制限:
    1. 口座を更新ダイアログを開きます。
    2. 追加(垂直省略記号)オプションから、ダイアログ設定にアクセスします。
    3. オプションを、サブインテントのみダイアログに設定します。
    4. これでユーザーアクセスはこのダイアログに制限され、このダイアログは直接またはヘルプオプションからは使用できません。
  2. タスクアクセスの制限:
    1. 残高を更新ダイアログを開きます。
    2. UpdateBalance インテント、NLP プロパティタブを開きます。
    3. コンテキストの管理セクションで、「転送」を インテント前提条件に追加します。これで、転送がコンテキストに存在している場合のみ、このダイアログが実行されることが確認されます。
    4. 送金金額ダイアログを開きます。
    5. TransferAmount インテントノード、NLP プロパティタブを開きます。
    6. コンテキストの管理セクションで、「転送」を残高更新ダイアログで期待されるコンテキストアウトプットへ転送します。
    7. これで、残高更新は他のダイアログではトリガーできなくなります。

FAQ間でのコンテキスト共有

このシナリオでは、以下のナレッジ収集が使用されます。主な質問:クレジットカードの金利はいくらですか? 主な質問:クレジットカードの料金はいくらですか? 代替:料金はいくらですか? 使用ケースは、以下のとおりです。 この2つ目の質問では、用語料金はクレジットカードのコンテキストです。有効にするには、フラグを設定するだけで、残りはプラットフォームが行います。コンテキストタグの質問に対する各回答は自動的に設定され、プラットフォームに対する指示は、適切に使用するということだけです。

  1. トレーニング-> しきい値および設定に移動します。
  2. ナレッジ収集タブを拡張します。
  3. スクロールダウンし、コンテキストパスを認定タグを設定します。この設定をすると、KGエンジンが使用可能コンテキストタグが特定のFAQパスの一部であるかどうかという質問を認定します。
  4. Botを実行し、効果を確認します。

インテントおよびFAQ間でのコンテキストの共有

このシナリオでは、以下のナレッジ収集が使用されます。主な質問:転送レートはいくらですか? 代替: レートはいくらですか? ここでの使用ケースは、ユーザーが金額送金中にレートについて質問する可能性があるといことです。この結果、適切なFAQがトリガーされ、クエリに答えます。 FAQの中断動作のデフォルト設定により、ダイアログタスクが進行中にFAQが伴いますが、これで説明した使用ケースは解決しません。ダイレクトな質問 – 「転送レートはいくらですか」には答えますが、「レートはいくらですか」には答えません。理由は、FAQがコンテキストを選んでいないからです。コンテキストをFAQで選べるようにするには、

  1. 送金金額タスクがすでに転送タグを放出中であり、このケースでは同じものが使用されます。
  2. トレーニング-> しきい値および設定に移動します。
  3. ナレッジ収集タブを拡張します。
  4. スクロールダウンし、コンテキストパスを認定タグを設定します(以前の使用ケースで設定されていない場合)。
  5. Botを実行して、有効になる変更を確認します

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

In this How-To, we will explore a scenario in a Banking Bot, where, sharing the context across intents, FAQs helps in improving the user experience and efficiency of the Bot. 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 Bots platform, refer here.

Problem Statement

Consider a Banking Bot trying to address the following scenarios:

  • Sharing content across intents – Once the user has entered his/her account number, they should not be prompted for the same again in the course of the conversation.
    User: I want to transfer $200 from my account
    Bot: Sure, may I have your account number?
    // (initiating Transfer Amount task)
    User: It’s 2343544
    Bot: What is the payee account number
    User: Wait, do I have sufficient funds
    // (transferring to Get Balance task)
    Bot: What is your account number

    Ideally, Get Balance should not be asking for the account number.
  • Context-based dialog flow – Based upon the context, the flow of a given task might change with the Bot making an explicit call to another task as a sub-dialog.
    Extending the above example:
    User: I want to transfer $200 from my account
    Bot: Sure, may I have your account number?
    // (initiating Transfer Amount task)
    User: It’s 2343544
    Bot: What is the payee account number
    User: 4355403
    Bot: What is your account number?
    // (transferring to Get Balance task to check for sufficient funds)
    User: It’s 2343544
    Bot: Current balance is $1200
    Bot: Amount $200 has been debited from your account.
    //(resuming Transfer Amount task)

    Ideally, Get Balance should not ask for the account number and should not display the balance 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.
    For example, updating account balances should be restricted to Transfer Amount flow. Update Account task should not be available directly to the User nor any other task in the Bot.
  • Sharing context between intent and FAQs – During a task, the user might ask a generic question but within the context.
    For example, while transferring an amount, the user might ask about rates and the Bot needs to respond with the FAQ related to funds transfer rates.
  • Sharing content across FAQs – A specific question might be a follow up of a previous query.For example, “What are the interest rated for credit cards?” followed by “What are the charges?”, the charges reference is to the credit cards.

This document gives 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.

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.
    • Transfer Funds – Dialog task prompting the user for Payer and Payee account numbers and the amount to be transferred and transferring the specified amount from the payer account to the payee 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.
    • Knowledge Collection – Frequently asked questions related to the bank.

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:

  • Bot-driven transition – This can be handled at the time of Bot 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 Transfer Amount dialog invokes the Get Balance task to check if the Payer Account has sufficient funds for the transfer.

 

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

Steps:

We need to invoke Get Balance from Transfer Amount, check for funds and proceed accordingly

  1. Open the Transfer Amount dialog
  2. Add a Dialog Node, Script Node, and a Message Node as follows:

    1. Dialog Node will invoke the Get Balance using the Entity Pre-Assignments to populate:
      • Account Number – entity required in the Get Balance dialog set to Payer Account number
      • Add Key/Value – pair context.type and transfer identifying the Transfer Amount intent. This will be checked in the Get Balance dialog as shown in the next step to modify the flow.
      • Ensure that the Transition Option is set to Initiate Get_Balance, once complete return to this node
    2. Script NodeCheckBalance to check the balance in the payer account with the amount to be transferred and proceed accordingly. Balance in the payer account is obtained from a BotContext variable that will be populated by the Get Balance dialog.
      • JavaScript:
        var nextStep = “”;
        if (context.session.BotUserSession.Balance >= context.entities.Amount)
           nextStep = “update”;
        context.nextStep = nextStep;

      • Connection Settings to proceed to UpdateBalance in case of sufficient funds (if the context.nextStep is update from the above script) else go to message node.
    3. Message Node to display the insufficient funds message

Next, let us modify the Get Balance dialog to check for transfer tag and populate the Bot Context variable if needed.

  1. Open the Get Balance dialog
  2. Open the BalanceMessage (the final message node) node
  3. Under Bot Responses section open the Manage Responses dialog
  4. Add the following JavaScript. This script populates the Bot Context variable with Account Balance if the request comes from Transfer Amount task else displays the usual balance message.
    if (context.type == "transfer")
      BotUserSession.put('Balance', context.GetAccountBalance.response.body.Balance);
    else
      print ('The Balance in your account is ' + context.GetAccountBalance.response.body.Balance);
    

Test the Bot to see the changes in action.

User triggered context switching

The following is an example of this use case. Users can at any point and time during the Transfer Amount check account balance before proceeding with the transfer.

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 Transfer Amount to populate the appropriate tags and configure the Hold and Resume settings:

  1. Open the Transfer Amount dialog
  2. Open the properties panel of PayerAccount entity
  3. From the NLP tab, set the Auto emit the entity values captured flag. This will ensure that the Payer Account 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 Get Balance dialog to capture the data sent by the Transfer Amount

  1. Open the Get Balance dialog
  2. Add a Script nodeCheckAcId to check if the Account Number is available in the context, after the Intent node
  3. Add the following script. This script checks for the Intent “Transfer Amount”. Captures the account number and populates the AccountNumber entity with that value.
    var i = koreUtil._.indexOf(context.historicTags[0].tags, 'Transfer Amount');
    context.entities.AccountNumber = context.historicTags[0].tags[i+1]
    

Run the Bot and see the changes taking effect.

Follow up Intents

The Update Account intent should be invoked only through Transfer Amount. There are two things that can be done:

  1. Restricting user access:
    1. Open the Update Account 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 Balance dialog
    2. Open the UpdateBalance intent, NLP Properties tab
    3. Under the Manage Context section add “Transfer” to the Intent Preconditions.
      This will ensure that this dialog will be executed only if the Transfer exists in context.
    4. Open Transfer Amount dialog
    5. Open the TransferAmount intent node, NLP Properties tab
    6. Under the Manage Context section add “Transfer” to the Context Output as expected by the Update Balance dialog
    7. Now the Update Balance can not be triggered by any other dialog.

Sharing context across FAQs

The following Knowledge Collection is used in this scenario:

Primary Question: What are the interest rates for credit cards?
Primary Question: What are the charges for credit cards?
Alternate: What are the charges?

The use case is as follows:

In the second question, the word charges is in the context of the credit card. To enable it, all you need is set a flag, rest the platform takes care. For each question answered the Context tags are set automatically, we just instruct the platform to use them appropriately.

  1. Go to Training -> Thresholds & Configurations
  2. Expand the Knowledge Collection 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 bot and see the effect.

Sharing context between intents and FAQs

The following Knowledge Collection is used in this scenario:

Primary Question: What are your transfer rates?
Alternate: what are the rates?

The use case here is that the user might, during the transfer amount, 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 transfer 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 Transfer Amount task is already emitting the transfer tag, the same will be used in this case
  2. Go to Training -> Thresholds & Configurations
  3. Expand the Knowledge Collection tab
  4. Scroll down and set the Qualify Contextual Paths tag (if not already set as per previous use case)
  5. Run the Bot and see the changes taking effect

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed