Hi , i want that the bot ask for user name and than use it back to greet ,
User: hi
Bot : hi, what’s ur name?
user : my name is Ali
Bot : hi ali how can i help you?
The name entered by the user (ali) is unknown for the model . how can i do it ,?
Nlu.md
intent:greet
- hey
- hello
- hi
- good morning
- good evening
- hey there
intent:goodbye
- bye
- goodbye
- see you around
- see you later
intent:ask_name_action
Domain.yml
intents:
- greet
- goodbye
- ask_name_action entities:
- name slots: name: type: text actions:
- action_hello_world
- utter_greet
- utter_goodbye
responses: utter_greet:
- text: "Hey! please enter your name "
utter_goodbye:
- text: “Bye”
session_config: session_expiration_time: 60 carry_over_slots_to_new_session: true
stories.md
ask_name
- greet
- utter_greet
- ask_name_action
- action_hello_world
- goodbye
- utter_goodbye
Actions.py
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]]:
name= tracker.get_slot("name")
msg="hello {} how can i help you?".format(name)
dispatcher.utter_message(text=msg)
return []