-1

what is required by me:

let say i have i have an intent which is asking for two things:

user: show me computers bot: please select a criteria from: high performance, low price, build quality

user: high performance bot: in high performance i have two brands, Apple and Asus, which one would you like to prefer?

user: Apple bot: how would you like to sort, by release date or rating?

user: rating bot: here are your computers sorted by rating: imac 2018 and macbook pro 2018

user: uywiuewrwrw bot: here are your computers: imac 2018 and macbook pro 2018

user: kljrtklet bot: here are your computers: imac 2018 and macbook pro 2018

what i need is when user say "uywiuewrwrw" i need it to fall in fallback

what i have code

I'm using using slot filling form webhook because i need to get some data from the db on behalf of first parameter and then, and the query for second parameter is also dependent on the first parameter,

i have three input in my intent according to my case but in fact i have total 5 action parameters in my intent and all are marked as required because if i dont mark it as required it just forget the value during the slot filling

why i have 5 parameters: i have the first entity that have three possibility(high performance, low price, build quality) and on selection of each i have further possibilities, if user select high performance i need to ask for Apple and Asus, this is mt second entity if user select low price, i need to ask "under 100 new" or "used pc", this is my second entity if user select build quality, i need to ask "industry class" or "militry class" and then i ask for the sort by "release date" or "rating", this is my 5th entity

since i make all of them required, it is not marking intent as completed after collecting just two params, but in fact i only need just two parameter filled out if that 4, i can not mark any of them optional because it forgets vlaue during slot filling(actually in this case it will not forget but in my actual case i have further more question after these params, like how would you like to sort etc)

use case:

Actually i have some further FAQS intent like "what this chatbot does" or "where does your company located" so user can ask these questions any time, after getting the computer recommendation complete if user ask any of FAQ it replies correctly because i'm expiring the context, but if the user command doesnt match with any of the FAQ intent it should goto the fallback where i give them question examples randomly like "hey i didnt get your question, you may ask for this, this, and this"

looking for the help

Nick Felker
  • 11,536
  • 1
  • 21
  • 35
Inzamam Malik
  • 3,238
  • 3
  • 29
  • 61

1 Answers1

0

It isn't clear what, exactly your problem in, but it sounds like there are a few things you could do to make your design easier:

  1. Don't use slot filling. Since which parameters are required depends on earlier conditions set, don't try to use slots to figure out what has been said and what hasn't. Parameters / slots are best for things that a user is likely to say all in one response and not things that you're expecting to have to prompt them for.

  2. Use Contexts to keep track of which values they've already provided.

  3. In your webhook logic, you can use a combination of what values they've already said (that is stored in the Context) and what they say (in the parameters for the current reply) to figure out what to prompt them with next. All your prompts will come from your webhook - not from the Dialogflow replies.

  4. Add one or more additional Intents that will handle the user's generic response, with parameters that hold the value they're replying with. It should have an Incoming Context set as a condition so it is the one triggered when they reply. You'll transfer these values to the Context in your webhook.

Prisoner
  • 49,922
  • 7
  • 53
  • 105
  • if i donot use slots for slotfilling, after asking first question it just falls in the fallback, because intent marked as completed – Inzamam Malik Apr 23 '18 at 10:06
  • i must need a way to mark intent completed manually on a specific condition (when i see all parameters completed) – Inzamam Malik Apr 23 '18 at 10:08
  • and sometime i also face like i have 10 parameters to collect from user, when user start giving parameter with every parameter i goto logic and check either these parameters are enough to respond with correct answer(sometime 4 are enough sometime 7 are enough), if yes i just wanted to give an answer and mark intent as completed so it will not come on that intent on response of user, but goto other matched intent or fallback – Inzamam Malik Apr 23 '18 at 10:11
  • As I said - you'll use a context to store those values and your webhook logic can determine when they've answered everything. I've updated my answer to try and clarify further. – Prisoner Apr 23 '18 at 10:12
  • best example is heart disease prediction chatbot, which ask for vital signs and some time 5 and sometime 7 vital signs are enough to pridict "yes you may have heart problem" – Inzamam Malik Apr 23 '18 at 10:13
  • can you please mention update separately in your answer – Inzamam Malik Apr 23 '18 at 10:14
  • do you think point number 4 can fulfill the need of heart problem agent too? I'm not sure well i will try it – Inzamam Malik Apr 23 '18 at 10:18
  • Yes. Logic in webhook. Reply types in intent. – Prisoner Apr 23 '18 at 11:02
  • i will be very thankful to you if you can refer me to sample code or any totorial demonstrating this process, I'm unable to getting it work and I'm sure I'm missing something in the process – Inzamam Malik Apr 23 '18 at 12:21
  • I wish I could, but I really barely understand what you're trying to do. Updating your question with the code and Intents you're using can help us point you in the right direction, and possibly to other code that you can work with. – Prisoner Apr 23 '18 at 13:07
  • how can I add zip file of this agent in the question? – Inzamam Malik Jan 24 '20 at 23:02
  • You can give a link to a zip file in a public location - but chances are people won't actually look at it. See [How do I Ask a Good Question](https://stackoverflow.com/help/how-to-ask) for details, but updating your question to include a minimal example of the code that is a problem, including (in this case) screen shots of the Intents that are in use may get people to look at it and help others who are trying to do similar things in the future. – Prisoner Jan 25 '20 at 00:30