Definition of slots:
slots:
queso:
type: text
auto_fill: false
peperoni:
type: text
auto_fill: false
salame:
type: text
auto_fill: false
choclo:
type: text
auto_fill: false
pollo:
type: text
auto_fill: false
tocino:
type: text
auto_fill: false
champinon:
type: text
auto_fill: false
requested_slot:
type: unfeaturized
Utter templates:
templates:
utter_greet:
- text: "Hola, bienvenido"
utter_ask_queso:
- text: "Desea queso en su pizza?"
utter_ask_peperoni:
- text: "Desea peperoni en su pizza?"
utter_ask_salame:
- text: "Desea salame en su pizza?"
utter_ask_choclo:
- text: "Desea choclo en su pizza?"
utter_ask_pollo:
- text: "Desea pollo en su pizza?"
utter_ask_tocino:
- text: "Desea tocino en su pizza?"
utter_ask_champinon:
- text: "Desea champiñon en su pizza?"
utter_wrong_option:
- text: "Debe ingresar si desea o no desea el ingrediente, intentelo nuevamente"
utter_como_puedo_ayudarte:
- text: "¿Como puedo ayudarte?"
utter_slots:
- text: "La pizza será preparada con los siguientes ingredientes: \n
Queso: {queso}\n
Peperoni: {peperoni}\n
Salame: {salame}\n
Choclo: {choclo}\n
Pollo: {pollo} \n
Tocino: {tocino} \n
Champinon: {champinon} \n
Confirma el pedido? "
utter_estoy_en_ello:
- text: Estamos preparando tu pizza, tu pizza estará lista en 80 min y será enviada por rappi ;)
utter_ingrediente_extra:
- text: Deseas agregar algún otro ingrediente?
Validation of Slots:
def validate_queso(
self,
value: Text,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any],
) -> Dict[Text, Any]:
if value.lower() == "si":
print("hola")
return {"queso": value}
elif value.lower() == "no":
return {"queso": value}
else:
dispatcher.utter_message(template="utter_wrong_option")
return{"queso": None}
def validate_peperoni(
self,
value: Text,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any],
) -> Dict[Text, Any]:
if value.lower() == "si":
return {"peperoni": value}
elif value.lower() == "no":
return {"peperoni": value}
else:
dispatcher.utter_message(template="utter_wrong_option")
return{"peperoni": None}
def validate_salame(
self,
value: Text,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any],
) -> Dict[Text, Any]:
if value.lower() == "si":
return {"salame": value}
elif value.lower() == "no":
return {"salame": value}
else:
dispatcher.utter_message(template="utter_wrong_option")
return{"salame": None}
def validate_choclo(
self,
value: Text,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any],
) -> Dict[Text, Any]:
if value.lower() == "si":
return {"choclo": value}
elif value.lower() == "no":
return {"choclo": value}
else:
dispatcher.utter_message(template="utter_wrong_option")
return{"choclo": None}
def validate_pollo(
self,
value: Text,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any],
) -> Dict[Text, Any]:
if value.lower() == "si":
return {"pollo": value}
elif value.lower() == "no":
return {"pollo": value}
else:
dispatcher.utter_message(template="utter_wrong_option")
return{"pollo": None}
def validate_tocino(
self,
value: Text,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any],
) -> Dict[Text, Any]:
if value.lower() == "si":
return {"tocino": value}
elif value.lower() == "no":
return {"tocino": value}
else:
dispatcher.utter_message(template="utter_wrong_option")
return{"tocino": "None"}
def validate_champinon(
self,
value: Text,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any],
) -> Dict[Text, Any]:
if value.lower() == "si":
return {"champinon": value}
elif value.lower() == "no":
return {"champinon": value}
else:
dispatcher.utter_message(template="utter_wrong_option")
return{"champinon": None}
Submit Function
def submit(
self,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any],
) -> List[Dict]:
print("****************SUBMITE*****************")
dispatcher.utter_message(template="utter_slots")
return[]
here is when the bot start to ask if the customer wants a specific ingridient and he need to answer with “si” or “no” (yes or no)
When running rasa at debug form show that all the slots are filled but when i show it by utter template, always the last slot filled shows “None” value. This isn’t becouse the validate function, i tried changing the value of else condition for another thing diferent like “JAJA” and shows anyway “None”.
Thanks for helping me

