Where to store outputs of custom NLU components

Hi, new to Rasa here. I’ve been following the tutorials for building a SentimentAnalyzer custom NLU component and I noticed that the sentiment prediction is appended to the “entities” variable of the Message class, e.g. message.set("entities", [entity], add_to_output=True).

I was wondering whether this is an absolute requirement for any custom predictions to work? It seems counterintuitive to have non-entities like a sentiment alongside actual entities like names, locations, etc. I would prefer the outputs of custom components in their own objects. Is that possible? For example:

{
  "intent": {
    "name": "foo",
    "confidence": 0.1234567890
  },
  "entities": [],
  "sentiment": [
    {
      "value": "NEUTRAL",
      "score": 0.123,
      "confidence": 0.897
    }
  ],
}
1 Like

Hey @jsgiraldo thanks for raising this, that’s a really good point. I’ve opened a github issue here and we’re gonna look into it in the next few weeks

2 Likes

hey @jsgiraldo

I’ve commented in the GH issue, feel free to join the discussion!

1 Like