【问题标题】:Using Amazon Lex's inputTranscript to allow for an wide open slot使用 Amazon Lex 的 inputTranscript 来允许一个敞开的插槽
【发布时间】:2019-01-07 18:27:53
【问题描述】:

谁能提供有关如何使用 inputTranscript lex 事件将该输入作为其值反馈回插槽的任何见解,以允许开放插槽类型?我可以毫无问题地捕获用户输入,它只是将它作为我遇到问题的槽值发送回来。从我的研究中可以看出,这是实现在插槽中接受任何值的能力的最佳方式。我似乎无法真正让它工作。我已经阅读了一些说明创建插槽的帖子,然后使用 elicit slot 功能,但没有任何内容非常详细。 谢谢

【问题讨论】:

    标签: aws-lambda amazon-lex


    【解决方案1】:

    假设您的意图中有一个插槽 anyString
    您需要做的第一件事是取消选中此插槽的 必需 复选框。 现在在 Options 中,选择 Initialization and validation code hook 并选择您的 Lambda 函数。 在DialogCodeHook 中,我们可以获取用户输入并将其分配给我们的插槽anyString,使用以下代码:

    slots = intent_request['currentIntent']['slots']
    slots['anyString'] = intent_request['inputTranscript']
    

    你可以阅读更多关于dialogActionhere的信息。

    希望对你有帮助。

    【讨论】:

    • 正如@sid 所说的那样,我们只需通过elicitSlot 函数将更新后的slots 数组传回Lex。
    • @JayA.Little 将slots 数组传回给 Lex 做什么? elicitSlot是用来重新提示slot的值吧?
    • 谢谢大家。 @JayA.Little 只是一个问题,尽管在使用 elicit slot 函数时,我必须传递错误的信息。您是否在重新引出相同的位置?
    • def open_slot(intent_request): slots = intent_request['currentIntent']['slots'] slots['phrase'] = intent_request['inputTranscript'] slot_to_elicit = ? return elicit_slot(intent_request['sessionAttributes'], intent_request['currentIntent']['name'], slots, slot_to_elicit, { 'contentType': 'PlainText', 'content': 'Test Test.' })
    • 所以澄清一下,elicitSlot 不仅适用于 **re-**eliciting 也适用于任何 slot 的第一次 eliciting。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-06-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多