Create and Hook Up New Chatbot

Disclaimer: Preview version; content and features subject to change. 

Overview

This tutorial is geared towards any researcher and developer who wants to create new NLP content with a chatbot and hook that up to VHToolkit 2.0.

Page Contents

ExampleNLP_OpenAI_GPT-3

Overview

This tutorial shows how the configuration file in VHToolkit 2.0 can be used to use new chatbots, and how to create a new chatbot in AWS Lex V2.

Requirements

  • AWS account
  • AWS admin

How To Edit the VHToolkit 2.0 Config File

Either manually edit with a text editor, or open it up through Unity.

Manual

File locations:

  • Windows: C:\Users\<user>\AppData\LocalLow\USC-ICT\VHToolkit-IVA2023\config\ride.json
  • Mac: Macintosh HD/Users/<user>/Library/ApplicationSupport/.com.UCT-ICT.AvatarTestbed/config/ride.json

Unity

  • Use (Command +) F11 to bring up the debug menu and go to the Config submenu
  • Click Open Folder Location or Edit Config

How To Point Towards a New Chatbot

The ride.json config file has several sections, including one for awsLex. This combines information for both version 1 and version 2 of Lex. We will be using V2.

To change the bot from the default shipped with the VHToolkit 2.0 Preview to a dedicated tutorial example, change the following values:

  • Bot ID: WEMUASPHDU
  • Bot alias ID: NUYJVTFRYZ
  • AccessKey: AKIASLAD6BP52Q7I4G64
  • SecretKey: qzNiABMxlV40oh8fPiZUmQXIxTWVoVMapZ+xC1T+

Save the file, load VHToolkit 2.0 Preview, and choose ExampleNLP. Cycle through the providers on the left until you reach AWS Lex V2. The VHToolkit should automatically send “hello” in order to get the conversation started. For a first time start-up, this may take a few seconds.

How To Create a New AWS Lex V2 Chatbot Based on an Existing One

  • Log into the AWS Console:
  • Search for “Lex” in the AWS Console and click the service
  • AWS Lex will open and will automatically go to V2
    • To verify, see that the lower left menu says “Return to the V1 console”
     
  • To export VHToolkit-IVA-Example:
    • Select the bot
    • From the Action menu at the top right, select Export
    • Default options are good
    • Click Export

  • To import VHToolkit-IVA-Example:
    • Choose Import from the Action menu at the top right
    • Choose name (e.g., VHToolkit-IVA-<Name>)
    • Browse file for the one you just exported
    • For IAM Permissions, select Use an existing role
    • For COPPA, answer “no”
    • Click Import

 

  • To build the new bot:
    • Click on your new bot and go to Intents
    • Click Build at top right
    • Once built, click Test at the top right to test
 

 

To deploy your new bot:

  • Go to Bot versions in the left menu
    • Click on Create version, top right
    • Will automatically be called Version 1
    • Click Create in the new window
  • Go to Aliases in the left menu
    • Click Create alias, top right
    • Choose name (e.g., VHToolkit-IVA-<Name>-Alias)
    • Choose existing Version (1) to associate with
    • Go to the newly created Alias page and ensure that the English language is enabled for this alias under Languages
  • Gather info:
    • Bot ID: click on the bot, ID is under Details (e.g., WEMUASPHDU)
    • Bot Alias: click on the alias, ID is under Details (e.g., NUYJVTFRYZ)
  • Change both in the Config file, together with the provided Access Key and Secret Key

How To Create a New AWS Lex Bot

  • Search for “Lex” in the AWS Console and click the service
  • AWS Lex will open and will automatically go to V2
    • To verify, see that the lower left menu says, “Return to the V1 console”
  • In the “Bots” panel on the left, click Create Bot

  • For IAM permissions, choose “Create a role with basic Amazon Lex permissions”
  • Choose appropriately for all other options

How To Set Up a New AWS Lex V2 Account

  • General overview of AWS Lex V2: https://aws.amazon.com/lex
  • Requires:
    • Email address
    • Credit card
  • Follow these instructions to Sign Up for AWS and Create an IAM User: https://docs.aws.amazon.com/lexv2/latest/dg/gs-account.html
  • Note that new users can use the AWS Free Tier for 1 year (https://aws.amazon.com/free), after which costs can be calculated with https://calculator.aws/#/addService/lex
  • It is good practice to set up an IAM user for every day tasks, see https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html

How To Set Up a AWS Lex Bot User

  • Create an IAM user, called BotUser: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html
  • Create a group for this user, called LexBotUsers: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_groups_create.html
  • Attach the following Lex related policy to this group:
  • AmazonLexRunBotsOnly
  • Assign BotUser to the LexBotUsers group
  • Go to BotUser and set up an Access Key
  • Note: there are alternative, more secure ways of providing access
  • Get the access key: (e.g., AKIASLAD65PJG9GGLL6N)
  • Get the associated security key: (e.g., R5qtwdfat2W2nvcOYxadsfadsfAm2YlZSBYPK7myuftLhAg/UrHZ)
  • Bot id: (e.g., B9OEFJZT4HNK)
  • Set up Alias and get ID: (e.g., KOKNFY5FEL)
  • Create new version and associate new alias with this version