Is there any way to switch between two models

Yup. Look at one of the custom actions in my project:

class ActionUtterGreet(Action):
    def name(self):
        return 'action_utter_greet'
    
    def run(self, dispatcher, tracker, domain):
        followup_action = 'action_utter_service_types'

        text = get_text_from_lang(
            tracker,
            ['Hi, I’m XXX automated virtual assistant.',
            'Bonjour, je suis l\'assistant virtuel automatisé de XXX.',
            'مرحبًا ، أنا مساعد افتراضي تلقائي لنظام XXX.',
            'Ողջույն, ես XXX ավտոմատացված վիրտուալ օգնական եմ.'])

        if tracker.get_slot('language') is None:
            followup_action = 'action_utter_ask_language'
        
        print('\nBOT:', text)
        dispatcher.utter_message(text = text)

        return [FollowupAction(followup_action)]

get_text_from_lang() is a function that accesses the language from tracker, which is stored in a slot, and outputs the corresponding message in the list.


You can leave all your intents’ examples in English only. That’s what the custom component will avoid - multilingual intents.

But as a response, you will always have to use a custom action, unless you change the source code of Rasa - you will have to create a new topic for that particular case and be very clear in the title.

Back to custom actions, in my example above I explicitly typed the utterances. But you can also use a translation API like in the custom component. My code will become:

class ActionUtterGreet(Action):
    def name(self):
        return 'action_utter_greet'
    
    def run(self, dispatcher, tracker, domain):
        followup_action = 'action_utter_service_types'

        text = translate(tracker, 'Hi, I’m XXX automated virtual assistant.')

        if tracker.get_slot('language') is None:
            followup_action = 'action_utter_ask_language'
        
        print('\nBOT:', text)
        dispatcher.utter_message(text = text)

        return [FollowupAction(followup_action)]

translate() is a function that accesses the language from tracker, which is stored in a slot, and outputs the message translated to that language.

The benefit of this approach is that both the custom component and the custom action will be able to understand any language and speak any language. Of course, you could choose to understand all but only reply in Arabic if the user spoke in Arabic and English if the user spoke anything else for example.