I am trying to build a questions and answers app in Dialogflow. The problem I am stuck is in asking user questions in sequence.
The tricky part is that we have 40 questions saved in Google Cloud SQL and out of these, the cloud function sends 1 random question.
Now the first follow-up intent with first random question is successfully triggered.
The problem we are facing is in calling the second or further follow-up intent. Since the questions are asked using fulfillment API, hence we are not sure what will be the next question and its answer.
We tried to build a follow-up sequence but it didn't worked. Following is the attached screenshot for reference.
Seeking help. Thanks in Advance.
You can go to the next intent having trained with a random user input by using context linking and #sys.any Entity in Dialogflow which is used to get the user input i.e Training Phrases in Dialogflow having any random phrases or text.
Image reference for Entity.
Image reference for context linking of a question
Image reference for context linking with previous question
Related
I want to ask the users a few questions in my welcome intent and depending on their answers give them a particular output.
My problem is that, once the user answers the first question, the agent exits my welcome intent and tries to match with the next intent.
I thought I could solve this by matching it back to the welcome intent.
So ideally it should have gone like this :
Welcome intent -> 1st question -> user answer -> Welcome intent ->2nd question -> and so on
But actually this happens :
Welcome intent -> 1st question -> user answer ->Welcome intent -> 1st question
It will keep asking the first question.
To solve this , I started maintaining a flag for each question.
If question 1 was answered I would set its flag true and then use it to skip the first question when the welcome intent is matched for the second time.
This is a very convoluted way to do it and probably far from the best way to do it.
Can anyone point me in the right direction to implement it?
Thank you.
Edit : I have given up my old method. Let me explain what I want to do and then I can get guidance on the way I should implement it.
I have 16 different outputs and I would like to show one of them to the user depending on their answer to 4 questions. Each question will only have two answers as options and depending on the option chosen by the user for each question , I will pick one of the 16 outputs and display it to the user.
How do I accomplish this using diaglogflow node.js?
First of all remember that an Intent captures what the user says or does and not what you do with that information or how you reply to it. That part is best handled by your fulfillment. While we can use Contexts to limit which Intents will be considered for a user response they are probably most useful in this case to store your state and keep track of which questions have been asked and answered.
Under this scheme, your Intents remain responsible for capturing input and your fulfillment examines this input, changes state based on this input, and sends a reply based on the new state (what it needs to ask next). If the user's responses will be mostly the same (free form, or from the same set of phrases), you can even use the same Intent to capture this input and the fulfillment would use the state and input to determine what logic to execute. If you need different types of input, and thus different Intents, their handlers can still call common functions to do the processing and change the state/reply.
This is further discussed in Thinking for Code: Design conversations not logic
You can use the concept of the follow-up intents in Dialogflow Console to create a chain of questions/answers.
Here is an example of my chain of questions/answers:
Though I still strongly advise you to study also how input/output context works. Especially if you want to collect all user reply parameters in the one final fulfillment of the last step to avoid storing the user inputs in fulfillments attached to every intent of the chain.
I'm new to using Dialogflow,and I want to create a simple DialogFlow bot that can answer basic addition,subtraction,multiplication,division questions.How would I code it that it responds to the specific question asked by the user? For example if I made a math intent, I used the training phase "What's 2 x 3", and I made the response "6". Now, I want to add more training phases and I need the bot to use the correct response. Also, another problem is that it would take an impossible amount of time to teach it every possible math question,so is there code I could use to change that?
The easiest way to be able to answer every combination of math question would be by using a fulfillment webhook. Here you can use code to do the calculations based on the user input. You could create an addition intent where you train the bot to recognize addition input and you would connect it to code in your webhook which can do additions and return the response. You can then also add intents for subtracting, multiplication and divisions and connect each of those intents to code which can do the math.
For the setup, you have two options. You can write code in the inline editor in Dialogflow or host your code in your own server and connect dialogflow to the url of that server. More info on that can be found here.
I'm looking to POC a small Google Action that gives a decision based on a few yes/no answers the user must answer first. Effectively I need to:
Ask a question
Store the result
Ask the next question
Store results
* Repeat until all yes/no answers given then end the conversation with a decision using saved values in the conversation.
Ongoing though I would like to add help to any of the questions. So the user could say "I don't understand", "Can you give an example", "Help" and it would give an example to help the user answer yes or no to the question they are up to.
After playing around through the labs it looks like I would do this by creating an Intent for my end decision and then nest a bunch of follow up intents within to gather all my yes/no answers. I feel this would get messy though as it would be a huge chain of them.
Is there a better way to design it?
Yes, using Followup Intents would be messy. It is almost never the right approach to the problem. Remember that Intents capture what the user has said and not what you are doing with what they have said.
If the questions are truly just yes/no, I would setup six Intents:
However you trigger the start of the questioning. This might be your Welcome Intent, or it may be something else.
Saying "yes" and equivalent
Saying "no" and equivalent
Asking for help
Asking to repeat the question
A fallback Intent that handles other unexpected input
When questioning begins, your fulfillment would setup a Context that contains the current question being asked and the responses for the questions so far. Answering yes or no would update the responses, determine what question to ask next, save this in the context, and ask it. Help, repeat, and the fallback Intent would respond with appropriate information based on the current question.
I am trying to make an automated chatbot using wit.ai
Till now I have learned that we can add intent and entity so chatbot can better understand the question.
I have a dataset of questions and answers.
1) If there is any way by which I can set answers corresponding to a question(or similar questions) in wit, and how do we set these answers?
for example :
if a user asks:
what is a phone?
then our bot should reply the answer which is set by us.
2) if there is any other platform where we can add our dataset of questions and answers to make a chatbot?
1) No, you can't! Since wit.ai is working based on intent classification and entity extraction. You can just learn wit bot to detect intent of a query (for example intent can be restaurant search, or greeting). Then you can return any desired answers in your side.
2) Almost all platforms are based on intent and entity. You should got for QA bots, like DeepQA.
Try Quinto
You can create question-answer formats there.
You can use google dialogflow for this one, https://dialogflow.com/
I'm using wit to recognize different intents in a retail context. Some of them trigger (successfully) FAQ answers, other initiate a business logic.
Surprisingly, I'm having a lot of trouble with the most basics conversational intents, like answering a hi or hello. Specially if they come as a single word (it doesn't get hi or hello but it successfully returns the correct intent for hi buddy or hey dude). Obviously there's a high chance that the first thing an user would say is just a simple hello, any of you found the same issue? Any guidance on that?
It is actually the first time I experience this issue, and I haven't heard about it. Could it be related to the increasing number of intents created (now 15+)? I'm using trait as a search strategy.
Greetings intent
Click on image for a larger version of the image.
Thank you very much for your help,