How to execute utter actions between slot filling of forms : ERROR rasa_sdk.endpoint - Failed to extract slot email with action user_info

Hi Guys ,

I’m in the process of building my first bot. :slight_smile: I am using forms to extract entites ,name, email, pincode and mobile number and set them as slots ( of the same name ). They are handled by form user_info in the same order.Then just simply return the names back to the user.

The bot is after initiating the form, extracts the name entity and sets the slot value. Then moves email. But here I am getting.

ERROR rasa_sdk.endpoint - Failed to extract slot email with action user_info

ERROR rasa.core.actions.action - Failed to extract slot email with action user_info

I have ran the command :

rasa run actions & rasa shell --debug

Please Find the logs below:

1.

file:///home/sanjay/Pictures/Rasa_log1.png user_info

2.

file:///home/sanjay/Pictures/rasa_log2.png

3.

file:///home/sanjay/Pictures/rasa_log3.png

4.

file:///home/sanjay/Pictures/rasa_log4.png

5.

file:///home/sanjay/Pictures/rasa_log5.png

In the end the entities all the four entities(name, email, pincode, mob_number) are extracted and I get the output too.

Please also find my files :

1.nlu.md

##intent: greet

  • Hi
  • Hey
  • Hi bot
  • Hey bot
  • Hello
  • good morning
  • hi again
  • hi folks
  • hi Mister
  • hi pal!
  • hi there
  • greetings
  • hello everybody
  • hello is anybody there
  • hello robot
  • hi

intent:give_name

##intent:give_email

##intent:give_pincode

##intent:give_mobile

##intent:goodbye

  • bye
  • goodbye
  • see you around
  • see you later

intent:affirm

  • yes
  • indeed
  • of course
  • that sounds good
  • correct
  • ye
  • uh yes
  • let’s do it
  • yeah
  • uh yes
  • yes knocking
  • that’s correct
  • yes yes
  • right
  • yea
  • right on
  • i love that

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?

regex:email

  • [1]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,}$

regex:mob_number

  • [0-9]{10}

regex:pincode

  • [0-9]{6}
  1. stories.md

    happy path

    • greet
      • utter_greet_ask
    • give_name{“name” : “Baljith”}
      • user_info
      • form{“name”:“user_info”}
      • form{“name”: null}

    say goodbye

    • greet
      • utter_greet_ask
    • give_name{“name” : “Baljith”}
      • user_info
      • form{“name”:“user_info”}
      • form{“name”: null}
    • goodbye
      • utter_goodbye

    bot challenge

    • greet
      • utter_greet_ask
    • give_name{“name” : “Baljith”}
      • user_info
      • form{“name”:“user_info”}
      • form{“name”: null}
    • bot_challenge
      • utter_iamabot

3.domain.yml

 session_config:
  session_expiration_time: 60
  carry_over_slots_to_new_session: true
intents:
- greet
- give_name
- give_email
- give_pincode
- give_mobile
- goodbye
- affirm
- deny
- mood_great
- mood_unhappy
- bot_challenge


responses:
  utter_greet_ask:
  - text:  "hey there ,whats your name?"
  utter_did_that_help:
  - text: Did that help you?
  utter_goodbye:
  - text: Bye
  utter_iamabot:
  - text: I am a bot, powered by Rasa.
  utter_ask_name:
    - text: "Your name is?"
    - text: "What is your name?"
    - text: "Please tell me your name"
    - text: "Please enter  name."
  utter_ask_email:
    - text: "Your email is?"
    - text: "What is your email id?"
    - text: "Please tell me your email id"
    - text: "Please enter  email id."
  utter_ask_pincode:
    - text: "Your pincode is?"
    - text: "What is your pincode?"
    - text: "Please enter  your pincode."
    - text: "Please tell me your pincode."
  utter_ask_mobile:
    - text: "Your mobile number is?"
    - text: "What is your mobile number?"
    - text: "Please enter  your mobile number."
    - text: "Please tell me your mobile number."


