Updated on 2023-09-20 GMT+08:00

Configuration Scenario

Scenario

The following flowchart shows a scenario where a hospital uses the intelligent voice navigation (IVN) to complete a simple chatbot-based appointment flow.

Figure 1 Chatbot-based appointment flow

Note: The blue steps are performed by the IVN.

  1. A customer dials the hospital customer service hotline 123456.
  2. Initialize the language (Chinese or English).
  3. Play the greeting.
  4. The customer speaks.
  5. Match the customer's words with existing intentions. If no appointment intention is matched, notify the customer of an unknown intention.
  6. If the appointment intention (with four mandatory slots: appointed department, doctor, date, and time) is matched, ask the customer for the appointed department, doctor, date, and time.
  7. If the customer replies the preceding information, notify the customer of the appointment information and ask the customer whether to confirm the appointment.
  8. The customer replies.
  9. Match the customer's words with existing intentions (whether to confirm the appointment).
    1. If the intention of confirming the appointment is matched, go to the next step and notify the customer that the appointment is successful.
    2. If the intention of not confirming the appointment is matched, return the previous appointment information to the intention recognition in 5.
    3. If the intention of an incorrect date is matched:
      1. Ask the customer whether to change the appointed date.
      2. The customer replies.
      3. Match the customer's words with existing intentions (whether to change the date).
      4. If the intention of not changing the date is matched, go to the next step and notify the customer that the appointment is successful. If the intention of changing the date is matched, ask the customer for the new date.
      5. The customer replies.
      6. Return the customer's reply and the previous appointment information to the intention recognition in 5.
    4. If no intention is matched, notify the customer of an unknown intention.
  10. Notify the customer that the appointment is successful.
  11. The customer hangs up.

Requirement Analysis

Based on the preceding flow, the following resources and configurations are required.

Table 1 Requirement analysis

Step

Resource

Diagram Element

Node Attribute Settings

Remarks

Start

-

-

-

Initialize the language.

Business interface for initializing the language

Set Cache Variable to GLOBAL.language.

Set Response Attribute to "en_US".

In the actual application scenario, you can invoke a real interface to determine the language. In this chatbot configuration example, this diagram element is used to assign a value. You can directly add a cache variable and assign a value to it to initialize the language, without selecting an interface to be invoked.

For example, to initialize English, set Response Attribute to the following value:

"en_US"

Play the greeting.

-

Set Response Type to TTS.

Set Response Source to Response Variable.

(The TTS dynamically plays a voice based on the value returned by the variable.)

Set Response Variable to FLOW.welcome.

Set Response Mode to Recognition after playback.

Add a flow variable as follows:

Set Variable Name to welcome.

Set Data Type to Character.

Set Default Value to Welcome to the self-service appointment system.

Obtain the customer's reply.

Business interface for caching the dialog interaction result.

Set Cache Variable to FLOW.ask.

Set Response Attribute to IVRREQUEST.input.

You can directly add a cache variable without selecting an interface to be invoked.

Add a flow variable as follows:

Set Variable Name to ask.

Set Data Type to Character.

Set Default Value to Appoint ${FLOW.docSlot}'s ${FLOW.roomSlot} at ${FLOW.timeSlot} on ${FLOW.dateSlot}.

Recognize intentions (whether intentions are matched).

Intention template for appointment

Set Semantic Recognition Content to FLOW.ask.

Set the following variables:

  • Variable for obtaining the department that matches intentions
    • Set Cache Variable to FLOW.roomSlot.
    • Set Response Attribute to TOC.ChatBotroom.
  • Variable for obtaining the doctor that matches intentions
    • Set Cache Variable to FLOW.docSlot.
    • Set Response Attribute to TOC.ChatBotdoctor.
  • Variable for obtaining the date that matches intentions
    • Set Cache Variable to FLOW.dateSlot.
    • Set Response Attribute to TOC.ChatBotdate.
  • Variable for obtaining the time that matches intentions
    • Set Cache Variable to FLOW.timeSlot.
    • Set Response Attribute to TOC.ChatBottime.

