Failed to extract slot job_function with action sales_form

Hi,

I am new to rasa framework and want use it at work I am getting this error while filling slot in form. Please help me to identify the error

Relevant files are attached below: config.yml (577 Bytes) nlu.md (2.4 KB) responses.md (605 Bytes) stories.md (1.5 KB) domain.yml (1.4 KB) actions.py (2.2 KB) actions.py

from rasa_sdk.forms import FormAction
from typing import Any, Text, Dict, List
from rasa_sdk import Tracker
from rasa_sdk.executor import CollectingDispatcher
from rasa_sdk import Action
from rasa_sdk.events import UserUtteranceReverted


class SalesForm(FormAction):
    """Collects sales information and adds it to the spreadsheet"""

    def name(self):
        return "sales_form"

    @staticmethod
    def required_slots(tracker):
        return [
            "job_function",
            "use_case",
            "budget",
            "person_name",
            "company",
            "business_email",
        ]

    def submit(
            self,
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any],
    ) -> List[Dict]:

        dispatcher.utter_message("Thanks for getting in touch, we’ll contact you soon")
        return []

    def slot_mappings(self):
        """A dictionary to map required slots to
        - an extracted entity
        - intent: value pairs
        - a whole message
        or a list of them, where a first match will be picked"""
        return {"use_case": self.from_text(intent="inform")}


class ActionGreetUser(Action):
    """Revertible mapped action for utter_greet"""

    def name(self):
        return "action_greet"

    def run(self, dispatcher, tracker, domain):
        dispatcher.utter_template("utter_greet", tracker)
        return [UserUtteranceReverted()]

You don’t have slots declared in your domain.yml. Also, you don’t need to declare requested_slot in your domain. That is automatically created and managed by Rasa.

Try using this as the slots: section of your domain.yml:

slots:
  job_function:
    type: unfeaturized
  use_case:
    type: unfeaturized
  budget:
    type: unfeaturized
  person_name:
    type: unfeaturized
  company:
    type: unfeaturized
  business_email:
    type: unfeaturized

I’m using unfeaturized because (i’m guessing) you don’t want the values to interfere with story flow.

You also need to change your mappings, to add all the slots, and not just use_case.

I follow the doc

I want like this

 What's your business email?
 Your input ->  why do you need it 
 We need your email so we can contact you

I modified domain.yml

but i got this:

Where did I go wrong

Oh… Ok… I’ve never had to declare requested_slot as I always use it unfeaturized. I checked out the tutorial… So you will need it to add the requested_slot to the slots you defined.

Do you have an intent defined in your NLU called explain, with “why do you need it” and “why”?

It often helps to have debug enabled when testing, to find out what is happening. Try running rasa shell with the --debug option.

Hi, I’m facing save error, did you manage to solve it? Appreciate your help and sharing.

Hi, I followed that document and encountered the same problem.When I asked “why do you need it”, why did rasa still execute sales_form instead of utter_explain_why_email, so I got “failed to extract slot … with action …”

I also followed the document. it’s not failed. it’s because our assistant can not handle this. you can input data/nlu.md any sentence, for example , when it ask your budget, you can input: