Using task
    • PDF

    Using task

    • PDF

    Article Summary

    Available in Classic and VPC

    Using a task allows the collection of information through conversations with users and handling complex conversations based on the collected information such as viewing the user points and processing parcel returns, in addition to understanding the user's question and providing the optimal answer.
    More polished conversations can be facilitated using the task feature, but more attention is needed in the creation process since the entity design has to be very precise and there are restricting conditions to execute them.

    Task summary

    It explains the concepts you need to know before starting to design tasks.

    1. Concept of slot and entity
    A slot means a blank field that the user has to fill. The user must fill in all the slots (blank fields) asked by the chatbot to complete the preparation for performing a task.
    An entity means specifying content to be contained in slots. Entities are mapped with slots.
    For example, if the @pizzaquantityunit entity with dictionary data such as 1 pizza, 2 pizzas, 3 pizzas registered is mapped to the slot of "quantity" in a pizza-ordering scenario, the "@pizzaquantityunit" entity is analyzed from the user's utterance to fill in the blank field of the "quantity" slot. Thus, if 3 slots are set in a task, then 3 entities to be contained in the 3 slots must be defined as well.

    2. How task works
    As a task can be performed only when all the slots required for performing the task are filled, the chatbot repeatedly asks questions to the user until all the slots are filled in. When all the slots are filled, the chatbot can respond with the final answer and perform the task.
    If the slots haven't been filled until the number of questions set in advance is exceeded, then the chatbot can't perform the task. In this case, the chatbot won't be able to respond with the final answer, but it will return the exceeded question count message and end the task. On the other hand, a task can also be ended when the user expresses the intent that they do not wish to perform the task anymore. (If the task end keyword and message are set up.)

    3. Flow between tasks and general conversations
    The user may ask different questions in the process of filling in the task slots. For example, let's say the user's ordering a pizza. Various inquiries may be sent to the chatbot in the middle of the conversation, such as how delivery fees are decided, what kind of pizzas there are, and whether a bulk order can be made. The chatbot can be designed to leave the task temporarily if the user asks a question unrelated to filling the slots, go to another conversation to answer the query, and then return to the task again.

    4. Previous slot retention
    A task can also be designed using the context feature where the chatbot remembers the previous conversations. If the user asks about "the weather in Seoul today," and then follows up with "How about tomorrow?" then the chatbot can remember the location information "Seoul," as mentioned by the user just now without asking the user and say about the weather in Seoul tomorrow. In order to design such a task, you have to retain and load the "location" slot information from the previous task connected with the context.

    Task design

    Depending on the chatbot's scenario, you can choose from a general conversation or task. Using tasks is recommended if you have to develop a chatbot collecting various information through interactive conversations with users, such as ordering pizza or returning packages.
    The information to fill the slots are received through a task, and the chatbot responds with the final answer when all required slots have been filled in. The slot's value expressions can be used to respond with an answer that utilizes the user's utterance.
    For example, if the values of a pizza's type, size, and beverage need to be received from the user in a pizza-ordering scenario, create entities for the information that needs to be received, and connect the entities to the slots when creating the task. The chatbot will receive the user input until all slots necessary to order the pizza are filled. Once all the slots are filled, the chatbot can receive the order based on the information.

    Create task

    The following describes how to create a task.

    1. Create a conversation by referring to Enter conversation information.
    2. From the top of the conversation information area, click the [Advanced settings] button > [Conversation type] tab, and change the conversation type to Task.
      chatbot-chatbot-chatbot-chatbot-3-6_task01_en
    3. Register a question.
      • This is a question with which a task can be executed. If the user enters the question, or the chatbot judges the user question to be similar enough, then the task is executed.
      • If the user's utterance already contains information that can be used to fill in the slots, then the chatbot starts the task after filling in the slots automatically. For example, if the user enters the question "Order me a potato pizza" in a task where the pizza type, pizza size, and beverage slots need to be filled, the slot for the pizza type is automatically filled, and the chatbot will only ask questions to fill the pizza size and beverage slots.
        chatbot-chatbot-chatbot-chatbot-3-6_task02_en
    4. Enter slot information.
      A chatbot will fill the slots in the order they were registered. However, if the user responses to a later slot or multiple slots at once, regardless of the slot-filling order the chatbot tries to fill in, the chatbot won't ask about the slots that already have responses and urges the user to fill the next slot.
      • Required: When the slots with the Required checkbox marked are not filled in, the task will not be performed, and the final answer will not be provided. If the Required checkbox is left deselected, then the task will continue, even if the information for this slot is not filled.
      • Slot: Enter the slot name. Enter it to be a value that is not duplicated within the task.
      • Entity: Select the entity to be mapped with the slot. Both the domain entity and system entity can be used.
      • Value: The value of the slot filled in by the user can be inserted and provided in the final answer. Please enter the expression for using the value of the slot that has been filled in.
      • Asking back question: Enter the questions to ask in order to fill the slots. The chatbot will go through the asking back questions to fill the slots in the order in which the slots are listed.
        chatbot-chatbot-chatbot-chatbot-3-6_task03_en
    5. Click the [Add] button when you've entered all slot information.
    6. Click the Other settings icon to specify detailed slot settings.
    7. Register the final answer.
    8. Set the task end message.
      • Set the task end keyword and message, so that the user can force-end the task if there's a circumstance in which the user would like to stop the conversation immediately during the task.
      • For how to set a task end message, refer to Register task end message.

    If the final answer calls for action method V1.0
    The entities filled in the task are sent as included in the X-KAA-USERENTITY header. The entity's key value is included in the X-KAA-USERENTITY header and sent after being encoded as URL in UTF-8, and at this time, the key value of the entity prior to being encoded follows the following format.

    "Entity name = Word entered by the user"
    

    If the final answer calls for action method v2.0
    The entities appeared in the task are sent contained in userInfo.taskEntities.

     "userInfo": {
        "id": "user ID",
        "key": "user key",
        "query": "question entered by user",
        "entities": {
          "Entitycode1": "wordenteredbyuser1",
          "Entitycode2": "wordenteredbyuser2"
        },
        "taskEntities": {
          "Entityname1": "wordenteredbyuser1",
          "Entityname2": "wordenteredbyuser2"
        }
    

    Other slot settings

    You can change the details settings about slots in the other settings window.

    Option settings tab
    Display the options for filling in slots in the quick reply format. Up to 10 options can be displayed.

    • Select representative term: Import the list of entity representative terms and display them as options
    • Enter text: Directly enter the options as text and display them as options
    • Existing asking back options: Import the options of another task and display them as options

    chatbot-chatbot-3-6_setting01_en

    Slot settings tab
    Validate the entity with which the user responded through the URL entered in the slot settings tab before filling it in the slot. The slot can only be filled when validation has succeeded and if validation fails, the slot will not be filled in.

    chatbot-chatbot-3-6_setting02_en

    The slot validation request format is as follows.

    {
      "userInput": "Utterance entered by the user",
      "represent": "Representative term of the value entered by the user",
      "filledEntity": {
        "Entity name filled to date 1": "Entity1",
        "Entity name filled to date 2": "Entity2"
      },
      "userKey": "Key value hashed for user classification. It's identical to the userKey contained in the header when called from action method."
    }
    

    The slot validation response format is as follows.

    • valid: Validation success (true) or failure (false) status. Only the value that has been successfully validated can be filled in the slot.
    • recover: It sets whether the number of asking back questions should be deducted if the slot validation fails. If it is true, then the number of asking back questions will not be deducted.
    {
      "message": "Message for responding to the user",
      "valid": true,
      "recover": false
    }
    

    Asking back settings tab

    • Asking back question: Enter the message that will be provided as a response when the number of asking back questions has been exceeded. If the number of asking back questions has been exceeded for required slots and the slots are still not filled, then the final answer will not be provided. The response is replaced with the exceeded question count message entered in the [Asking back settings] tab. If no exceeded asking back question count message is entered, then the response is made with an answer matched with the current user's utterance or a failure message.
    • Number of asking back questions: Specify the number of asking back questions to be returned. The chatbot repeats the question to the user as many times as the set number of asking back questions in order to fill in the slots.

    chatbot-chatbot-3-6_setting03_en

    Value type
    Select which method to be used when importing and using the value of the slot, filled in by the user, in the final answer or asking back questions.

    • Substitution value of representative term: Import and use the value substituted as a representative term rather than the value with which the user responded. The substitution value of a representative term can only be used for dictionary entities.
    • Normalize value: This is an option available when the Normalize syntax was used to define patterns in pattern entities. Import and use the value substituted with a designated text rather than the value with which the user responded. The Normalize values can only be used for pattern entities.
    • User response value: Import and use the exact value with which the user responded.
      For example, let's say that you've registered "representative term: combination pizza," similar term: "combination," "combi pizza" in the "@pizza" entity and selected "Substitution of representative term" in the Other settings > Type value settings tab. If the user responded "combi pizza" and filled the pizza slot, then the chatbot may respond with ""combination pizza" has been ordered," instead of ""combi pizza" has been ordered" as its final answer.
    • Default value: The default value is only enabled for the required slots. If the user was unable to fill in the required slots, then the task does not fail, and the input default value can be used to fill in the slots. For example, if the user is unable to fill the pizza quantity slot while the "@pizzaquantity" entity has the default value of "1" registered, the slot is automatically saved with the default value "1" filled in.
      chatbot-chatbot-3-6_setting04_en

    Previous conversation slot retention tab
    Previous conversation slot retention: If all slots are filled in and the context is retained in a conversation, then the chatbot can remember the slot information filled instead of deleting it to use it for another task. Only the slots registered in conversations connected with context can be retained. Thus, the design must allow conversations, where the slots to be retained are registered, to be connected with context.
    chatbot-chatbot-3-6_setting05_en

    Task end message

    You can set it up so that of the user inputs the task end keyword while a task is in progress, then the task is ended immediately and the task end message is returned. The task end keyword only works when the task is in progress, not during a general conversation. Up to 10 end keywords can be registered, and they only work when the exact same question is entered.

    Task design examples

    Responding with an FAQ answer while performing a pizza order task

    You can compose a scenario where the user enters a question registered in an FAQ conversation during a pizza order task, and the chatbot leaves the task and finds the answer to the user's question in the FAQ conversation to respond, and then returns to the task. After creating the FAQ answer conversation and the pizza ordering task conversation, Leave task for the pizza order task is enabled, and Interrupt task and Return to task are enabled in the FAQ conversation.

    Create entities
    Create pizza, pizza size, pizza count, and beverage entities.

    • Please refer to Entity for how to create entities.
      chatbot-chatbot-3-6_entity01_en

    Create action method
    Create an action method to be called with the slot information filled by the user.

    • For how to create action methods, refer to Action method.
    • We'll create an action method which receives the slot information and orders pizza in this scenario.
      chatbot-chatbot-3-6_action01_en

    Create task
    Create a conversation using the entities and action method.

    1. Create a conversation by referring to Register conversation information.
    2. Click the Advanced settings button in the conversation information area, and then change the conversation type to Task in the [Conversation type] tab.
    3. Enter a question with the intent of ordering pizza.
      • I'd like to order a pizza, what kind of pizzas do you have, etc.
    4. Add slots by using pizza, pizza size, pizza count, and beverage entities created in the task area.
      • Specify pizza, pizza size, and pizza count entities as the required slots
      • Specify the beverage entity as an optional slot
      • Enter the question to ask the user to fill in the slot in the asking back question.
        chatbot-chatbot-3-6_task06_en
    5. Click the Other settings icon from each slot, and adjust the Options settings, Asking back settings, etc., to fit your chatbot service.
      chatbot-chatbot-3-6_setting01_en
    6. Click [Advanced settings] button > [Task flow] tab, and enable Leave task.
      • Configuration which enables the chatbot to leave the task if the user enters a message unrelated to the task and find the answer from another conversation to respond
    7. Select the multiple choice answer type for the final answer, and specify in the answer section of the "Yes" option to call the ${order pizza} action method.
      chatbot-chatbot-3-6_task07_en

    Create FAQ conversation

    Create a conversation with the intent of inquiring about delivery fees.

    1. Create a new conversation and enter questions and answers.
      chatbot-chatbot-3-6_sample1_en
    2. Click [Advanced settings] button > [Task flow settings] tab, and enable Interrupt task and Return to task.
      • Configuration which enables the chatbot to find the answer from the conversation and respond if the user asks about delivery fees, and then return to the task

    Build and test
    Build the chatbot and run a test.
    The following describes how to test if a question about delivery fee during the pizza order task prompts the chatbot to answer about the delivery fee and to return to the pizza order task again.

    1. Click Conversation model build, and complete the build.
    2. Click Manual test once the build is completed.
    3. Test the pizza order task.
      chatbot-chatbot-3-6_sample2_en

    Retaining slots from a previous conversation and responding with weather information

    Let's assume that the user asked the question "What's the weather today in Seoul?" and all slots have been filled for the chatbot to provide answers. If the user asks "How about tomorrow?" and the chatbot remembers and uses the location slot filled from the previous conversation without asking the location information again, then it will be able to naturally answer the location's weather tomorrow.
    Below is an example of a conversation that retains slots from a previous conversation by using context.

    Create entities
    Create the weather and city entities.

    Create action method
    Create an action method to be called with the slot information filled by the user.
    chatbot-chatbot-3-6_sample3_en

    Create task

    1. Create a conversation by referring to Enter conversation information.
    2. Click [Advanced settings] button > Set Conversation type as Task.
    3. Click [Advanced settings] button > Context settings tab, and enter each location's weather in the output context.
      chatbot-chatbot-3-6_sample4_en
    4. Enter a question with the intent of checking on weather.
    5. Add slots in the task area by using date and location entities created in the previous step.
      chatbot-chatbot-3-6_sample5_en
    6. Specify date and city entities as required slots.
    7. Click the Other settings icon, and adjust the Options settings, Asking back settings, etc.
    8. Specify so that the weather action method is called for the final answer.
      chatbot-chatbot-3-6_sample6_en

    Create another task

    1. Create a new task, and enter weather by location in the input context.
      chatbot-chatbot-3-6_sample7_en
    2. Enter the questions that only contain city information, such as "What about Seoul?" and "What about New York?"
      chatbot-chatbot-3-6_sample8_en
    3. Add slots by using the date and city entities created in the previous step.
      • Specify the date and city entities as required slots.
      • Enter various slot information, such as asking back questions, number of asking back questions, and asking back options, to fit your chatbot service.
        chatbot-chatbot-3-6_sample9_en
    4. Open the "date" slot's Other settings window and set it to retain slots from the previous conversation.
      chatbot-chatbot-3-6_sample10_en
    5. Call the ${weather} action method for the final answer.
      chatbot-chatbot-3-6_sample11_en
    6. Test the completed weather task once learning is finished.

    Was this article helpful?

    What's Next
    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.