Is this normal or not?

Hello, I’m new to rasa. I follow the rasa doc.When I asked “why do you need to know that”, why did rasa still run sales_form first instead of utter_explain_why_email, so I got “failed to extract slot … with action …”. I don’t know if this is normal. If not, can someone tell me why?Here is my fileconfig.yml (574 Bytes) domain.yml (1.8 KB) nlu.md (2.9 KB) stories.md (1.1 KB) actions.py (2.2 KB) config.yml

# Configuration for Rasa NLU.
# https://rasa.com/docs/rasa/nlu/components/
language: en
pipeline:
- name: "WhitespaceTokenizer"
- name: "RegexFeaturizer"
- name: "CRFEntityExtractor"
- name: "EntitySynonymMapper"
- name: "CountVectorsFeaturizer"
- name: "CountVectorsFeaturizer"
  analyzer: "char_wb"
  min_ngram: 1
  max_ngram: 4
- name: "EmbeddingIntentClassifier"
- name: "ResponseSelector"
# Configuration for Rasa Core.
# https://rasa.com/docs/rasa/core/policies/
policies:
  - name: MemoizationPolicy
  - name: KerasPolicy
  - name: MappingPolicy
  - name: FormPolicy

domain.yml

actions:
- action_greet
- respond_faq
- utter_ask_budget
- utter_ask_business_email
- utter_ask_company
- utter_ask_job_function
- utter_ask_person_name
- utter_ask_use_case
- utter_cheer_up
- utter_did_that_help
- utter_explain_why_budget
- utter_explain_why_email
- utter_goodbye
- utter_greet
- utter_happy
- utter_iamabot
entities:
- budget
- business_email
- company
- job_function
- person_name
- use_case
forms:
- sales_form
intents:
- contact_sales
- inform
- explain
- greet:
    triggers: action_greet
- goodbye
- affirm
- deny
- mood_great
- mood_unhappy
- bot_challenge
- faq
responses:
  utter_ask_budget:
  - text: "What's your annual budget for conversational AI? "
  utter_ask_business_email:
  - text: What's your business email?
  utter_ask_company:
  - text: What company do you work for?
  utter_ask_job_function:
  - text: "What's your job? "
  utter_ask_person_name:
  - text: What's your name?
  utter_ask_use_case:
  - text: What's your use case?
  utter_cheer_up:
  - image: https://i.imgur.com/nGF1K8f.jpg
    text: 'Here is something to cheer you up:'
  utter_did_that_help:
  - text: Did that help you?
  utter_explain_why_budget:
  - text: We need to know your budget to recommend a subscription
  utter_explain_why_email:
  - text: We need your email so we can contact you
  utter_goodbye:
  - text: Bye
  utter_greet:
  - text: Hey! How are you?
  utter_happy:
  - text: Great, carry on!
  utter_iamabot:
  - text: I am a bot, powered by Rasa.
session_config:
  carry_over_slots_to_new_session: true
  session_expiration_time: 60
slots:
  budget:
    type: unfeaturized
  business_email:
    type: unfeaturized
  company:
    type: unfeaturized
  job_function:
    type: unfeaturized
  person_name:
    type: unfeaturized
  requested_slot:
    type: categorical
    values:
    - business_email
    - company
    - person_name
    - use_case
    - budget
    - job_function
  use_case:
    type: unfeaturized

stories.md

## happy path
#* greet
#  - utter_greet
* mood_great
  - utter_happy

## sad path 1
#* greet
#  - utter_greet
* mood_unhappy
  - utter_cheer_up
  - utter_did_that_help
* affirm
  - utter_happy

## sad path 2
#* greet
#  - utter_greet
* mood_unhappy
  - utter_cheer_up
  - utter_did_that_help
* deny
  - utter_goodbye

## say goodbye
* goodbye
  - utter_goodbye

## bot challenge
* bot_challenge
  - utter_iamabot


## Some question from FAQ
* faq
    - respond_faq
    
## sales form
* contact_sales
    - sales_form
    - form{"name": "sales_form"}
    - form{"name": null}
    
