Intent Detection III - Incorporating Robin

This tutorial includes a video and written guide to walk you through incorporating Robin, Automation Hero's virtual assistant, from start to finish.

The Problem to Solve

You want to add a human-in-the-loop so people can confirm the AI model's prediction about change of address requests and then re-train the AI model for improved accuracy. 

Prerequisites

Complete the Intent Detection AI Model Building tutorials.

Video - Change of Address  Intent Detection - Robin Integration


Create a Robin User

  1. Open the Hero_Flow dashboard.
  2. Click Administration.
  3. Click Users.
  4. Click Create new User.
  5. Fill out the user form selecting Robin as the role for the user.
  6. Click OK.

Create a Connection to Robin

  1. Open the Hero_Flow dashboard.
  2. Click Connections.
  3. Click Create New Connection.
  4. Enter RobinApplication for the Connection name and select RobinSkill for the Connection type.
  5. Click OK.

Create a New SMTP Output

The following two SMTP outputs from AI Model Tutorial 2 are also required.

  1. Open the Hero_Flow dashboard.
  2. Click Outputs.
  3. Click Create New Output.
  4. Enter Intent_AddressValidation_Robin for the Connection name and select GMAIL_SMTP for the Connection.
  5. Enter New Change of Address Request - Need your Input for the subject.
  6. Enter the template text in HTML format for the email body.

     Email body text

    <html>

    <body>

    Dear Agents,

    <br/>

    <br/>

    A new request just came in and I wasn't able to determine its intent.


    Could you please assist me in successfully determining the intent of this e-mail. 


    Please follow this link: https://<your Automation Hero URL>/robin-app


    <br/>

    <br/>


    Kind regards,


    <br/><br/><br/><br/>

    --

    <br/><br/><br/><br/>

    Original email:

    <br/>

    <br/>

    {{EMAIL_CONTENT}}

    --

    <br/><br/><br/><br/>

    Change of Address Intent Probability: {{pIntent}}

    </body>

    </html>

  7. In the field mapping table, click Add field:
    1. Enter EMAIL_CONTENT as the name and select STRING as the data type.
    2. Enter pIntent as the name and select DOUBLE as the data type.
  8. Click OK.

Create a Robin Output

  1. Open the Hero_Flow dashboard.
  2. Click Outputs.
  3. Click Create New Output.
  4. Enter Address Change Intent Validation_Robin for the Connection name and select RobinApplication for the Connection.
  5. Enter Address Change Intent Validation for the Skill name and enter a description. 
  6. In the field mapping table, click Add field:
    1. Enter sender as the name and select STRING as the data type.
    2. Enter subject as the name and select STRING as the data type.
    3. Enter email as the name and select STRING as the data type.
    4. Enter date as the name and select STRING as the data type.
    5. Enter pIntentStr as the name and select STRING as the data type.
    6. Enter agentIntentStr as the name and select STRING as the data type.
  7. Click Next.
  8. In the Task list editor, move and title the following fields from the Tuple field list to the Robin Task List table Headers:
    1. sender : Sender
    2. date : Date Received
    3. pIntentStr : AI Model Intent
    4. agentIntentStr : Agent Intent Response
  9. Click Next.
  10. In the Field schema editor:
    1. Change the UI type for the "email" field to Text Area.
    2. Change the Edibility for "agentIntentStr" to Required.
  11.  Click Next.
  12. Edit the layout of the Robin form to your preference by dragging and dropping the field names into the black box. 
  13. Select Sender for the task Header.
  14. Click Next.
  15. Mark the box of the user name created above in this tutorial to assign this user permission to access this Robin skill in the application. 
  16. Click Save.

Create a File System Output for Non Change of Address Requests

The Dropbox Connection from AI Model Tutorial 1 is required.

  1. Open the Hero_Flow dashboard.
  2. Click Outputs.
  3. Click Create New Output.
  4. Enter No-AddressChagneValidatedResponses for the Connection name and select your Dropbox Connection.
  5. Enter the same name as the original file with "-no" at the end for the file path. (Example: address-change-dataset-mid-no.csv)
  6. In the field mapping table, click Add field:
    1. Enter sentence as the name and select STRING as the data type.
    2. Enter label as the name and select DOUBLE as the data type.
  7. Click OK.

Create a File System Output for Change of Address Requests

  1. Open the Hero_Flow dashboard.
  2. Click Outputs.
  3. Click Create New Output.
  4. Enter Yes-AddressChagneValidatedResponses for the Connection name and select your Dropbox Connection.
  5. Enter the same name as the original file with "-no" at the end for the file path. (Example: address-change-dataset-mid-yes.csv)
  6. In the field mapping table, click Add field:
    1. Enter sentence as the name and select STRING as the data type.
    2. Enter label as the name and select DOUBLE as the data type.
  7. Click OK.

