Adding new intent and action to starter pack is not working

I am able to add new examples for existing intents and once the model is retrained it works fine. But when I add new intent time as shown

`intents:

  • greet
  • goodbye
  • thanks
  • deny
  • joke
  • name
  • time` add new action as

`actions:

  • utter_name
  • utter_thanks
  • utter_greet
  • utter_goodbye
  • action_joke
  • action_time`

add new training examples in nlu_data.md as

`## intent:time

  • What is the time now?
  • Current time ` add a new story

` ## story_time_01

  • time
    • action_time` (syntax is proper I checked)

and added a new action handler in actions.py as

`class ActionTime(Action): def name(self): # define the name of the action which can then be included in training stories return “action_time”

def run(self, dispatcher, tracker, domain):
    # what your action should do
    # resp = str(datetime.now())
    dispatcher.utter_message("Hello world!")  # send the message back to the user
    return []`

and when I rebuild, retrain everything - the action server shows me that new action is registered but when interact with the bot by asking “Current time” or “What is the time now?” - it does not recognize and goes back to greeting. I tried adding few sequences to the story section but not working.

This sounds like an NLU issue. The bot is not correctly identifying the intent the user gives it.

Can you try running your Core + NLU run command with the debug (–debug) flag to verify? Run it, ask “what is the time now?” and read what the NLU does. for me it looks like this:

If the NLU says it recognizes a different intent, try to update your NLU model to make it doubly sure of what you mean.

To test if it’s NOT an NLU issue you can try to directly feed the intent to the bot by using slash (‘/’) and then the intent name (e.g. /what_is_the_time) if it doesn’t recognize that command, there’s either something wrong in your domain file (intent not added) or in your stories.

tried with the / and both of the texts generate the intent and I get a proper response. So I guess something wrong with the stories and not matching it. stories.md (821 Bytes) nlu_data.md (2.6 KB) domain.yml (450 Bytes)

Here is the NLU debug information.

Your input -> What is the time now?
2019-03-14 15:34:56 DEBUG rasa_core.tracker_store - Creating a new tracker for id ‘default’. 2019-03-14 15:34:56 DEBUG rasa_core.processor - Received user message ‘What is the time now?’ with intent ‘{‘name’: ‘goodbye’, ‘confidence’: 0.27236523003856555}’ and entities ‘[]’ 2019-03-14 15:34:56 DEBUG rasa_core.processor - Logged UserUtterance - tracker now has 2 events 2019-03-14 15:34:56 DEBUG rasa_core.processor - Current slot values: name: None 2019-03-14 15:34:56 DEBUG rasa_core.policies.memoization - Current tracker state [None, {}, {‘intent_goodbye’: 1.0, ‘prev_action_listen’: 1.0}] 2019-03-14 15:34:56 DEBUG rasa_core.policies.memoization - There is a memorised next action ‘10’ 2019-03-14 15:34:56 DEBUG rasa_core.policies.ensemble - Predicted next action using policy_1_MemoizationPolicy 2019-03-14 15:34:56 DEBUG rasa_core.processor - Predicted next action ‘utter_goodbye’ with prob 1.00. 2019-03-14 15:34:56 DEBUG rasa_core.processor - Action ‘utter_goodbye’ ended with events ‘[]’ 2019-03-14 15:34:56 DEBUG rasa_core.processor - Bot utterance ‘BotUttered(text: Talk to you later!, data: { “elements”: null, “buttons”: null, “attachment”: null })’ Talk to you later! 2019-03-14 15:34:56 DEBUG rasa_core.policies.memoization - Current tracker state [{}, {‘intent_goodbye’: 1.0, ‘prev_action_listen’: 1.0}, {‘prev_utter_goodbye’: 1.0, ‘intent_goodbye’: 1.0}] 2019-03-14 15:34:56 DEBUG rasa_core.policies.memoization - There is a memorised next action ‘0’ 2019-03-14 15:34:56 DEBUG rasa_core.policies.ensemble - Predicted next action using policy_1_MemoizationPolicy 2019-03-14 15:34:56 DEBUG rasa_core.processor - Predicted next action ‘action_listen’ with prob 1.00. 2019-03-14 15:34:56 DEBUG rasa_core.processor - Action ‘action_listen’ ended with events ‘[]’ 127.0.0.1 - - [2019-03-14 15:34:56] “POST /webhooks/rest/webhook?stream=true&token= HTTP/1.1” 200 186 0.217594

So this tells us your NLU classified “what is the time now?” with an intent called goodbye. Not that great :smiley:

Since /time does generate the proper intent, we know that there’s nothing wrong with the stories nor the domain. We’ll have to look at NLU.md as the culprit.

So, I’ve checked your NLU data file.

You have 2 examples for your time intent. Your model won’t be able to generalize from that. Think about it like this: I’m going to teach you dutch. You can say thank you in dutch like this:

  • dankjewel
  • dank je wel

So now, if I say

  • danku!

what do I mean by that? It could mean dankjewel. It could also mean something way different :wink: Take a guess! It’s what your model does.

So if I add more examples for you, how to say ‘dankjewel’ differently:

  • dank je
  • bedankt
  • dank je man
  • mijn dank
  • ik stel het op prijs

Now you will be able to generalize way better.

So: Please add about (at least) 6 more examples and retrain your NLU engine please. you’ll see that it’ll classify your intent way better.

2 Likes

Did that and it works perfectly. Also I got the root problem of why the intent classifier was ignoring this. wonderful explanation !!

and

hartstikke bedankt :grinning:

haha! Good job! Please mark my previous post as ‘solution’ to make this thread usable for people with the same problem! You can find the solution button next to the heart below the post.

Can’t find the solution button next to any heart :roll_eyes:

No solution button I can see :frowning:

Ah! I see that your post is in a different subforum. “Rasa Stack” forum has this option. Oh well!