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â