actions:
- utter_greet_ask
- utter_did_that_help
- utter_goodbye
- utter_iamabot
- utter_ask_name
- utter_ask_email
- utter_ask_pincode
- utter_ask_mobile

entities:
  - name
  - email
  - pincode
  - mob_number

slots:
  name:
    type: unfeaturized
  email:
    type: unfeaturized
  pincode:
    type: unfeaturized
  mob_number:
    type: unfeaturized


forms:
  - user_info

4.actions.py

from typing import Any, Text, Dict, List

from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher
from rasa_sdk.forms import FormAction

class UserInfo(FormAction):

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

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

def slot_mappings(self) -> Dict[Text, Any]:
    return {"name": self.from_entity(entity="name",
                                     intent=["give_name"]),
            "email": self.from_entity(entity="email",
                                      intent=["give_email"]),
            "pincode": self.from_entity(entity="pincode",
                                        intent=["give_pincode"]),
            "mob_number": self.from_entity(entity="mob_number",
                                           intent=["give_mobile"])}

def submit(self,
           dispatcher: CollectingDispatcher,
           tracker: Tracker,
           domain: Dict[Text, Any]
           ) -> List[Dict]:
    name = tracker.get_slot('name')
    email = tracker.get_slot('email')
    pin = tracker.get_slot('pincode')
    mob = tracker.get_slot('mob_number')
    # utter submit template
    dispatcher.utter_message(
        "Hey, your name is {} , email id : {} , pincode is {} , maobile number is {}".format(name.title(),
                                                                                             email.title(),
                                                                                             pin.title(),
                                                                                             mob.title()))
    return []

5.config.yml

language: en

pipeline: supervised_embeddings

policies:

  • name: MemoizationPolicy
  • name: KerasPolicy
  • name: MappingPolicy
  • name: FormPolicy

6.endpoints.yml

action_endpoint:
  url: "http://localhost:5055/webhook"

It’s really wierd.I’ve been stuck on this for a long time. I saw Rasa Master class videos and searched the documentation and tried everything.Nothing seems to be working.

Is it because the training examples are less ?? or Am I missing something ?

PS: I am a total newbie, Please Help :innocent:.


  1. a-zA-Z0-9._%± ↩︎

Guys , update !

I am able to extract email now. What I did was use interactive learning to train and added new training data.

But now there is a new issue.

The form(user_info) has to collect 4 entities (name, email, pincode and mobnumber) and fill the slots of same name.For each info there is an utter_ask action to ask the user.

The form runnig smoothly till pincode and when it reaches mobnumber , it dosn’t run utter_ask_mobnumber. Instead it is an action_listen.

I have tried interactive learnig as well. But it dosn’t seem to work.

Here is my github Repo :innocent:

Could anyone please help out ??

TL;DR

It is a general doubt…

While a form is running, fetching entities from user message and filling slots , is there a way to control and specify what the bot will say next…

Eg:

bot : What is your name ?

me: I am Reus.

bot: What is your email ?

Me: It MR11HejaBvb@gmail.com

Bot: Pin code?

Me: 123456

bot:…

next is has to ask the mobile number…

The bot dosn’t execute utter_ask_mobnumber after I’ve provided pincode. That is the summary of the above problem.

Hi @_sanjay_r. I just tested your assistant using the code you provided (thank you so much for this by the way, it makes debugging so much easier!), but could couldn’t replicate the issue. The assistant asked for all of the required slots and things worked well. You could try running rasa in a debug mode (when you run rasa shell, add the --debug flag) then you can see what your assistant does by the time it stops responding.

I have noticed though that you are not using components like duckling to extract the numbers from user inputs. It is not required, but duckling would make the extraction of the entities like pin, mobile number much more reliable. I doubt that it’s the case but it could be contributing to the issue you are facing a little bit.

Hi @Juste,

The problem was it didn’t work all the time.

I had seperated all intends based on entities they had like give_name, give_email, give_pincode and give_mobnumber

and one form user_info.

I combined all the intents into one as give_info .

That solved the issue. I guess the bot was getting confused. Now it works fine :slight_smile:

Also , Thanks for the heads up regarding Duckling. I will try it. :slight_smile: