Hello,
How do I fill the slots using custom actions? For example:
I have a form where I have defined the slots in function such as:
@staticmethod
def required_slots(tracker: Tracker) -> List[Text]:
return ["name","cuisine","time"]
I want to define the utter_ask_cuisine as a custom action because the value will be shown as a button and be fetched from the backend (which is dynamic in nature).
class ActionCuisine(Action):
def name(self) -> Text:
return "utter_ask_cuisine"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
cuisine_data = grabCuisine()
buttons = []
for data in cuisine_data:
buttons.append({"title": data, "payload": "/cuisine"})
slot_name = tracker.get_slot('name')
dispatcher.utter_message(
text="Please choose your liking", buttons=buttons)
return []
Is it possible to fill the slot value by calling a custom action that fetches the values from the backend? If I am defining the utter_ask_cusine template as part of the response in the domain.yml file, it wont be dynamic but will have fixed button values.
I am getting the following error:
UserWarning: Utterance ‘utter_ask_cuisine’ is listed as an action in the domain file, but there is no matching utterance template.
Any reference would be really helpful
Thanks.