In our today’s blog to customize the chatbot build with docker, you will learn,
– How to customize your bot and to update it inside the docker container,
– How to train the bot with docker commands.
In the previous blog, you have seen that,
– How you can pull the docker images from docker hub,
– How to create an environment free and platform-independent project for Rasa Chatbot
– Also, you have learned how you can talk to the rasa chatbot with docker commands.
Like in the previous blog, you have learned how to initialize your Rasa chatbot inside docker. In this blog, you will learn to customize the chatbot build with docker.
To clarify that even better now I’ll use the rasa project of my choice whether the initial Rasa project or any existing project which you may have created from the previous blogs. Now you must be thinking that why did I say that any project of my choice, the reason for that is because with the initial setup of the project your docker environment for rasa is already set and you have your initial project inside the docker. This simply means now if you will use any project of your choice then it will be like the updated project with new data added into it.
But to make you even crystal clear, now I will take and example where I’ll use the given conversation,
User: What is your name? Bot: My name is Innovate. User: Nice to meet you. Bot: Same here.
Now, you have to update the nlu data, stories, registered actions, etc. according to the above conversation. Firstly add the given intents to the nlu.md :
nlu.md ## intent:what_name - what is your name? - May I know your name please - tell me your name - How do you spell your name ## intent:nice_meet - nice meeting you - nice to meet you - It was pleasure meeting you.
Now update the domain.yml file with the added intent and the bot responses,
domain.yml intents: - what_name - nice_meet responses: utter_name: - text: "My name is Innovate." utter_nice_meet: - text: "The pleasure is all mine." actions: - utter_name - utter_nice_meet
Now the final step to make the above story work is to create the story from the above conversation in
stories.md ## happy path for name story * what_name - utter_name * nice_meet - utter_nice_meet
So with the updation of the above files. Now you have customize the chatbot build with docker.
Check this video session for more clarification:
The last step is left which will train the model and will update the data and model inside the docker container for Rasa. Now open the terminal and go to your project directory. Then, type the given command to train your Rasa Chatbot with the customized data.
Ubuntu/Mac: docker run --user 1000 -v $(pwd):/app rasa/rasa:1.10.8-full train --domain domain.yml --data data --out models
If you are using windows system then this command will not work for you. In that case use the given command:
Windows: docker run --user 1000 -v $(cd):/app rasa/rasa:1.10.8-full train --domain domain.yml --data data --out models
When this command will get executed successfully as per your operating system, your complete Rasa project will get the latest model with the predefined configurations, and also it will update the complete project inside the docker container automatically.
Now you can test your chatbot with the latest trained model with the predefined configurations with the recommended policies and pilpelines. Now run the below command to test the working of you chatbot with the latest model with respect to the docker container,
docker run --user 1000 -it -v $(pwd):/app rasa/rasa:1.10.8-full shell
if you want to debug it then run the given command.
docker run --user 1000 -it -v $(pwd):/app rasa/rasa:1.10.8-full shell --debug
When you will talk to the bot you will see the conversation between the bot and user, something like this,
For more understanding and clarification on rasa chatbot, you can check out the official website of rasa and docker hub. Also, you can check these video contents for the deployment of rasa Chabot on the live server with Google Cloud Platform and link it to the domain name.
This is all about to customize the chatbot build with docker. I hope you have got the crystal clear understanding of it. But still if you are facing any difficulties in understanding and implementing it. Feel free to leave a comment below in the comment section.
Stay Tuned and Happy Learning. 🙂