Metadata in message in NLU pipeline component

Hello,

I was wondering if there’s any way to extract a message’s metadata in a NLU pipeline component?

This metadata is inserted in our custom channel handler for Facebook Messenger, but it doesn’t show up in the Message object in the process() method of the Component. Is this intended? Is there an easy way to achieve this?

Adding @nbeuchat, as we work together.

2 Likes

Hi all! Just wanted to add some more context here as I work with @cristianmtr. One thing we want to do is passing some geographic context to the bot so that location entities can be properly disambiguated.

For example, if a user is looking for a place in NYC, we want to be able to differentiate between “Downtown” between NY or other cities so that we get the proper ID for this location. Up until now, we’ve done this mapping in actions so it was easy to use slots for the context. The problem is that we want to extend our location parsing using a custom pipeline component which uses Spacy’s pattern matcher. But we first need our disambiguation before applying the patterns.

That’s why we’re trying to pass some context to the NLU pipeline somehow.

Thanks for your help! Nico

Hi @cristianmtr and @nbeuchat, I have the same problem, did you manage to solve it?

Thanks!

not as of yet unfortunately. we are doing that processing in an action now, where we have access to the metadata

Okay, I created a Feature request based on my use case. @cristianmtr maybe you want to show your support by sharing yours? Make metadata aviable in NLU pipline · Issue #6090 · RasaHQ/rasa · GitHub

Cool! Just did :slight_smile:

1 Like

the default interpreter for Agent seems to be RasaNLUInterpreter. But RasaNLUInterpreter does not pass on the metadata in its parse method. How can I get my metadata inside the process method of my custom components.

@cristianmtr I can see that the issue is resolved. Can anyone please let me know how to access metadata in the custom NLU component?

Did you guys get to know how to access metadata in NLU component?

@rctatman , when I access metadata in nlu pipeline component by using message.get(‘metadata’), its always “None”. Please let me know if it is the correct way of accessing metadata in nlu component.