Using Custom NLU with Rasa X

Hello,

last year we were using Rasa with our own custom NLU (complete pipeline).

After migrating to new Rasa, we encountered a problem while running Rasa X with our NLU.

It is connected as endpoint:

nlu:
url: "http://172.24.30.193/"
action_endpoint:
url: "http://localhost:5055/webhook"

And it works fine when run as rasa shell, but won’t get connected with rasa x.

Is replacing Rasa NLU with custom NLU not supported anymore or should it be done differently?

Thanks in advance!

1 Like

Hi, we are still traing to find a solution for this. Could anyone help?

What is the correct way to connect a custom NLU (available as Web service) to Rasa Core?

Hey Maria,

Running into the same problem here, did you manage to find a way to make it work?

thanks, Jamie

Hello! I am also interested in this question: how we can connect our own custom NLU through the API using Rasa 2 and Rasa X. Please explain

Thanks!

I took a deep dive into the Rasa Open Source code base and while I couldn’t find any up to date documentation, it should still be possible to use an external NLU. These are the legacy docs for it which should still work.

This class adds support for external NLU endpoints. To trigger the usage of this class you need an entry like the following in your endpoints.yml:

nlu:
  url: "http://<your nlu host>:<port>"

Note that Rasa Open Source will automatically add /model/parse to the given URL which means that your server needs to respond to requests on http://<your nlu host>:<port>/model/parse.

The request which Rasa sends has the following content:

{
  "token": "<endpoint token>",
  "text": "<message text>",
  "message_id": "<message id>",
}

I created an issue for the missing documentation here.

Regarding Rasa X: Support for this currently a bit fragile but the following should still work:

  1. Start Rasa Open Source with the nlu: endpoint defined in endpoints.yml
  2. Make sure Rasa X does not provide a model containing an NLU model to Rasa Open Source. You can either do so by not uploading a model to Rasa X or having only models in Rasa which were trained using rasa train core. If you train via Rasa X, you should achieve the same behavior as rasa train core by not providing any NLU training data in Rasa X.

Disclaimer

All things aside, I can only strongly recommend to use the integrated NLU in Rasa Open Source. We got a great research team which is continuously working on improvements for NLU and also integrating the dialogue management with the NLU predictions more and more which should lead to more robust decisions by the bot. You can also integrate various pretrained models with Rasa’s integrated NLU to improve the predictions for your language (e.g. you could utilize BERT embeddings) or use custom components to add more information to the prediction (e.g. sentiment analysis).