Using Rasa Core with LUIS/DialogFlow (without Rasa NLU)

Hello,

I need to use Rasa Core along with some other NLU service like LUIS or DialogFlow. If I am running Rasa Core as an independent service and wants to use just the Rasa Core functionality to predict the next action. How do I pass the intent and entities received from NLU service to Rasa Core server?

Although the docs mentions that Rasa Core can be used with any NLU service but I am unable to find the way or Rasa Core API endpoint which can be called to achieve this.

Thanks in advance for help!

Anurag

1 Like

I too had difficulty in finding out how to replace Rasa NLU in Rasa Core. After a lot of searching, I found out how: https://rasa.com/docs/core/api/interpreter/

This page of the docs mentions: To use something other than Rasa NLU, you just need to implement a subclass of Interpreter which has a method parse(message) which takes a single string argument and returns a dict in the following format:

{ “text”: “show me chinese restaurants”, “intent”: { “name”: “restaurant_search”, “confidence”: 1.0 } “entities”: [ { “start”: 8, “end”: 15, “value”: “chinese”, “entity”: “cuisine” } ] }

So all you have to do is to create a subclass of Interpreter, call the LUIS/Dialogflow API, and reformat the dictionary keys to match rasa core’s format and return the output.

I think a good idea is to add this knowledge of how to replace rasa nlu in either Quickstart or Rasa NLU docs.

1 Like

You want to replace the use of rasa nlu and need that mentioned in the docs of Rasa NLU?

You have to extend the Interpreter class yourself to accept 3rd party NLU - there is not just LUIS/Dialogflow but many others,

Thanks for your inputs!

I figured out an easy way by just calling the RASA core respond API endpoint with intent and entities fetched from any interpreter processed in another codebase. Here is how I am calling the RASA Core API which works for me -

var options = { method: ‘POST’, url: ‘http://localhost:5005/conversations/default/respond’, headers: { ‘Cache-Control’: ‘no-cache’, ‘Content-Type’: ‘application/json’ }, body: { query: ‘/search_restaurants{“cuisine” : “indian”}’ }, json: true };

3 Likes