Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access the raw input text and the entire conversation in AWS Lex

  1. How can I access to raw text the lead to the intent in lex
  2. How can I extract the entire conversation including the user input and the Lex responses

I thought of creating a lambda & API gateway to capture the input and record it before sending it to Lex , and on each intent lambda record the response , but seems like a round about way.

like image 419
Shachaf.Gortler Avatar asked Apr 04 '18 16:04

Shachaf.Gortler


People also ask

How do you get AWS Lex welcome message?

You can follow these steps:Create a Slot type with only one value i.e: HelloMe . Create an Utterances HelloMessage . Create a Slot as follow: Required, name: answer , Slot Type: HelloMe , Prompt: 'AutoWelcomePrompt'. Pick Amazon Lambda for your Fulfillment that will send a response to your user.

What is conversation logs?

You enable conversation logs to store bot interactions. You can use these logs to review the performance of your bot and to troubleshoot issues with conversations. You can log text for the PostText operation. You can log both text and audio for the PostContent operation.

What is utterance in AWS Lex?

An utterance is detected when Amazon Lex V2 recognizes the utterance as an attempt to invoke an intent configured for a bot. An utterance is missed when Amazon Lex V2 doesn't recognize the utterance and invokes the AMAZON.


2 Answers

  1. In the event which you receive in Lambda function, you can get raw text from inputTranscript

{'messageVersion': '1.0', 'invocationSource': 'DialogCodeHook', 'userId': '', 'sessionAttributes': {}, 'requestAttributes': {}, 'bot': {'name': 'bot_name', 'alias': 'bot_alias', 'version': '$LATEST'}, 'outputDialogMode': 'Text', 'currentIntent': {'name': 'invoked_intent_name', 'slots': {}, 'slotDetails': {}, 'confirmationStatus': 'None'}, 'inputTranscript': 'user message which triggered the intent'}

  1. For storing the conversation, in the Lambda function, just before you provide the response to the user, you can write a function to store the conversation i.e user query and response from bot.

Hope it helps.

like image 136
sid8491 Avatar answered Sep 27 '22 22:09

sid8491


  1. The raw text that matched your intent can be reference as event.inputTranscript The full event format is documented here.
  2. Amazon has a great example of how to build out a transcript of the entire conversation. Take a look at the RideService example code. Pay attention to how appendTranscript is used to build the full transcript of the interaction.
like image 42
Parrett Apps Avatar answered Sep 27 '22 22:09

Parrett Apps