Dialogflow-fulfillment-nodejs: Maximum no of retries for parameter slot filling

Created on 24 Aug 2018  路  12Comments  路  Source: dialogflow/dialogflow-fulfillment-nodejs

I have a use case where I am asking the user for some value which is defined in entity with some records. But the entity is not matched, dialogflow keeps asking till an entity record is matched. I want expire that slot if it is not matched after a few tries and do something else. It would be amazing if dialogflow had an option to send the user's original text to webhook for handling after a few failures. I know it would be probably be possible by using dialogflow's Agent API but I want some lightweight solution.

Feature Request

All 12 comments

@shashaBot There's a slot filling sample you can see here but from the sounds of it you shouldn't be using slot filling because by definition slot filling's sole purpose is to fill required parameters in your agent.

Thanks @sarahdwyer.

I feel that the slot filling sample belong to the samples section in README.md of this repository. https://github.com/dialogflow/dialogflow-fulfillment-nodejs#samples

What do you say? I can make a pull request if the repo maintainers feel the same way.

After studying the sample code thoroughly and reading from multiple sources, I have come to certain level of understanding of webhook slot filling. I would like to contribute samples with specific use case like mine (max retries for slot filling). @sarahdwyer Can you tell me the process and guidelines for contributing samples to be included in official dialogflow organization if that possible?

@shashaBot What exactly do you want to see in samples? More in terms of the fulfillment client library or more slot filling samples?

I want to see more real life examples using slot filling with webhook as I feel the current sample is just an introduction of its usage. Slot filling with webhook is a powerful feature which needs to be demonstrated through more examples. Other than that, I think rest of the samples are very clear and fulfill real life use cases.

Hi @sarahdwyer and @shashaBot, I have a similar need I think you haven't answered?

I dislike how users can get trapped in slot filling. If they fail to give the correct information, they're in a loop until they do. But if they fail after a set amount of tries, it should trigger fallback or another intent.

For example, I gather names in my agent. But because this is not reliable, if a name is not recognised after 2 or 3 tries, I'd like to move to another intent or execute other code that doesn't require the name. But I want to give the user a couple of tries of giving their name. Is this possible?

@nathanjliu yes, I haven't answered this on this thread but I arrived at two possible solutions in my mind. I'll try to set up examples for both by tomorrow and share them here. Until then, if you wanna give this a try yourself, here are my thoughts (haven't yet tested my solution, so feel free to point out any mistakes):

  1. Slot filling using webhook: Suppose you have an intent called intent-1 with one required param called param-1. Now, enable slot filling with webhook. When user says something that triggers the intent but doesn't fill the required slot, in your webhook, you send the question for getting the param from user. User then enters his response which does not match with entity values. Your webhook still gets the request with user's response in queryText (check request json). Note that, param-1 and param-1.original will be empty. When this happens, you can set a param-1_fail context with parameter "retries_left". Next, time when user enters something, again check if param-1 is filled or not. decrement retries_left on unmatched parameter value and if it is zero, you can trigger your fallback/reroute to another intent using agent.setFollowupEvent. Just remember to clear the param-1_fail context when your intent exits (either by completion or reroute)

  2. Don't use required params (custom slot filling approach): In this method, I'm planning to use contexts and multiple intents to complete one request. Basically reinventing dialogflow's slot filling because it allows me to have more control and set up training phrases for each parameter value separately. I would not recommend using this unless your parameters are list values (which require training phrases to get).

@sarahdwyer Do you have any recommendation for using slot filling for list values? The way I have seen it, list type parameters always need to be given in training phrases to fill them.

@nathanjliu It took time to get around to it but here it is: max-retries-sample

@sarahdwyer Give me some feedback on this, if possible.

Also, why are clearContext and clearOutgoingContexts not working? Am I doing something wrong?

@shashaBot This is an interesting solution! I haven't actually tried it - does it definitely trap the user inside the slot filling process until it hits MAX_RETRIES where it lets them go? Is this what the slot filling via webhook toggle does in Dialogflow?

@nathanjliu slot filling via webhook allows you to run your webhook code while the parameter slot filling is being done. So, I've written the code so that it counts down from MAX_RETRIES on every call to webhook where parameter slot (for which slot filling is currently being done) is empty and when no retries are left, it can be redirected to another intent or you can exit the intent by clearing all the contexts.

How sad..... Dialoflow still did not make any solution for this issue. Many user like facing this problem

@TechGuru24 you could do something like this to get around the issue

Was this page helpful?
0 / 5 - 0 ratings