In Judgment Conditions, set the following conditions:

  • Condition when the configured appointment intention is matched
    • Set Condition to finish.
    • Set Condition Expression to TOC.ChatBotIntentCode=='finish'.
  • Condition when the command word of the mandatory department slot of the configured appointment intention is matched
    • Set Condition to room.
    • Set Condition Expression to TOC.ChatBotIntentCode=='room'.
  • Condition when the command word of the mandatory doctor slot of the configured appointment intention is matched
    • Set Condition to doctor.
    • Set Condition Expression to TOC.ChatBotIntentCode=='doctor'.

Add flow variables as follows:

Set Variable Name to roomSlot.

Set Data Type to Character.

Set Variable Name to docSlot.

Set Data Type to Character.

Set Variable Name to dateSlot.

Set Data Type to Character.

Set Variable Name to timeSlot.

Set Data Type to Character.

Obtain the department that the customer needs to appoint.

(The room condition is matched.)

Business interface for querying departments

Set Cache Variable to FLOW.answer.

Set Response Attribute to FLOW.room + TOC.ChatBotRespContent.

You can directly add a cache variable without selecting an interface to be invoked.

Add flow variables as follows:

Set Variable Name to answer.

Set Data Type to Character.

Set Variable Name to room.

Set Data Type to Character.

Set Default Value to Currently, the available departments are Internal Medicine and Surgery.

-

Set Response Type to TTS.

Set Response Source to Response Variable.

(The TTS dynamically plays a voice based on the value returned by the variable.)

Set Response Variable to FLOW.answer.

Set Response Mode to Recognition after playback.

-

Obtain the doctor that the customer needs to appoint.

(The doctor condition is matched.)

Business interface for querying doctors in a department

Set Cache Variable to FLOW.answer.

Set Response Attribute to FLOW.doctor + TOC.ChatBotRespContent.

You can directly add a cache variable without selecting an interface to be invoked.

Add flow variables as follows:

Set Variable Name to answer.

Set Data Type to Character.

Set Variable Name to doctor.

Set Data Type to Character.

Set Default Value to Dr. Liu and Dr. Li are on duty in the current department.

-

Set Response Type to TTS.

Set Response Source to Response Variable.

(The TTS dynamically plays a voice based on the value returned by the variable.)

Set Response Variable to FLOW.answer.

Set Response Mode to Recognition after playback.

-

Notify the customer of the appointment information.

(The finish condition is matched.)

-

Set Response Type to TTS.

Set Response Source to Response Variable.

(The TTS dynamically plays a voice based on the value returned by the variable.)

Set Response Variable to TOC.ChatBotRespContent.

Set Response Mode to Playback only; no recognition or key presses.

-

Send the default reply.

(No condition is matched.)

-

Set Response Type to TTS.

Set Response Source to Response Variable.

(The TTS dynamically plays a voice based on the value returned by the variable.)

Set Response Variable to TOC.ChatBotRespContent.

Set Response Mode to Playback only; no recognition or key presses.

NOTE:

If no condition is matched on a connection line, the flow goes to the default branch.

Ask whether to confirm the appointment information.

-

Set Response Type to TTS.

Set Response Source to Response Variable.

(The TTS dynamically plays a voice based on the value returned by the variable.)

Set Response Variable to FLOW.check.

Set Response Mode to Interruption recognition.

Add a flow variable as follows:

Set Variable Name to check.

Set Data Type to Character.

Set Default Value to Are you sure you want to confirm the preceding information?

Recognize intentions (whether intentions are matched).

Intention template for confirmation

In Judgment Conditions, set the following conditions:

  • Condition when the intention of confirming the appointment information is matched
    • Set Condition to yes.
    • Set Condition Expression to TOC.ChatBotconfirm=='yes'.
  • Condition when the intention of not confirming the appointment information is matched
    • Set Condition to no.
    • Set Condition Expression to TOC.ChatBotconfirm=='no'.
  • Condition when the intention of an incorrect date is matched
    • Set Condition to part.
    • Set Condition Expression to TOC.ChatBotconfirm=='incorrect date'.

