Trouble accessing slot data in basic scenario

I’m using Rasa v1.8 and my conversation is like the below. I want to give rasa the waypoint_name “alpha” and to store that into a string to be used in the bot’s response. However, the bot says ‘None’ when it should say ‘alpha’. I have the slot waypoint_name setup as text.

Your input ->  I want to save this location
Do you want to save this location?
Your input ->  yes
What name do you want to give this location?
Your input ->  alpha
Done with saving None
Done with saving None
Your input ->      

I only have one story:

## save waypoint confirmation 1
* waypoint_desire_save
  - utter_waypoint_confirm_save
* affirm
  - utter_waypoint_request_name
* waypoint_save{"waypoint_name": "alpha"}
  - slot{"waypoint_name": "alpha"}
  - action_set_waypoint
  - utter_waypoint_save_response
* thanks
  - utter_you_are_welcome

And my action.py is like this:

class ActionSetWaypoint(Action):
    def name(self) -> Text:
        return "action_set_waypoint"

    @staticmethod
    def required_slots(tracker):
        return ["waypoint_name"]

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

        waypoint_name= tracker.get_slot('waypoint_name')
        dispatcher.utter_message(text="Done with saving " + str(waypoint_name))

        return [SlotSet("result", "successful")]

My intents for waypoint_save are setup like this:

## intent:waypoint_save
- save this place as (alpha)[waypoint_name]
- I would like to name this place (alpha)[waypoint_name]
- Let's call this spot (alpha)[waypoint_name]
- Let's name this location (alpha)[waypoint_name]
- I'd like to call this place (alpha)[waypoint_name]
- save this spot and call it (alpha)[waypoint_name]
- save waypoint
- mark waypoint
- remember this place
- remember this spot
- mark this location
- save this place
- don't forget this spot
- don't forget where this place is
- return here
- (alpha)[waypoint_name]

I have two follow up questions:

  • Why does the bot not execute utter_waypoint_save_response which is setup as “Saving waypoint {waypoint_name} was {result}”
  • Why, instead, does the bot repeat the line “Done with saving None” twice?

I think the conversation example that you gave, does not follows the story exactly.

Your action seems a bit off. There is no required_slots method when you extend from Action class. This method is for Form action.

Now, in your stories, utter_waypoint_save_response happens right after action_set_waypoint, but action_set_waypoint is returning a SlotSet event which is not present in your story. I suggest you modify your story to something like this:

## save waypoint confirmation 1
* waypoint_desire_save
  - utter_waypoint_confirm_save
* affirm
  - utter_waypoint_request_name
* waypoint_save{"waypoint_name": "alpha"}
  - slot{"waypoint_name": "alpha"}
  - action_set_waypoint
 - slot{"result": "successful"}
  - utter_waypoint_save_response
* thanks
  - utter_you_are_welcome

Thanks Saurabh.

I made the following changes based on your suggestions:

  • I edited actions.py to comment out @staticmethod and the entire def required_slots(tracker) function
  • I added slot{"result": "successful"} to my story like you showed

My conversation now looks like this:

Your input ->  I want to save this location
Do you want to save this location?
Your input ->  yes
What name do you want to give this location?
Your input ->  alpha
Done with saving None
Saving waypoint None was successful
Your input ->

That’s a nice improvement! Thanks!

However, I’m still getting Done with saving None instead of Done with saving alpha. Can you help me understand how to access the slot waypoint_name within actions.py?

Okay, I got it to work. In addition to the suggestions from Saurabh, here are the changes I made:

  • Made sure my config.yml was using the pipeline: supervised_embeddings. (entities weren’t being extracted with preembeddings.)
  • I removed slot{"waypoint_name": "alpha"} because entities are automatically stored into slots.
  • The format of my intents was incorrect. They should have been [alpha](waypoint_name) instead of what I had above.