chatbotrasa-nlurasarasa-corerasa-x

Reload model according to the chosen language in rasa chatbot


I made a chatbot. When starting the conversation, the bot shows the message “Choose a language” and it gives the option to choose a language using two buttons which displays “English” and “French” respectively (I have 2 models: English and French).

The question is "How to reload the appropriate model according to the button clicked?"

Thanks.


Solution

  • This would be mighty hard to implement due the nature of Rasa start scripts. Basically, they expect you to start a model when the server starts and Keep on using it. The baseline issue is Rasa only allows one model per service. i.e. it cannot server both languages at the same time without you doing some serious changes to how the startup scripts are written ( I havent worked past rasa 1.9. so my answer might be outdated - but I highly doubt it)

    Therefore the preferred solution as I see is to have two separate bot instances for the two languages and use a language trigger/switch mechanism in the Front-End to route the user messages to the correct bot.

    Edit: adding project structure.

    - Front-End : Has a language chooser dropdown menue. FE sends messages to the web server. i.e. www.your.server/chatbot/{language} 
    - web server: nginx to expose bot APIs: Routes the messages to the correct bots based on the input path (/chatbot/{language}). 
    ---- Bot 1: Language: en
    ---- Bot 2: Language: zh_CN