Slot Extraction is not working - Getting Started with Rasa / Tutorials, Resources & Videos - Rasa Community Forum

👋 Introducing the Rasa Playground

Slot Extraction is not working

post by jaskarannagi19 on Nov 4, 2019

Hi, I am trying to modify restaurant and build my own RASA formbot. I modified my entities, stories and slot extractor, but for some reason my rasa doesn’t move the dialogue ahead. It’s keep on asking same slot question as if it cannot file below is the code:

actions.py

class PizzaForm(FormAction):
    """Example of a custom form action"""

def name(self) -> Text:
        """Unique identifier of the form"""

return "pizza_form"

@staticmethod
    def required_slots(tracker: Tracker) -> List[Text]:
        """A list of required slots that the form has to fill"""
        return ["pizza"]

def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]:

return {
            "pizza": self.from_entity(entity="pizza", not_intent="chitchat")
        }

# USED FOR DOCS: do not rename without updating in docs
    @staticmethod
    def pizza_db() -> List[Text]:
        """Database of supported cuisines"""
        return [\
            "Cheese",\
            "Chicken"\
        ]

# USED FOR DOCS: do not rename without updating in docs
    def validate_pizza(
        self,
        value: Text,
        dispatcher: CollectingDispatcher,
        tracker: Tracker,
        domain: Dict[Text, Any],
    ) -> Dict[Text, Any]:
        """Validate cuisine value."""

if value.lower() in self.pizza_db():
            # validation succeeded, set the value of the "cuisine" slot to value
            print("------------------------>> {}".format(value))
            return {"pizza": value}
        else:
            dispatcher.utter_template("utter_wrong_cuisine", tracker)
            # validation failed, set this slot to None, meaning the
            # user will be asked for the slot again
            return {"pizza": None}

def submit(
        self,
        dispatcher: CollectingDispatcher,
        tracker: Tracker,
        domain: Dict[Text, Any],
    ) -> List[Dict]:
        """Define what the form has to do
            after all required slots are filled"""

# utter submit template
        dispatcher.utter_template("utter_submit", tracker)
        return []

domain.yml

intents:

entities:

slots: pizza: type: unfeaturized auto_fill: false

templates: utter_ask_pizza:

actions:

forms:

nlu.md

intent:greet

intent:make_order

intent:affirm

intent:deny

intent:inform

intent:thankyou

intent:chitchat

intent:stop

intent:bot_challenge

stories.md

happy path

bot challenge