Changing user message before feeding it to RASA NLU

I need to implement a translation service for translating user message before feeding the translated message to RASA NLU. I have written the service script, and it intercepts the message too and translates it, but RASA NLU always takes the original message for intent classification. I have configured the service in the first step of my config pipeline. Can anyone help me with this?

Can anyone help me with this issue?

Hello Abhishek,

Could you provide some more information about your setup and issue:

  • what version of rasa are you running ?
  • Do you get a specific error or warning?
  • Can you share your pipeline in your config.yml file and maybe your custom_component.py file ?
  • Make sure to check also these resources Custom Components docs, Enhance NLU models with Custom Components and this ticket where you see how the output is stored currently.

To answer all of your questions

  1. I am using RASA version 2.2.5
  2. I don’t get any error, it is just that that custom component edits the user message, but the old message goes forward in the pipeline
  3. config.yml

  1. MessageEditor.py

Hello Abhishek,

Maybe you could try using message.set instead of message.text?

Hi tiny_imod, I tried “message.set” and it works to overwrite the message. The problem I got is that when, in a form, you try to “validate” the entities with a (FormValidationAction), in the “value” you still have the original text. Not sure if that should be that way.