Intercepting RASA bot output and modifying it

I am writing to seek assistance with intercepting and modifying the RASA bot output in my chatbot project.

I am currently stuck at the CollectingDispatcher method and I’m having difficulty finding a solution to my problem. I want to be able to intercept the output generated by the RASA bot, modify it with my own code, and then send the modified output to the user.

I have searched for solutions online, but none seem to be promising. I would greatly appreciate it if anybody could provide me with any guidance or resources that could help me resolve this issue.

Why do you want to do this? Have you considered the NLG endpoint.

I want to do this in order to translate the answer. NLG endpoint wouldn`t work because I need the original RASA output.

Ok, then I would copy our example NLG project which will get you the Rasa output here.

Thank you for the response. Does that mean that the only way to access the RASA`s output is by running an NLG server?

There are other approaches:

  • You could also customize the channel that you are using (capture and modify the results there).
  • Another option is to put a proxy in front of the Rasa channel and do the translation in your proxy. Some users create a proxy for other reasons (security, DDOS attacks, load balancer, protocol translation).
  • Event broker (probably not a good choice for your use case)

Thank you for your ideas! I followed the instructions provided in Custom Connectors to create a custom channel. However, I’m unsure where to define the connector and utilize it to handle RASA outputs.

Suppose I have a function named which utilizes the OutputChannel class. Where can I specify that RASA should use this particular file as an output processor?

Simply adding a blank entry (since I dont need a credentials for my custom processor) in credentials.yml like this

custom_channel.OutputTranslator: {}

isn`t enough right?