Error on Lex Bot console - Reached second execution of fulfillment lambda on the same utterance

孤人 提交于 2020-01-05 05:45:10

问题


I created a bot in Lex and then created two intents within same bot - intent1 and intent2 with utterance get me a taxi now and I wan a taxi to {Location} on {TravelDate} at {TaxiTime} respectively(first one in intent1 and second one in intent2). Both the intents call different lambda function and inside lambda functions I access RDS to add the booking info for taxi. When I test from Lex console by saying either of the two utterances the lambda function executes completely as I can see database record updated but on Lex bot test console I see Reached second execution of fulfillment lambda on same utterance Lex error. In my code I have this line:

def delegate(session_attributes, slots):
    return {
        'sessionAttributes': session_attributes,
        'dialogAction': {
            'type': 'Delegate',
            'slots': slots
        }
    }

def book_taxi(intent_request):

        confirmation_status = intent_request['currentIntent']['confirmationStatus']
#bunch of other processing code
        logger.debug('Confirmation = {}'.format(confirmation_status))
        if confirmation_status == 'Confirmed':

            try_ex(lambda: session_attributes.pop('confirmationContext'))
           logger.debug('confirmation_context = {}'.format(confirmation_context))
            if confirmation_context == 'AutoPopulate':
                    return elicit_slot(
                        session_attributes,
                        intent_request['currentIntent']['name'],
                        intent_request['currentIntent']['slots']

                    )
            return delegate(session_attributes, intent_request['currentIntent']['slots'])
logger.debug('Booked Taxi at={}'.format(reservation))

My guess is that the delegate() call in code above is causing the issue because in my log files i can see the first two debug logs as Confirmed and None values but the last logger.debug() is not in the log file which means delegate() got called and thats is causing error on Lex console.

What could be the possible issue for this error?


回答1:


Your Utterance May contains the text that invoke a more than one intent. that's why the problem raised. you chack the uttrances in both the intents and remove one from two similar type utterances.



来源:https://stackoverflow.com/questions/44448538/error-on-lex-bot-console-reached-second-execution-of-fulfillment-lambda-on-the

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!