Is there a way to use optional filed or to set one of the multiple fields as required
I am looking for something like this
@staticmethod
def required_fields():
# how can i access the slots in this function
duration = tracker.get_slot("duration")
return_date = calculate_return_date(departure_date, duration)
SlotSet("retrun_date", retrun_date)
return [
EntityFormField("to", "to"),
EntityFormField("from", "from"),
EntityFormField("departure_date", "departure_date"),
EntityFormField("return_date", "return_date")
]
hey @Ghostvv
can you please tell me how to use form action. I am doing this but my bot gets stuck once i ask pizza ordering query.please tell me whats wrong with my code.
my domain.yml file
intents:
order_pizza
greet
size
toppings
inform
affirm
goodbye
thankyou
default
entities:
size
toppings
slots:
size:
type: text
toppings:
type: text
requested_slot:
type: unfeaturized
templates:
utter_greet:
‘Hello, how can I help you?’
#- ‘Hi, I am here to help.’
utter_affirm:
‘thanks for the details.your order is being processed’
utter_get_pizza_size:
‘What pizza size?’
utter_get_pizza_toppings:
‘What toppings would you like on your pizza?’
utter_default:
from rasa_core.actions import Action
from rasa_core_sdk.events import SlotSet
from rasa_core.actions.action import Action
from rasa_core_sdk.forms import FormAction
from rasa_core_sdk.forms import EntityFormField
class ActionOrderPizza(Action):
def required_fields():
return [
EntityFormField(“size”, “size”),
EntityFormField(“toppings”, “toppings”)
]
def name(self):
return ‘action_order_pizza’
def run(self,dispatcher,tracker,domain):
size = tracker.get_slot(“size”),
toppings = tracker.get_slot(“toppings”)
dispatcher.utter_message(“your pizza size of”)
dispatcher.utter_message(size)
dispatcher.utter_message(“and with toppings”)
dispatcher.utter_message(toppings)
dispatcher.utter_message(‘Ordering Pizza is completed! It should be with you soon :)’)
I’m implementing formAction in nodeJS. but fails while deactivating a form. any idea about form in node js or how to deactivate form using nodejs. I guess in formAction using rasa-SDK we need to give null in story. I tried same but it doesn’t work. and when a form is excuted it gives the same responce 10times with warning “circuit break tripped. stopped predicting more actions for sender default”