## just sales, continue
* contact_sales
    - sales_form
    - form{"name": "sales_form"}
* faq
    - respond_faq
    - sales_form
    - form{"name": null}
## explain email
* contact_sales
    - sales_form
    - form{"name": "sales_form"}
    - slot{"requested_slot": "business_email"}
* explain
    - utter_explain_why_email
    - sales_form
    - form{"name": null}

## explain budget
* contact_sales
    - sales_form
    - form{"name": "sales_form"}
    - slot{"requested_slot": "budget"}
* explain
    - utter_explain_why_budget
    - sales_form
    - form{"name": null}

## interactive_story_1
* contact_sales
    - sales_form
    - form{"name": "sales_form"}
    - slot{"requested_slot": "job_function"}
* form: inform{"job_function": "brand manager"}
    - slot{"job_function": "brand manager"}
    - form: sales_form
    - slot{"job_function": "brand manager"}
    - slot{"requested_slot": "use_case"}
* form: inform{"use_case": "sales bot"}
    - slot{"use_case": "sales bot"}
    - form: sales_form
    - slot{"use_case": "we plan to build a sales bot to increase our revenue by 100%."}
    - slot{"requested_slot": "budget"}
* explain
    - utter_explain_why_budget
    - sales_form
    - slot{"requested_slot": "budget"}
* form: inform{"budget": "240k/year"}
    - slot{"budget": "240k/year"}
    - form: sales_form
    - slot{"budget": "240k/year"}
    - slot{"requested_slot": "person_name"}
* form: inform{"person_name": "Jane Doe"}
    - slot{"person_name": "Jane Doe"}
    - form: sales_form
    - slot{"person_name": "Jane Doe"}
    - slot{"requested_slot": "company"}
* form: inform{"company": "ACME"}
    - slot{"company": "ACME"}
    - form: sales_form
    - slot{"company": "ACME"}
    - slot{"requested_slot": "business_email"}
* form: inform{"business_email": "my email is email@rasa.com"}
    - slot{"business_email": "my email is email@rasa.com"}
    - form: sales_form
    - slot{"business_email": "my email is email@rasa.com"}
    - form{"name": null}
    - slot{"requested_slot": null}

nlu.md

## intent:greet
- hey
- hello
- hi
- good morning
- good evening
- hey there

## intent:goodbye
- bye
- goodbye
- see you around
- see you later

## intent:affirm
- yes
- indeed
- of course
- that sounds good
- correct

## intent:deny
- no
- never
- I don't think so
- don't like that
- no way
- not really

## intent:mood_great
- perfect
- very good
- great
- amazing
- wonderful
- I am feeling very good
- I am great
- I'm good

## intent:mood_unhappy
- sad
- very sad
- unhappy
- bad
- very bad
- awful
- terrible
- not very good
- extremely sad
- so sad

## intent:bot_challenge
- are you a bot?
- are you a human?
- am I talking to a bot?
- am I talking to a human?

## intent:faq/ask_channels
- What channels of communication does rasa support?
- what channels do you support?
- what chat channels does rasa uses
- channels supported by Rasa
- which messaging channels does rasa support?

## intent:faq/ask_languages
- what language does rasa support?
- which language do you support?
- which languages supports rasa
- can I use rasa also for another laguage?
- languages supported

## intent:faq/ask_rasax
- I want information about rasa x
- i want to learn more about Rasa X
- what is rasa x?
- Can you tell me about rasa x?
- Tell me about rasa x
- tell me what is rasa x

## intent:contact_sales
- I wanna talk to your sales people.
- I want to talk to your sales people
- I want to speak with sales
- Sales
- Please schedule a sales call
- Please connect me to someone from sales
- I want to get in touch with your sales guys
- I would like to talk to someone from your sales team
- sales please

