I am very new to lex.
I have a questionnaire workflow setup with lex and lambda, i have slot name answers which set as empty array '[]' on the first time lambda is fired to record the values (my questions state in it).
But i see something weird happening with sometimes for the few words for example i have 4 words (like a multiple choice) some words are "recognized" fine but for other they change/override my slots["answers"] value.
{'messageVersion': '1.0', 'invocationSource': 'DialogCodeHook', 'userId': 'XXXXX', 'sessionAttributes': {'assessmentState': '1', 'sessionId': 'XXXXX'}, 'requestAttributes': None, 'bot': {'name': 'XXXXX', 'alias': 'XXXXX', 'version': 'XXXXX'}, 'outputDialogMode': 'Text', 'currentIntent': {'name': 'XXXXX', 'slots': {'answers': '[]'}, 'slotDetails': {'answers': {'resolutions': [{'value': '[]'}], 'originalValue': '[]'}}, 'confirmationStatus': 'None', 'nluIntentConfidenceScore': 0.95}, 'alternativeIntents': [{'name': 'XXXXX1', 'slots': {}, 'slotDetails': {}, 'confirmationStatus': 'None', 'nluIntentConfidenceScore': None}], 'inputTranscript': 'Not at all', 'recentIntentSummaryView': [{'intentName': 'XXXXX', 'checkpointLabel': None, 'slots': {'answers': '[]'}, 'confirmationStatus': 'None', 'dialogActionType': 'ElicitSlot', 'fulfillmentState': None, 'slotToElicit': 'answers'}], 'sentimentResponse': None, 'kendraResponse': None, 'activeContexts': []}
this is my first request (answer to my first question) if you see currentIntent['slots']['answers']
is an '[]'
which i set when lambda is invoked first time even before this to render user my first question and for this question i answered 'Not at all' if you see the inputTranscript. which looks all fine but for the next question when i tried to answer with another utterance the event has changed a lot.
{'messageVersion': '1.0', 'invocationSource': 'DialogCodeHook', 'userId': 'XXXXX', 'sessionAttributes': {'assessmentState': '2', 'sessionId': 'XXXXX'}, 'requestAttributes': None, 'bot': {'name': 'XXXXX', 'alias': 'XXXXX', 'version': '23'}, 'outputDialogMode': 'Text', 'currentIntent': {'name': 'XXXXX', 'slots': {'answers': 'Several days'}, 'slotDetails': {'answers': {'resolutions': [], 'originalValue': 'Several days'}}, 'confirmationStatus': 'None', 'nluIntentConfidenceScore': 1.0}, 'alternativeIntents': [{'name': 'XXXXX1', 'slots': {}, 'slotDetails': {}, 'confirmationStatus': 'None', 'nluIntentConfidenceScore': None}, {'name': 'XXXXX2', 'slots': {'foodName': None, 'delayWhen': None, 'confirmation': None, 'barcode': None, 'food': None}, 'slotDetails': {'foodName': None, 'delayWhen': None, 'confirmation': None, 'barcode': None, 'food': None}, 'confirmationStatus': 'None', 'nluIntentConfidenceScore': 0.62}, {'name': 'XXXXX3', 'slots': {'answers': 'Several days'}, 'slotDetails': {'answers': {'resolutions': [], 'originalValue': 'Several days'}}, 'confirmationStatus': 'None', 'nluIntentConfidenceScore': 0.51}, {'name': 'XXXXX5', 'slots': {}, 'slotDetails': {}, 'confirmationStatus': 'None', 'nluIntentConfidenceScore': 0.48}], 'inputTranscript': 'Several days', 'recentIntentSummaryView': [{'intentName': 'XXXXX', 'checkpointLabel': None, 'slots': {'answers': '[{"id": 1, "value": 0}]'}, 'confirmationStatus': 'None', 'dialogActionType': 'ElicitSlot', 'fulfillmentState': None, 'slotToElicit': 'answers'}], 'sentimentResponse': None, 'kendraResponse': None, 'activeContexts': []}
but here if you see currentIntent['slots']['answers']
it is supposed to have '[{"id": 1, "value": 0}]'
which i set after my 1st question is answered but here it is 'Several days' and if you see recentIntentSummaryView
array's element {'intentName': 'XXXXX', 'checkpointLabel': None, 'slots': {'answers': '[{"id": 1, "value": 0}]'},....
this has the value i set in my previous question. as far as my observation go i think it fails for some words and after a build and publish it starts to work which i dont know sometimes looks like magic and sometimes confuses what did i miss.
the slot configuration i used is name: answers, type: AMAZON.streetAddress, prompt: what assessment?
I used type as AMAZON.streetAddress because i had same issue on other intent and i found somewhere that AMAZON.alphaNumeric has some issue ... and change to AMAZON.streetAddress and that intent works fine, this intent also has similar config and lambda code as other but i am lost in what to do or whats happening.
Please help me out, Thanks in advance.