main

2018/08/21

Building your chatbot with RASA (tutorial 1)

I was recently introduced to RASA, a new chat bot which immediately captured my attention after playing with it.

Here I am using Python framework , following their own example as https://rasa.com/docs/core/quickstart/ and hopefully you can learn to practice it yourself.

However, I do divert from that a little bit to provide a better flow based on my experience.

Basically a conversation has question/answers. We just need make the bot understand our question and then provide a proper answer.  Here is one example:

If we say: Hello/Hey/Hi/Good morning/Good afternoon/Hi, Hi/ Hi, Bot/, we are greeting the bot. The bot should understand this question ( here in RASA, it is called intent) and answer accordingly. The bot can answer as simple as "hey" or "hey, nice to meet you", or "hey, what can I do for you, etc" .

So we need build a system which understand the "intent", "action" based on the intent, then "answer" the human.

Here is the steps:

1) create the domain.yml file, which defines intent, actions, templates
intents:
    - greet

actions:
    - utter_greet

templates:
    utter_greet:
        - "Hello. Can I help you?"

2) create stories.md file, which define the story line
## general greetings
* greet
   - utter_greet

3) training the model in the command line
python -m rasa_core.train -d domain.yml -s stories.md -o models/dialogue

4) run the chatbot in the command line
python -m rasa_core.run -d models/dialogue

5) or run the chatbot in non-stop mode as in the RASA tutorial
python sample_chatbot.py

The GitHub repo is https://github.com/chaowu2009/sample_chatbot_RASA

No comments:

Post a Comment

How to Supercharge Your Python Classes with Class Methods

  How to Supercharge Your Python Classes with Class Methods | by Siavash Yasini | May, 2024 | Towards Data Science As we just mentioned, a c...