how add a required filed to context parameters in dialog flow - nlp

In the chat application i am developing with dialog flow has scenario like this. Users can ask details about loans that they can get. that is a one intent. once user says the loan type they want i need to save it and use it every where when they ask question. for one example i have a another intent called loan payments.
In that intent they can ask questions like
I am interested in getting a personal loan for a duration of 5 years
and the loan amount would be 5 million rupees. Can you let me know the
monthly repayment amount?
to calculate that, loan type is a must (personal loan in this case). so if any user has specified the loan type before i need to use it here other wise i need to ask users to provide it again. but if i am using context i cant add add required. how to achieve this. also since i have already set the parameters i cant change the value of them. this is how my parameters look like

This is where your business logic comes in picture. Chat application can be built in two ways, directional & open-ended. In first one, you can explicitly go on asking few questions with set options/buttons for the services that you're offering & user has to select any one of them or in the second one, you keep it open for people to type-in anything & then you extract values & respond them based on their inputs.
Now that you're of second type, even if you use contexts, dialogflow offers you a favor to extract parameter values of first intent in the second one. You just have to use, #context_name.parameter_name. But now, if you're saying that if user has already defined loan type in earlier intent then you don't want to ask him again it in next intent, then this is purely a business logic that you will have to code in your webhook. Dialogflow won't do it for you.
I hope, this answers your question & if you don't want to do it that way, go for directional flow.

Related

Manipulating Dialogflow intents/entities

I'm creating a chatbot in Dialogflow in which the user is expected to enter a frequency of time, followed by specifying the time. i.e :
Bot: how many entries will you make on that day? (Or what so the frequency of your entries)?
User: Twice daily or two times a day.
Bot: Please enter those times.
User: 9 am and 7 pm
Now the problem is even if I enter more than two times it will still get accepted as the time by Dialogflow.
I need to implement a check here that will take only times if the user enters twice daily and accept three times if the frequency is thrice daily.
Is it possible to do this by manipulating entities and intents? I want to avoid doing this in the webhook.
Also the webhook I'll be implementing is in python. So can't use Node.js inline editor.
No, this can't be done in the Intents only. Remember that an Intent represents what the user has said, and not how you are using.
As you surmise, the best place to check these values are in your webhook fulfillment. Since you already have a webhook, it isn't clear why you are avoiding this.
In terms of design, you may wish to skip asking for the frequency and just ask the user to tell you when they'll be making the entries. You can then confirm that was all that they wanted, accept more if they needed more, etc.

How can I get bixby to prompt for optional inputs?

At a high level, I would like to set up an action that has some required inputs and some optional ones. After the user begins, he/she will be prompted for any required inputs that are missing. If/when the required inputs are collected, i would like to ask if the user wants to specify more optional inputs.
The specific use case is a voice-based real estate search. I have some required inputs set up like zip code, price, and number of bedrooms. Then I would like bixby to ask "would you like to refine your search even further?" and if the user says yes, we can ask about number of bathrooms, parking arrangements, and other more niche parameters. I do not want to make all of these required and have to prompt everyone if they want to filter by "pools" or some parameter not widely used. And being voice-based, I do not want to just have it as a checkbox on the screen because someone on the speaker won't be able to use that parameter then.
I have thought of 2 potential solutions but I do not know if they will work (at least without relying on the controls on screen for a voice-based capsule):
1) Make the search into a transaction and then instead of a normal confirmation, try to shoe-horn the confirmation to ask if the user wants to add more refinements. Maybe something like the bank transfer one but a negative confirmation would cause bixby to ask for information that she didnt ask for before: https://bixbydevelopers.com/dev/docs/sample-capsules/walkthroughs/simple-transactional#sample-capsule-walkthrough
2) Make 2 more required inputs, one boolean called "WantsOptionalParameters" and the other called "OptionalParameters" that will be a structure containing all of the optional parameters. Then it would prompt for WantsOptionalParameters like a normal required input, and if that is "True", I can have a sub-action that will ask for each one of the parameters to construct an OptionalParameters object. then we could feed that output into the search. And alternatively, if WantsOptionalParameters is false, we can automatically construct OptionalParameters with all negative responses and feed that into the original action.
Both of these solutions will take a bunch more research and testing and i don't even know if they will work, so i was hoping to call on the wisdom of you guys!
Here is my take on it for what its worth. Every domain has key inputs that are typically used to start the conversation and optional inputs that can refine the conversation.
Some general ways to start conversation for the real estate example (totally driven by my own experience, perhaps there are more)
Hows the real estate market in 90210?
Show me homes under $250K in Los Angeles?
Show me homes with 4 bedrooms (near me?)
You can club such inputs into an input-group called RequiredInputs that requires OneOrMoreOf these parameters to get the capsule started.
You can also collect the optional/niche inputs in another input-group called OptionalInputs that requires ZeroOrMoreOf and feed them into your capsule logic
Its also possible that all inputs are equally important and are all Optional! It is totally dependent on the domain and how the capsule developer might handle such inputs.
But in a general sense, once the set of inputs is in and the initial results are shown to the user, the capsule developer then has a great amount of control to
Shape the future conversation AND
Highlight capsule capabilities.
So, rather than presenting the user with a set of options, you can control the conversation and offer options that provide most value to the user (and to the capsule developer!)
e.g your capsule is capable of deep analyzing and refining results in a way that no other capsule on the market can do. So, you want to highlight this capability as the first choice via followup
Or You may have a conversation path based on prior experiences and your knowledge of the domain. So, you could say, I can refine the results further by X, Y, Z options.
This scenario is more likely to be useful and less likely to overwhelm (with options) the end user.
Hope this helps!

