Is it a problem with Botpress being unstable or with steps used to integrate RASA?


#1

Hello guys!! I am new to Botpress.
I am working with botpress v11.0.4 and v11.3.0
I tried linking RASA nlu with both these versions (I referred Botpress and Rasa NLU for help) but I am unable to create entities because ‘entity-type’ shows not a single thing in its dropdown.

To create entities, have I to include any file from RASA documentation that contains pre-defined entities in order to integrate RASA ?
Or, is it that I am using an unstable version of Botpress ?`


#2

Did you have a look at the documentation? It seems the approach has changed for external NLU integration.

Goto the end of the page. Also refer below link for an example:


#3

I tried to integrate RASA with latest botpress but getting below issue:

Added this as the middlware:

/**

  • This is an example of how to use Recast NLU instead of Botpress NLU
  • To enable this, remove the ‘dot’ before the name of this file
    */

const axios = require(‘axios’)

const eventTypes = [‘text’] // Process only ‘text’ events

async function rasaExtract() {
if (eventTypes.includes(event.type)) {
const { data } = await axios.post(
http://rasaserver:5000/parse’,
{ q: event.preview }
)

if (data) {
  /** TODO Here you will need to manipulate the format of these objects
   * so that they use the same format as Botpress NLU */
  event.nlu = event.nlu || {}
  event.nlu.intents = data.intent_ranking
  event.nlu.entities = data.entities
  //event.nlu.language = data.results.language
  //event.nlu.sentiment = data.results.sentiment
  // Disable Native NLU
  event.setFlag(bp.IO.WellKnownFlags.SKIP_NATIVE_NLU, true)
}

}
}

return rasaExtract()


How to integrate Rasa NLU with Botpress v11.4.2?
#4

Looks almost right, I just think you need to make sure event.nlu.intent.name is always defined, whatever happened with RASA.


#5

@sylvain I believe that botpress is internally looping through the array response from RASA and extracting the name property.
or
Should i extract the top intent from RASA response and set it in middleware?


#6

I’m also dealing the same error, did you solve that problem.


#7

Yes, you should make RASA a before_incoming hook and always set the event.nlu.intent.name to be not undefined. If there’s no intent detected, make intent = { name: 'none', confidence: 1.0 }.

I realize now that there’s an issue with our Recast snippet… If you can get it working with RASA, could you make a pull request for the others?! That would be awesome :slight_smile:


#8

@sylvain Got the intent stuff working. Appreciate your support. I will raise the PR soon but below is the code for getting intent to work.

const axios = require('axios')

const eventTypes = ['text'] // Process only 'text' events

async function rasaExtract() {
  if (eventTypes.includes(event.type)) {
    const { data } = await axios.post(
      'http://rasahostserver:5000/parse',
      { q: event.preview }
        )
    if (data) {
      /** TODO Here you will need to manipulate the format of these objects
       * so that they use the same format as Botpress NLU */
      event.nlu = event.nlu || {}
      //event.nlu.intents = data.intent_ranking;
      event.nlu.intent = {};
      if(data.intent.name)
        event.nlu.intent.name = data.intent.name;
      else
        event.nlu.intent.name = 'none';
      //event.nlu.entities = data.entities
      //event.nlu.language = data.results.language
      //event.nlu.sentiment = data.results.sentiment
      // Disable Native NLU
      event.setFlag(bp.IO.WellKnownFlags.SKIP_NATIVE_NLU, true)
    }
  }
}

return rasaExtract()

404 response when integrate with rasa NLU