Create a File System Input for the Post Processing Flow

  1. Open the Hero_Flow dashboard.
  2. Click Inputs.
  3. Click Create New Input.
  4. Enter Intent_Detection_Robin for the Connection name and select your Robin Connection.
  5. Select Delete data for the post processing action. 
  6. Select Address Change Intent Validation for the Robin skill name.
  7. Click OK.

Edit the Input for the Original DATASETS_Input

  1. Open the Hero_Flow dashboard.
  2. Click Inputs.
  3. Locate DATASETS_Input and click the settings icon and select Edit.
  4. Edit the file path to include an asterisk at the end of the file. (Example: address-change-dataset-mid*.csv)
  5. Click OK.

Clone the Original Flow

  1. Open the Hero_Flow dashboard.
  2. Click Flows.
  3. Locate Intent_detection_Address_Change and click the settings icon and select Clone.
    1. Click Yes, Clone.
  4. Enter Intent_detection_Address_Change_Robin for the Flow name.
  5. Click Save.

Create a Flow with Robin Integration

  1. Open the Hero_Flow dashboard.
  2. Click Flows.
  3. Click to open the new cloned Flow (Intent_detection_Address_Change_Robin).
  4. Click on the + button to the right of the IsLessThanOrEqual filter.
  5. Select the Concat function.
    1. Click Add argument field and select label as the argument.
    2. Enter Label for the Output field name. 
    3. Click OK.
  6. Click on the + button to the right of the Concat function.
  7. Select the FormatDate function.
    1. Select SENT_DATE for the argument.
    2. Enter SentDate for the Output field name.
    3. Click OK.
  8. Click on the + button to the right of the FormatDate function.
  9. Select the ConstantString function.
    1. Enter AgentDistList for the Output field name.
    2. Enter <the actual distribution email address used to receive the Robin application link> for the string constant.
    3. Click OK.
  10. Click on the + button to the right of the ConstantString function.
  11. Select the List function.
    1. Click Add argument field and select AgentDistList as the argument.
    2. Enter AgentDistList for the Output field name.
    3. Click OK.
  12. Click on the + button to the right of the List function.
  13. Select the ConstantString function.
    1. Enter AgentResponse for the Output field name.
    2. Enter NO for the string constant. 
    3. Click OK.
  14. Right click on the SMTP Output and select Delete. (The original SMTP Output in this section of the Flow above is no longer needed.)
  15. Click Yes, Delete.
  16. Click Add Output to the right of the ConstantString function.
  17. Select the Output Intent_AddressValidation_Robin.
    1. Click OK.
    2. Select the following Input fields.
      1. SENDER_ADDRESS for the Output field "From".
      2. AgentDistList for the Output field "Reciever_To".
      3. EMAIL_CONTENT for the Output field "EMAIL_CONTENT".
      4. label for the Output field "pIntent".
    3. Click OK.
  18. Click the + button located under the Output that was just created. 
  19. Select the Output Intent_Change_of_Address_Directed
    1. Click OK.
    2. Select the following Input fields.
      1. SENDER_ADDRESS for the Output field "From".
      2. SENDER_ADDRESSES for the Output field "Reciever_To".
      3. EMAIL_CONTENT for the Output field "EMAIL_CONTENT".
      4. label for the Output field "pIntent".
    3. Click OK.
  20. Click the + button located under the Output that was just created. 
  21. Select the Address Change Intent Validation - Robin Output. 
    1. Click OK.
    2. Select the following Input fields.
      1. SENDER_ADDRESS for the Output field "sender"
      2. SUBJECT for the Output field "subject"
      3. EMAIL_CONTENT for the Output field "email"
      4. SentDate for the Output field "date".
      5. Label for the Output field "pIntentStr"
      6. AgentResponse for the Output field "agentIntentStr"
    3. Click OK.
  22. Click Save in the toolbar at the top of the screen to save the Flow.

Create a Flow for Processing Data Submitted by Robin Agents

This Flow processes the data submitted by a Robin agent and writes the data to the "yes" and "no" dataset files created earlier in this tutorial. 

  1. Open the Hero_Flow dashboard.
  2. Click Flows.
  3. Click Create New Flow.
  4. Enter Intent_detection_Address_Change_Postprocess.
  5. Click OK.
  6. Click Add Input.
  7. Select Intent_Detection_Robin (the Robin Input). 
  8. Click OK.
  9. Click on the + button to the right of the Robin application Input.
  10. Select the Multiple Constants function.
    1. Click Add field and enter labelOutputNo as the field name.
      1. Select DOUBLE for the data type.
      2. Enter 0.0 for the value.
    2. Click Add field and enter noResponse the field name.
      1. Select STRING for the data type.
      2. Enter NO for the value.
    3. Click Add field and enter yesResponse as the field name.
      1. Select STRING for the data type.
      2. Enter YES for the value.
    4. Click Add field and enter labelOutputYes as the field name.
      1. Select DOUBLE for the data type.
      2. Enter 0.0 for the value.
    5. Click OK.
  11. Click on the + button to the right of the Multiple Constants function.
  12. Select the Contains filter.
    1. Select yesResponse for the argument.
    2. Enter YES for the token.
    3. Click OK.
  13. Click on the split button to the right of the Multiple Constants function. (This splits the Flow into two different paths.)
  14. Select the Contains filter.
    1. Select noResponse for the argument.
    2. Enter NO for the token.
    3. Click OK.
  15. Click on the Add Output to the right of the Contains filter with the YES token.
  16. Select the Yes-AddressChangeValidatedRepsonses Output.
    1. Click OK.
    2. Select the following Input fields.
      1. email for the Output field "sentences"
      2. labelOutputYes for the Output field "label"
    3. Click OK.
  17. Click on the Add Output to the right of the Contains filter with the No token.
  18. Select the No-AddressChangeValidatedRepsonses Output.
    1. Click OK.
    2. Select the following Input fields.
      1. email for the Output field "sentences"
      2. labelOutputNo for the Output field "label"
    3. Click OK.
  19. Click Save in the toolbar at the top of the screen to save the Flow.

