Help to build Bot in production with externally trained NLG model

I am new to Rasa and AI. My task is to build a task-specific chatbot. I have to use an open source dataset to train rasa for dialog learning. But the open source datasets does not have dialogues for the intents of proper greetings but it is one of the main requirement in my Project. So, could I get some demo examples on integrating templates for intents “greetings, Thank you” and task specifc conversations using the corpus-based trained model using rasa core? My another requirement is to train a NLG model externally using a opensource dataset and integrate with rasa core to generate natural response for task specific conversations and responses from Templates provided for intents such as “greetings, Thank you”. Could I get some help to achieve this in my project?

@sarankarthik not quite sure I understand your first question, but there’s examples of stories in this repo. As for the NLG model, do you mean actually generating a response, or selecting a pre written template to respond to your user with?

@akelad Thanks for your Response! I have tried a sample restaurantbot from the repository of Rasa. Is there any Option to Train rasa core directly using an opensource dataset instead of creating the stories? In the documentation, it has specified that the bAbi dataset has converted into stories of Rasa Format (Stories)

For NLG, I have meant generating a suitable Response instead of pre-written templates. The idea is to Train NLG model using an opensource dataset to generate an automated Response. Is it possible to integrate trained NLG model with Rasa core to generate a Response? Is it possible using a POST request? (Responses)

Could you get my point?

no, you have to convert it to NLU data and stories format. There’s no end-to-end training option at the moment.

As for NLG, you can create your own custom NLG server which hosts your NLG model: Responses

Thanks for the clarification @akelad.

I am going to do my project for an Enterprise and I would like to know, if I Could get your contact to discuss about the possibility of joining together to work for an end-to-end training option?

Hi @sarankarthik I’m happy to answer any of your questions here. However, I don’t think we’ll be looking into full end-to-end training at the moment. @dakshvar22 is working on a component that somewhat goes towards that direction - maybe he can give you some more information about that

Thanks for the Information and a Recommendation @akelad

Hi @sarankarthik , As @akelad mentioned we are working on releasing a new component which can help integrate open domain utterances like chitchat better into your task oriented chatbots. It’s an end-to-end training in the sense that we pick the most appropriate response to a user utterance from a list of candidate responses. We are not yet focussing on end-to-end response generation though. Happy to answer any questions you have.

Hi @dakshvar22. I thank you for the Information.

If I am Right, the new component which you have created will Focus on candidate Response selection. Could you clarify me whether this new component will be integrated into rasa core by your custom Code, which can be accessible by a CLI or else the trained model NLG model should be hosted in a custom NLG Server as mentioned in (Responses)?

@sarankarthik It will be integrated into rasa core and triggered by a new action type.

That’s really cool. Thanks!

Could you inform me how long does it take to release this new component?

could I get your contact to discuss about this Topic further?

@sarankarthik It should be released with Rasa 1.3 (hopefully in the next couple of weeks)

Thanks for the information! @dakshvar22

Hi @dakshvar22

Could you clarify me whether you use a list of candidate responses for each user utterances in the templates of the domain.yml file or else have you trained NLG externally using your custom NLG dataset and then created your custom NLG server to host your model for a response?

Hi @sarankarthik, The feature is out now with Rasa 1.3 Here is the documentation for it - Retrieval Actions We’ll also be releasing a blogpost about it next week, so you can get a better understanding there too.

We rely on developer providing the list of candidate responses and then train the response selector as an NLU component. The above docs should help you out more.

Hi @akelad I have NLU component using a custom dataset, which has data as shown below,

"rasa_nlu_data": {
    "common_examples": [
            "intent": "general_greet",
            "text": "Hi"
            "entities": [
                    "end": END_VALUE,
                    "entity": "Name",
                    "start": START_VALUE,
                    "value": "RESTAURANT_NAME"
            "intent": "rest_inform",
            "text": "I am looking for a particular restaurant . It is called RESTAURANT_NAME ."
            "intent": "greet_thank",
            "text": "Ok sounds good . Thank you !"


I have the stories format as follows,

* general_greet
 - greet
 - rest_search
* rest_req{ENTITY:VALUE}
 - rest_search
 - rest_suggest{ENTITY:VALUE}
* rest_confirm{ENTITY_VALUE}
 - rest_book{ENTITY:VALUE}
* thank
 - greet_thank+greet_bye

I have trained both Rasa NLU and Rasa core using tensorflow embedding and with policies keras and EmbeddedPolicy respectively.

I have my custom NLG dataset as follows,

intent, entities, text

I have trained this custom NLG dataset using keras and tensorflow externally without using rasa.

So, for each user’s utterance, the system must execute custom actions. The custom action must request to the server with the information(INTENT,{ENTITY_VALUE,ENTITY_VALUE}) where I hold the NLG model and the model should provide the corressponding response for the requested information (INTENT,{ENTITY_VALUE,ENTITY_VALUE}), which has been used while training.

I have read this document in creating custom actions (Actions), where it also says that there is an option to handle this scenario using POST request in the sections ’ Execute Actions in Other Code’, ’ Proactively Reaching Out to the User Using Actions’ , and (Action Server).

I have tried to create custom actions based on this repo (rasa-demo/ at master · RasaHQ/rasa-demo · GitHub). But it is hard for me to understand the concept. Is there any simple example to understand that concept, so that I can create my custom action for the above mentioned scenario?

Could you help me with this?

Thanks for the Information @dakshvar22

Now, I got that it is a retrieval based bot

@akelad , could you tell me whether the afore-mentioned idea is possible to execute or not? I’m afraid that I might take a wrong direction and waste my time.

If you are working on this, could you please let me know about the duration, so that I can wait for your response?

Hi @sarankarthik you can execute requests from a custom action with the requests library for example

@akelad, Thanks for an Information :slight_smile: