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

2

6
  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.

Kolyma answered 4/4, 2018 at 16:51 Comment(0)
B
6
  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.

Bennet answered 4/4, 2018 at 19:15 Comment(0)
C
4
  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.
Crooked answered 4/4, 2018 at 19:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.