Dear Rasa members,
Let me tell you my requirements. I am unable to get the right way of achieving it.
Suppose I have 2 slots. It is required that both have values before I execute the search. How should I take care. I am thinking inside action_check_slot, I will check if both slots are filled I would trigger action within search_candidate_final. But I am unable to do so.
## Story
greet
utter_greet
utter_ask_howcanhelp
search_candidate
action_check_slots
user informs something
inform{“GPE”: “New York”}
action_check_slots
user informs something
inform{“skill”: “Java”}
action_check_slots
search_candidate_final
utter_ack_dosearch
Fallback
utter_default
Here is my action definition
class ActionCheckSlots(Action):
def name(self):
return ‘action_check_slots’
def run(self, dispatcher, tracker, domain):
# dispatcher.utter_message("looking for restaurants")
# restaurants = restaurant_api.search(tracker.get_slot("cuisine"))
waiting = None
for k, v in tracker.current_slot_values().items():
if(v == None ):
dispatcher.utter_message("Looking value for " + k )
waiting = "Y"
# UtterAction("action_listen")
if(waiting == None ):
print("Inside")
intent = {"name": "search_candidate_final", "confidence": 1.0}
print(tracker.update(UserUttered("/search_candidate_final", intent, [])))
print(tracker.events)
return [UserUttered("/search_candidate_final", intent, [])]
# UtterAction("action_restart")
return []
Can you please help me in this regard ?
I am looking for this option, because number of parameters will be more than 10 in my actual scenario. I will be needing dynamic way of checking slot.
If you still want to do it with your custom action that doesnt do it the way FormAction does(i.e. a different strategy) , you could define a Slot as all_reqd_values_filled , true/false and let rasa act based on that slot values. However you will still need to come up with a way that the user is asked or prompted for the right thing.
Finally you could always generate stories that train the system to act when all your 10 slots are filled and when some combination are not.
Thank you for your reply Deepak. I tried Form Action. However, we still need to put all the combination and possibilities of order of field entry in the Story to work. That is tedious. Is there any easy way out ?
Nothing about supervised learning systems is easy - Many times it feels we have swapped hard coding problems for tedious data entry jobs!
Like I said the only two approaches I can think of are (probably not exhaustive)
a. Generate stories for cases like this using a program. I believe there is a framework called chatito that might help but havent yet looked into it
b. Use your custom action - make all the 10 slots you need as unfeaturized and have a single boolean that is used to determine whether the system should ask question or move ahead. In this case your logic is in your action and more similar to a traditional programming validation thing (with the pros and cons that entails)
I dont think you need rasa to have all possible variations just enough that it can figure out next step
Hi, Deepak.
Can you please elaborate on option b. I need ‘from’ and ‘to’ dates from user, and have several use cases like user entered both dates in one message, or entered one date or entered no date at all.
I want to handle all this using custom actions by my own code. So other-than FormAction, how can i ask user about dates (that’s done using dispatcher utter template), but how can I again wait for users response and get this response in my tracker and again process it inside my custom action e.g. Fill from_date slot if not filled or same with to_date slot.