How to reset a parameter value so agent can ask for the parameter again?

∥☆過路亽.° 提交于 2019-12-04 17:26:46

You will need to play with context here. If your account parameter is collected first you can continue like the following:

  • enable slot filling for webhook (optional). This will trigger the webhook intent as soon as you provide an account number and you can validate it before asking for account type.
  • if not enabling slot filling, you will collect the two parameters and move to intent handler code in the webhook.
  • make sure not to set output context in the Dialogflow as you will be setting it from webhook.
  • if the account is valid - continue by setting the context for next intent
  • if not valid set the output context as same as the input context of your intent with lifespan say 2 (for 2 conversations interaction) and ask the user to provide the correct account number.
  • when the user will speak the account number again there will be the same context and same user speech.

If you are collecting account parameter after the balance type, then you may continue with the above approach, but in that case, you will be collecting balance type again and again even when the user is providing it correctly. Better would be to move account parameter to separate account intent.

  • set the output context in the Dialogflow for balance intent say "get_account" lifespan = 2
  • set input context of account intent as "get_account"
  • when account parameter is provided and webhook is triggered, validate it
  • if valid - continue an set context for next intent
  • if not valid, set the context as "get_account" lifespan=2 and ask to provide account number again.

So this way, by playing with the context you can validate the parameters and re-prompt the user for correct format.

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