Bot not following actions and interpreting wrong intent

I’m building a bot that recognizes tasks in a to-do list. When I get the bot to ask for the name of a task, it misinterprets some of the names of the tasks as other intents, such as thinking “job” as the “goodbye” intent. Either way, I’ve set up the Rules to automatically call a sequence of actions, yet it’s not recognizing this sequence, even when I use Rasa interactive to change the intent to “inform”. I’ve included my code below.

The way I want it to work is the bots asks ‘which tasks?’. It listens for the task name, which triggers an action to check the asana database, which returns a list of enumerated task names. the User then gives a number, which triggers the next action (AsanaSelect) with the appropriate name.

What am I doing wrong? I appreciate any help!

Actions:

class CheckAsana(Action):
    
    def name(self) -> Text:
        print ('check asana invoked')
        return "check_asana_action"
    

    def run(self, dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
        
        text_of_last_user_message = tracker.latest_message.get("text")
        
        
        
        
        tasklist = list_tasks_numbered_names(text_of_last_user_message)
        

        
        dispatcher.utter_message('here is a list of tasks', tasklist)



class AsansSelect(Action):
    
    def name(self) -> Text:
        print ('check asana invoked')
        return "select_asana_action"
    

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

        text_of_last_user_message = tracker.latest_message.get("text")
        
        print ('this is the last user message in asana capture', text_of_last_user_message)

        capture = re.search('(\d. )(.*\n)', text_of_last_user_message)
        
        print ('this is the capture', capture)

        #task_name_selected = capture.group(1)

        print ('DEBUG: this is the selected task', task_name_selected)
        
        return task_name_selected

Rules

# check asana

- rule: check asana rule 1
  steps:
  - intent: check_asana
  - action: utter_asana_task_name

- rule: check asana rule 2
  steps:
  - action: utter_asana_task_name
  - action: check_asana_action
  - action: select_asana_action

flagging @SamS for help. I’m not sure if the best way to do this is with a series of actions, or with slot forms. My problem is that I don’t know how to present the user with a series of options that are available, and then have the conversation continue based on which option the user chooses. Thanks for any help or links to examples. Thank you!

@travelmail26 this sounds like the same thing we discussed in another thread the other day, can you confirm?

I still think your use case asks for a form. Because forms can run regardless of what the intent is (see more on from_text slot mapping for instance. If you want to use custom actions, then you’ll have to either train your NLU such that it can classify things correctly (tricky, if the user can input all kinds of different task names), or you’ll have to write rules/stories for any intents, so that they’re followed by the correct actions…

2 Likes

Thanks @SamS , as i wrote about here I’m not sure how to do this kind of thing in the forms in Rasa 2.0, because i don’t know how to present a list of available options to the user for slot filling (and i can’t find any examples of how to do it). Any resources or links you can point to? thanks!

because i don’t know how to present a list of available options to the user for slot filling (and i can’t find any examples of how to do it).

From my intuition I’d specify a form like this:

forms:
  todo_list:
    item:
    - type: "from_text"

Rasa Open Source will then trigger a action to ask the user to fill the slot. You can specify a custom action action_ask_item which could query your database and utter the options.

1 Like

Thanks! i’ve been making progress because of your suggestions and have moved on to forms (though am still running into problems). appreciate the help

1 Like