LinkedIn
Copied!

Table of Contents

Use case: Building an IVA for Legacy Webchat in the preview console

Version:

Only available versions of this content are shown in the dropdown

For quicker development of Pega Intelligent Virtual Assistant™ (IVA) for Legacy Webchat, build the chatbot by simulating conversations in the preview console. Analyze the responses to your input to make instant changes in the chatbot's configuration, validate the updates, and build the text analytics model, so that the system is more responsive in the future.

In this tutorial, you will learn how to train and build the model to enhance the text analyzer engine that the chatbot uses, and to improve how the model responds based on artificial intelligence algorithms.

Before you begin

To follow the steps in this tutorial, set up a sample Pega Platform application with the Insurance Quote case type and a Legacy Webchat channel.

Create the Insurance Quote case type for car insurance quotes with the following settings:

  1. Add the following data types to the Insurance Quote case type for the car make, model, and vehicle identification number (VIN): carMake, carModel, and carVIN.
    Case type explorer
    Case type explorer

    For more information, see Associating data objects with case types.

  2. Enable Legacy Webchat channel-specific conversations for a stage of the Insurance Quote case type.
    Stage configuration for the Insurance Quote case type
    Stage configuration for the Insurance Quote case type

    For more information, see Adding a conversational channel to a case type process.

  3. Configure conversation questions for a stage process of the Insurance Quote case type by adding three simple questions for the make, model, and VIN data types.
    Sample questions for the Insurance Quote case type
    Sample questions for the Insurance Quote case type

Configure a Legacy Webchat channel with the following settings:

  • In the Content section on the Configuration tab, add the insurance create case command for the Insurance Quote case type.
    Sample create case command for a case type
    Sample create case command for a case type

    For more information, see Adding case commands for a conversational channel.

  • On the Behavior tab, enable advanced text analyzer configuration and add the iNLP text analyzer. Ensure that the IVA can interpret text in both the context of the case and outside of the case context.
    Enabled text analyzers
    Enabled text analyzers

    For more information, see Adding a text analyzer for an IVA.

After you configure these settings for your IVA for Legacy Webchat, the system text analyzer engine can detect when a user requests a car insurance quote in the chat window. As a result, the chatbot will create the Insurance Quote case in the system. The system then asks the three insurance questions about the make, model, and VIN of the car.

Associating topics with user input

Improve the chatbot so that the system can correctly detect topics from user input by simulating a conversation in the preview console. You can associate existing topics with the user input that the chatbot does not recognize correctly, and add more examples of similar user input to improve future responses.

Topics are the general subject matter of a chat conversation that the system detects, for example, a request for a car insurance quote or an enquiry about a bank loan. After updating the text analytics model with samples of user input for the insurance topic, the chatbot correctly detects the subject matter and automatically starts the Insurance Quote case when the user requests information about a car insurance quote.

Associate topics with user input by performing the following steps:

  1. In the navigation pane of App Studio, click Channels.

  2. In the Current channel interfaces section, click the icon that represents your existing Legacy Webchat channel.

  3. In the channel, click the Behavior tab.

  4. In the preview console in the right panel, enter a request for a car insurance quote.

    Enter: Give me a car quote please.
    Sample car insurance question that is unassociated with any topics
    Sample car insurance question that is unassociated with any
                                topics
    The IVA for Legacy Webchat does not recognize the request for a car insurance quote because no topic is associated with the entered text.
  5. Click Define topic below the entered text.

  6. In the Topic field, press the Down arrow key, and then select the correct topic.

    Select insurance.
  7. Optional:

    To associate the topic with additional similar user input, perform the following steps:

    1. In the field below the topic name, enter more sample user input for the insurance topic.

      Enter: I need a car quote.
    2. Click Add example and add additional sample user input for the insurance topic.

      Enter: How can I get a car quote?
      Associating user input with a topic
      Associating user input with a topic
    3. To define additional user input, repeat step 7.b.

  8. Click Submit.

    Sample topic that is associated with user input
    Sample topic that is associated with user input
    The insurance topic is now associated with the user input that appears above the topic name.
  9. Rebuild the model by clicking Build model.

    The chatbot learns how to respond to this user input and the additional two examples that you provided. To further enhance the text analytics model, ensure that the correct topic is associated with the user input samples, and to improve the chatbot responses, add more examples of the same user input and rebuild the model a few more times.

Configuring and mapping entities to case type properties