-

Use a cache variable to cache data and recognize semantics to confirm the customer's appointment information.

(The no condition is matched.)

-

Set Cache Variable to FLOW.ask.

Set Response Attribute to 'Appointment'.

You can directly add a cache variable without selecting an interface to be invoked.

Confirm whether the customer wants to change the date.

(The part condition is matched.)

Response template for confirming whether to change the date

Set Response Type to TTS.

Set Response Source to Response Template.

(The TTS dynamically plays a voice based on the value returned by the variable.)

Set Response Template to redate.

Set Response Mode to Interruption recognition.

Add a response template.

Intention template for confirmation

In Judgment Conditions, set the following conditions:

  • Condition when the intention of not changing the date is matched
    • Set Condition to yes.
    • Set Condition Expression to TOC.ChatBotconfirm=='yes'.
  • Condition when the intention of changing the date is matched
    • Set Condition to no.
    • Set Condition Expression to TOC.ChatBotconfirm=='no'.

-

Ask for the new date and recognize semantics to confirm the appointment information.

(The no condition is matched.)

Set Cache Variable to FLOW.dateSlot.

Set Response Attribute to ''.

Set Cache Variable to FLOW.answer.

Set Response Attribute to 'What date would you like to appoint?'

You can directly add a cache variable without selecting an interface to be invoked.

Set Response Type to TTS.

Set Response Source to Response Variable.

(The TTS dynamically plays a voice based on the value returned by the variable.)

Set Response Variable to FLOW.answer.

Set Response Mode to Interruption recognition.

-

Set Cache Variable to FLOW.dateSlot.

Set Response Attribute to IVRREQUEST.input.

Set Cache Variable to FLOW.ask.

Set Response Attribute to 'Appoint '+FLOW.docSlot+''s '+FLOW.roomSlot+' at '+FLOW.timeSlot+' on '+FLOW.dateSlot.

You can directly add a cache variable without selecting an interface to be invoked.

Notify the customer of the appointment information and play a thank-you message.

(The yes condition is matched.)

-

Set Response Type to TTS.

Set Response Source to Response Variable.

(The TTS dynamically plays a voice based on the value returned by the variable.)

Set Response Variable to FLOW.thanks.

Set Response Mode to Playback only; no recognition or key presses.

Add a flow variable as follows:

Set Variable Name to thanks.

Set Data Type to Character.

Set Default Value to The appointment is successful. Thank you. Goodbye.

End

-

-

-

To ensure fault tolerance, you need to configure an unknown intention for situations where no intention is matched.

In intention recognition, the following information needs to be further analyzed. The following takes the appointment intention as an example. Other intentions can be analyzed using a similar method.

  • Statements that the customer may use to reply appointment information. (corpus)
    • I want to see a doctor.
    • Appointment
    • I want to make an appointment.
    • I want to appoint Dr. Li's Internal Medicine at 16:00 tomorrow afternoon.

    Consider as many scenarios as possible to ensure the accuracy of intention matching.

  • Information that needs to be obtained from the customer's reply. (slot and entity)

    For example, if the customer replies "Appoint 16:00", "16:00" is the slot information that needs to be obtained. You need to add the slot information to the intention. The slot information needs to be associated with a time entity, so you need to check whether a similar entity exists in entity configuration. In this example, you can use the system entity @system.time.

    If the customer replies "Appoint Dr. Li", "Dr. Li" is the slot information that needs to be obtained. You need to add the slot information to the intention. The slot information needs to be associated with a doctor entity but the entity does not exist among system entities, so you need to manually add the entity.

  • Command word used for intention matching, that is, the value of TOC.ChatBotIntentCode required by the Semantic Recognition diagram element, which must be globally unique. (response)

    Branch conditions can be set for responses in the intention. You can directly add branches to reply different values of TOC.ChatBotIntentCodes.