1.3 - Integrate Virtual Agent

Integrate

Navigate to the “Integrate” tab in NeuralSeek.

image1.5.1

Select Virtual Agent

Select the preferred choice of virtual agent on the left side menu. For this lab, we recommend "LexV2 Lambda".

image1.5.2

Download File

Download the Lambda Archive .zip file to your local storage.

image1.5.3

Create a Function

Click the link to open the Functions page on the AWS Lambda console to create a function from scratch.

  • (a) Select "Create Function".
  • (b) Add a “Function Name”. For this lab, we recommend “learning-lab”.
  • (c) Click “Create Function”.

image1.5.4

image1.5.5

Upload the downloaded .zip File

Navigate to the Code Source pane in the AWS Lambda Function console.

  • (a) Click “Upload from”. Click “.zip file”.
  • (b) Click “Upload” to select your Lambda Archive .zip file you downloaded.
  • (c) Click “Save”.

image1.5.6

image1.5.7

Edit the Code Block

On the NeuralSeek "Integrate" page, copy the provided API key and Instance URL mentioned in the NeuralSeek's integration page. Navigate to the Code Source pane in the AWS Lambda Function console.

  • (a) Click on the “index.mjs” file tab.
  • (b) Enter the copied API key and Instance URL into the code block.
  • (c) Within the "messages" array, delete the section containing the contentType: "CustomPayload" from the code block.

enter_keys_codepane remove_customPayload

  • The "Deploy" button will enable. Click "Deploy" to successfully update and deploy the function.

image1.5.8

Update Timeout Setting

Navigate to the "Configuration" tab in AWS Lambda Function Console.

  • (a) In the "General Configuration" pane, click "Edit".
  • (b) Update under “Timeout”: set min to be “1” and sec to be “0”. This will ensure the lambda function will not time out for 1 minute.
  • (c) Click "Save".

image1.5.9

image1.5.10

Create a Lex Bot

  1. Open the Amazon Lex console. Click "Create bot" under the Bots section.
  2. In the creation method, select "Create a blank bot".
  3. Name the bot "TestBot".
  4. Select "Create a role with basic Amazon Lex permissions" in IAM Permissions.
  5. Select "No" in Children's Online Privacy Protection Act (COPPA).
  6. Click "Next".
  7. Click "Done".
  8. In the Sample utterances section, add an utterance. It can be anything (e.g. Hello).
  9. In the Initial response section, add any response that may be suitable. (e.g. Welcome to the test bot).
  10. Click "Save intent" to save a default intent without adding anything.

Selecting Alias

Open the Amazon Lex console. Select the "TestBot" from the list of the Bots.

  • (a) On the left side bar menu, under “Deployment”, click “Aliases”.
  • (b) From the list of alias names, choose the alias name that you want to use. Select "TestBotAlias".

images1.5.11

Select Language

Under the chosen Alias, "TestBotAlias" within the Amazon Lex console:

  • (a) From the list of supported languages, click the language that the Lambda function is used for. For this lab, we recommend “English”.

image1.5.17

Optional Lambda Function Connection

  • (a) Under "Source", click the name of the alias of the Lambda function to use. For this lab, we recommend "learning-lab”.
  • (b) Under "Lambda function version or alias", the option "$LATEST" will populate.
  • (c) Click “Save”.

image1.5.18

Fallback Activities

The default FallbackIntent allows for the Lambda function to be called when it is detected. The idea is that Lex would invoke NeuralSeek to answer whenever there is no matching intent found. To activate this, navigate to Amazon Lex console.

  • (a) Click “TestBot”
  • (b) Click “Intents” under “English (US)” on the left sidebar menu.
  • (c) Click on the “FallbackIntent” link.

image1.5.12

Under the "Fulfillment" section, click the "Activate" icon to turn on.

  • (a) Click "Advanced Options"
  • (b) Select the “Use a Lambda Function for Fulfillment” option.
  • (c) Click "Update Options."
  • Click "Save Intent."

image1.5.13

image1.5.14

Build the chatbot and test the FallbackIntent routine with a question.

  • (a) Click “Build.” This step may take a few moments.
  • (b) Click “Test.” The Amazon Lex chatbot will be generated.
  • Prompt the chatbot with a question. For the purpose of this lab, we used “What is NeuralSeek?
  • Notice the answer and the detailed information about the answer is returned to the chat bot.

image1.5.15

image1.5.16

The AWS LexV2 Lambda Virtual Agent is now set up, integrated with NeuralSeek, tested and ready for use.



Ⓒ 2024 NeuralSeek, all rights reserved.