## intent:inform
- [100k](budget)
- [240k/year](budget)
- [150,000 USD](budget)
- I work for [Rasa](company)
- The name of the company is [ACME](company)
- company: [Rasa Technologies](company)
- it's a small company from the US, the name is [Hooli](company)
- it's a tech company, [Rasa](company)
- [ACME](company)
- [Rasa Technologies](company)
- [maxmeier@firma.de](business_email)
- [bot-fan@bots.com](business_email)
- [my email is email@rasa.com](business_email)
- [engineer](job_function)
- [brand manager](job_function)
- [marketing](job_function)
- [sales manager](job_function)
- [growth manager](job_function)
- [CTO](job_function)
- [CEO](job_function)
- [COO](job_function)
- [John Doe](person_name)
- [Jane Doe](person_name)
- [Max Mustermann](person_name)
- [Max Meier](person_name)
- We plan to build a [sales bot](use_case) to increase our sales by 500%.
- we plan to build a [sales bot](use_case) to increase our revenue by 100%.
- a [insurance tool](use_case) that consults potential customers on the best life insurance to choose.
- we're building a [conversational assistant](use_case) for our employees to book meeting rooms.
- [brand manager](job_function)
- we plan to build a [sales bot](use_case) to increase our revenue by 100%.
- [240k/year](budget)
- [Jane Doe](person_name)
- [ACME](company)
- [my email is email@rasa.com](business_email)

## intent:explain
- why
- why is that
- why do you need it
- why do you need to know that?
- could you explain why you need it?

actions.py

# This files contains your custom actions which can be used to run
# custom Python code.
#
# See this guide on how to implement these action:
# https://rasa.com/docs/rasa/core/actions/#custom-actions/


# This is a simple example for a custom action which utters "Hello World!"

# from typing import Any, Text, Dict, List
#
# from rasa_sdk import Action, Tracker
# from rasa_sdk.executor import CollectingDispatcher
#
#
# class ActionHelloWorld(Action):
#
#     def name(self) -> Text:
#         return "action_hello_world"
#
#     def run(self, dispatcher: CollectingDispatcher,
#             tracker: Tracker,
#             domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
#
#         dispatcher.utter_message(text="Hello World!")
#
#         return []

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


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 slot_mappings(self):
        # type: () -> Dict[Text: Union[Dict, List[Dict]]]
        """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")}

    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 []


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()]

It’s because the FormPolicy has the highest priority of all forms. So whenever a FormAction is active, it will first try to fill any slot with information from your message. However, if it fails to do so a ActionExecutionRejection (a special case of an Exception) is thrown and the message is handed over to the remaining policy ensemble.

tl;dr It’s normal.

Hi, @IgNoRaNt23! Now I know that when I asked “why do you need to know that”, the Formaction will try to extract the slot from my message and eventually fail. Does this mean I always get an error here? What can I do to prevent this from happening. Maybe by adding some slot_mappings and validate function?

Yes, this means you always get an error here, but this is a necessary error to leave the FormAction and let other policies decide on the bot’s action. Without that error, you would not get your explanation messages. You could include logic to answer within the FormAction, but I dont why you would do that. Dont do that, just because you want to get rid of an error message in your logs.

btw are you really working with dark-blue text on black? Dont kill your eyes please

Hi, @IgNoRaNt23 Thank you for your concern, I rarely use it. So does this mean that this error is just an error message in my logs and will not be seen by real user, so everything’s fine with my code and I should ignore it?

Unless you expect your users to run their own bot with your code within the shell, they wont see this. Moreover it’s bad design (esp for security issues) to let anyone see technical details.

So no, your users are not supposed to run the bot within the shell. If they use any GUI (for example RasaX) they wont see any log messages like this error.

@IgNoRaNt23 Thanks ever so! I’m new to rasa. I haven’t used any GUI to run my bot, so I thought it was a big problem. Thanks again!

Am also getting the same error ‘Failed to extract slot job_function with action sales_form’.

Hi, @nyaribari, You can read the response above, as long as it is not on the “happy path”, this is a necessary error to leave the FormAction and let other policies decide on the bot’s action.

I have the same problem, have you solved it? So how do you make “why are you answering this question” work.The unhappy story is also copied from the official website example

Is this behaviour still the case with the Rules-Policy in Rasa 2? I see the technial reason, but this error is annoying and hard to explain to others.