By using AWS re:Post, you agree to the Terms of Use
/AWS Chatbot/

Questions tagged with AWS Chatbot

Sort by most recent
  • 1
  • 90 / page

Browse through the questions and answers listed below or filter and sort to narrow down your results.

[Issue] Lambda LexEvent returns "null" values from Lex v2 Request

**TL;DR:** The "OrderFlowers" blueprint for Lex + Lambda on .NET Core 3.1 doesn't seem to work. Instead of populating the values for `CurrentIntent` and `SlotDetails` as expected, these values are `null` instead. Note: Python and Node.js lambda equivalents seem to work just fine, but work use case requires .NET. --- ## Context - Goal: Setup blueprint "OrderFlowers" chatbot with AWS Lex v2 using .NET Core 3.1 and AWS Lambda. [(Link)](https://docs.aws.amazon.com/lex/latest/dg/gs-bp.html) - This may be an issue with Lex v2 rather than with Lambda, but this may be unlikely as Python and Node.js work fine when interchanged with the .NET lambda used. ## Description - When invoking the OrderFlowers blueprint lambda function via AWS Lex, the `LexEvent` does not populate the expected fields, such as `CurrentIntent` and `SlotDetails`. - Compare this to using the Python or Node.js blueprints which do populate the expected fields. ## Reproduction Steps 1. Create a new .NET project using the "AWS Lambda Project (.NET Core - C#)" template with the "Order Flowers Chatbot" Blueprint. 2. Log the `lexEvent` variable to CloudWatch within the **FunctionHandler** function: `LambdaLogger.Log(JsonSerializer.Serialize(lexEvent));` 3. Publish the solution to AWS Lambda (default settings, arbitrary function name). 4. Create a new Lex v2 Chatbot with the "Order Flowers Chatbot" Example. 5. Configure the new chatbot to use the new lambda function you uploaded under Bot > Alias > Language. 6. Under Intents > OrderFlowers > Fulfillment > Advanced Options, ensure "Use a Lambda function for fulfillment" is checked. 7. Save the intent, build the bot, and test the conversation. 8. An error should appear when attempting to fulfill the intent - when you check CloudWatch, the **LexEvent** body should appear with `null` values for fields such as `CurrentIntent` and `SlotDetails`. ### Logs **Lex** `Invalid Lambda Response: Received error response from Lambda: Unhandled` **CloudWatch** ``` { "CurrentIntent": null, "SlotDetails": null, "Bot": { "Name": "OrderFlowersBot", "Alias": null, "Version": "DRAFT" }, "UserId": null, "InputTranscript": "yes", "InvocationSource": "FulfillmentCodeHook", "OutputDialogMode": null, "MessageVersion": "1.0", "SessionAttributes": null, "RequestAttributes": null, "AlternativeIntents": null, "SentimentResponse": null, "RecentIntentSummaryView": null, "ActiveContexts": null } ``` ### Environment * Build Version: Amazon.Lambda.Core 2.1.0, Amazon.Lambda.LexEvents 3.0.0, Amazon.Lambda.Serialization.SystemText 2.2.0 * OS Info: Windows 10 Enterprise * Build Environment: Visual Studio 2019 * Targeted .NET Platform: .NET Core 3.1 ## Resolution - There may be an issue serializing the incoming request from Lex v2 based on the configuration laid out in the current Order Flowers .NET 3.1 blueprint. To resolve this, effort will need to be made comparing the expected Lex v2 request payload with the actual payload and the serialization may have to be adjusted accordingly.
0
answers
0
votes
11
views
asked 3 months ago

aws lex lambda currentIntent['slots'] value for slot name changes for some utterances

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.
1
answers
0
votes
14
views
asked 5 months ago
  • 1
  • 90 / page