Train the chatbot to detect the correct entities from user input when a user requests an insurance quote, by simulating a conversation in the preview console. When you enter text and receive replies in the preview console, you can also define entities that are missing from user input. As a result, the system automatically adds the detected information about car makes and models from the actual chat conversations with users to the created Insurance Quote case properties.

Entities are short phrases detected in the conversation, for example, an email address, car make, or car model. In the example below, create the Carmakeent and Carmodelent entities to associate them with the car make and model in the user input. Map these two entities to the .carMake and .carModel case properties that you define for the Insurance Quote case, respectively.

  1. In the preview console, enter a request for an insurance quote.

    If the correct topic is already associated with your input, you can improve the chatbot's future responses in the model by clicking the Like icon next to the topic name, and then rebuilding the model.
    Sample request for a car insurance quote showing the detected topic and Like icon
    Sample request for a car insurance quote showing the detected topic
                                and Like icon
    Based on the insurance keyword, the chatbot correctly associates the text with the Insurance Quote case type, starts a case, and responds by asking the first question about the make of the car. The #insurance label below your request represents the topic, while the horizontal line indicates the start of case number I-60.
  2. Display more information about the conversation and the case by turning on the Show analysis switch

    Sample user input analysis
    Sample user input analysis
    The analysis shows that the system classified the sentiment of the text that you entered in the previous step as neutral, and that the insurance topic was guessed with 97 percent confidence. The chatbot did not detect any entities in your input, even though the text included the make of a car (Ford), and the model of a car (Mustang GT).
  3. Associate new entities with "Ford" and "Mustang GT" from the text that you entered in step 1 by performing the following steps:

    1. Select and right-click Ford in the displayed text, and then click New entity.

    2. In the Entity name field, enter: Carmakeent

    3. Click Submit.

    4. Select and right-click Mustang GT in the displayed text, and then click New entity.

    5. In the Entity name field, enter: Carmodelent

    6. Click Submit.

    Sample user input analysis with mapped entities
    Sample user input analysis with mapped entities
    The system maps the two entity types that you create to the make and model of the car in the text, Ford and Mustang GT, respectively.
  4. Map the extraction of the two entity types that you created to case properties, by performing the following steps:

    1. In the Create case section, click the Open response configuration icon.

    2. In the Response configuration dialog for the Insurance Quote case type, click the Entities extraction tab.

    3. Click Add mapping.

    4. In the Entity list, select Carmakeent.

    5. In the Case property list, select carMake.

    6. Click Add mapping.

    7. In the Entity list, select Carmodelent.

    8. In the Case property list, select carModel.

    9. Click Submit.

      The Response configuration dialog box for case type commands
      The Response configuration dialog box for case type
                                        commands
  5. Build the model and refresh the updated entity information in the chatbot by clicking Build model.

Testing changes in the chatbot

After creating new entities, mapping the extraction of the entities to case properties, and rebuilding the model, you can test your changes to ensure that the chatbot responds correctly. In the preview console, verify that the chatbot automatically extracts the information about the car make and model that you mapped to the entities, and saves this information in the related Insurance Quote case properties.

When you provide the car make and model in a request for information about car insurance, the chatbot automatically skips the first two questions for which it recognized the answer and assigns the details to the Insurance Quote case properties.

  1. In the preview console, click Reset.

  2. Enter the same text as in step 1 of the Configuring and mapping entities to case type properties section to request an insurance quote.

    Sample insurance quote
    Sample insurance quote
    If the correct topic is already associated with your input, you can improve the chatbot's future responses in the model in the future by clicking the Like icon next to the topic name, and then rebuilding the model.
    Enter: I would like to obtain an insurance quote for my Ford Mustang GT.
    The chatbot correctly associates the text with the Insurance Quote case type, and starts a case. However, this time the bot asks only the third question about the VIN number of the car.
  3. Display more information about the conversation and the case by turning on the Show analysis switch.

    Sample user input analysis with mapped entities and skipped questions
    Sample user input analysis with mapped entities and skipped
                                questions
    The first and the second question about the make and model of the car are greyed out because they were skipped. The reason that they were skipped is that the Carmakent and Carmodelent entities were successfully extracted from your input, and automatically mapped to the .carMake and .CarModel case properties, respectively.

Conclusion

You made configuration changes to the chatbot algorithm, rebuilt the text analytics model, and successfully verified that the system improves how it responds to user requests for car insurance quotes. If the chatbot detects the correct topic and entities in user input, the system automatically skips the first two questions that it recognized the answer for, and then assigns the details to the Insurance Quote case properties.

After you have successfully built the chatbot and tested its responses in the preview console, move the system to the production environment.
Did you find this content helpful?

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.