How to create a search form with dialogflow

I am trying to make a search algorithm with dialogflow that could take any combination of: first name, address, phone number, zip code or city as input to a search algorithm. The user does not need all of them, but we will refine our search with each additional answer until we only have one result. Basically we are trying to identify which customer we are talking to.
How should this type of intent (or set of intents) be structured? We have tried one intent with multiple parameters, but we do not need all of them to be required. We have also written a JavaScript function for fulfillment but how can we communicate back to dialogflow as to whether we need more information?
Thank you very much for your help.
Slot filling is designed for this purpose.
Hope that helps.
Please post more code/details to help answers be more specific.
First, keep in mind that Intents reflect what the user is saying, and not typically what you're replying with or what other information you need. Slot filling sometimes bends this rule, but only if you have required slots.
Since you don't - you need a different approach.
This can be done with a single intent, although you may find that multiple intents make it easier in some ways. The approach is broadly the same:
When you ask the question, make sure you set an Outgoing Context with a relatively short lifespan (2-3 is good) to indicate you are collecting user info.
Create an Intent (or Intents) that have sample phrases that capture the information you need.
Some of these will have obvious entity types (phone number and zip code) while others will be more difficult (First name has a system entity type, but it doesn't include all possible first names).
You will need to create sample phrases that collect the parameters by themselves, along with phrases that make sense. You're the best judge of this, and you should probably write some sample conversations before you write the phrases.
In your fulfillment, you'll figure out if you have enough information.
If you do, you can reply and clear the Context that was set. (Clearing it is important so Dialogflow doesn't match the information collecting Intent again.)
If you do not, you can add the information you have as parameters to the Context so you can save it for later processing, make sure you reset the Context lifespan (so it doesn't expire), and prompt the user for additional information. Again, having a conversation mocked out ahead of time will help here.

Dialogflow: Guide user to a specific flow depending on user's age

I am trying out some things with Google Dialogflow. The thing I am basically trying to do is ask the user's age. Based on the age, say greater than 50 OR smaller than 50, I want the user to be guided to a specific question for one of the two age groups.
I was looking on the internet for a hint or suggestion, but I can't find examples other than "Yes","No" type of answers which then guide the user to a specific flow.
I basically need the user to say an age, which can be between 1-50 years, and 50-100 years, and any number belonging to any of the two groups should prompt the user to a specific follow-up question for that age group.
Does any one have a tip? Is this even possible in the generic Google Dialogflow? Or would I need to use a webhook/fullfilment for this?
Thanks and regards
The easiest way is to use fulfillment for this sort of thing. Dialogflow Intents are good at capturing what the user has said, and possibly including this as a parameter, but webhooks are best for applying logic and determining output and what context further answers should be considered in.

How to create dialogflow conversation to make a price estimation

My agent’s goal is to ask 6 questions to make a price estimation of 2 different products.
It asks the 1st question: ‘do you want to make a price estimation for product1 or product2 ?’
And then, it asks 5 questions about the product’s characteristics (i.e. the product’s age, size…) to finally display the price estimation.
All flow made on Dialogflow UI with an inline editor for the fulfillment to calculate and then save data on Firebase DB.
My question -> Is it better to create :
1/ Create only 2 intents : product1 and product2 ? Then in those intents, ask the others 5 questions in ‘action and parameters’ section by filling parameters, entities and values.
2/ Create 6 differents intents for the 6 questions, with parameter value for each ones.
On my side :
I have tested the 1/, I’m able to retrieve all data on my Firebase DB but my 2 products have similar entities and parameters values (‘size’ for example) and my agent make errors’ flow to the wrong intent.
I have tested the 2/ (I think it’s the better way because all intents are more efficient) I’m able to make the good flow. But at the last question, I don’t know how to retrieve previous parameters values to make the price estimation.
Thanks a lot for the help ;)
Remember that Intents are designed to capture what the user is saying - not necessarily the logic behind how you intend to handle that. While you can use things like Contexts to keep track of state, it is sometimes better to handle that with your logic. (See Thinking for Voice: Design Conversations not Logic)
You should be storing anything you wish to remember between Intents in the parameters of a long-lived Context.

Resources