Send Example Customer Emails

In this example, send three emails to the email address associated with the Flow. One email being a true change of address request.

  1. Open any email service.
  2. Compose three emails. One email is a true change of address request and two emails are not address change requests.
    1. The email recipient for all three emails is the email address of your IMAP Input.
    2. Example email texts:
      1.  Email 1 - True Address Change Request

        Subject:

        Address Change Request

        Body:

        Good day,

        Our offices recently moved to a new space. Please modify our billing address to 5416 Business Court 34 Pawnee, IN. 12345.

        Thanks.

      2.  Email 3 - False Address Change Request

        Subject:

        Request to book a flight

        Body:

        Hello,

        Please book me a ticket from London to California on the 7th of July 2020. 

        Have a nice day.

      3.  Email 2 - False Address Change Request

        Subject:

        Change of Reservation

        Body:

        Hello,

        I would like to move our 17:00 o'clock appointment to 20:00 o'clock on the 5th of May.

        Thank you.

  3. Send all three emails.

Run the First Flow

  1. Open the Hero_Flow dashboard.
  2. Click Flows.
  3. Open the Flow Intent_detection_Address_Change_Robin.
  4. In the toolbar at the top of the screen, click Run Now.

Check First Flow Results

  1. Open the email account from where the three emails were sent. 
    1. You should see three responses sent from an SMTP Output.
      1. One email notifying that the change of address request was successfully processed.
      2. Two emails notifying that the original email was forwarded to a representative. 
  2. Open the email account for the agent distribution list. 
    1. You should see two responses sent from an SMTP Output.
      1. Both emails request the agents input and supply a link to the Robin application. Click one of the links in the email.

Use Robin to Complete Tasks

In the step above, after clicking the link in the email, the Robin application opens in your browser.

  1. Log in to Robin with the user name and password set up earlier in this tutorial
  2. Click on the skill titled Address Change Intent Validation.
  3. Click on <a task> with the status Open.
  4. Read the email body to ensure it is not a change of address request.
  5. Confirm that the agent response has the text NO entered. 
  6. Click Submit Next.
  7. Read the email body to ensure it is not a change of address request.
  8. Confirm that the agent response has the text NO entered. 
  9. Click Submit Next.

All tasks have been submitted. 

Run the Second Flow

  1. Open the Hero_Flow dashboard.
  2. Click Flows.
  3. Open the Flow Intent_detection_Address_Change_Postprocess.
  4. In the toolbar at the top of the screen, click Run Now.

Check Second Flow Results

Robin

  1. Open the Robin application.

    If you have closed the Robin application. The Robin application can be accessed by opening a web browser and entering <Your Hero_Flow URL>/robin-app

  2. Refresh the browser screen. In this example you should now see no open or submitted tasks in Robin.

Dropbox

  1. Open Dropbox and navigate to the Apps folder where your Hero_Flow files are located.
  2. Check for the new file added from the post processing Flow: address-change-dateset-mid-no.csv
  3. Open the file and check that the output for both records are set at 0.

Retrain the AI Model

  1. Open the Hero_Flow dashboard.
  2. Click AI Models.
  3. Locate Address_Change_Intent and click the settings icon and select Edit.
  4. Click Save in the toolbar at the top of the screen.
  5. Click OK to create a new revision of the AI model.  
  6. Click Train in the toolbar at the top of the screen.
  7. Click OK to start retraining the AI model

The training may take several minutes to complete. (Estimated at 5-7 minutes)

You can view the real time progress of the training by clicking on details/performance in the bottom right corner of the screen.

Update the AI Model in the Flow

  1. Open the Hero_Flow dashboard.
  2. Click Flows.
  3. Open the Flow Intent_detection_Address_Change_Robin.
  4. Right-click on the AI Model Address_Change_Intent and select Edit.
  5. Select Version 2 for the version.
  6. Click OK.
  7. Click Save in the toolbar at the top of the screen to save the Flow.

Click on the AI Model component in the Flow. Comparing the intent values for the field label shows the values to be more accurate in version 2 with the additional data form Robin trained into the AI model.