Hi! I’m trying to develop a chatbot where for a particular user intent, a custom action would run a data science script. And then the graph that was produced in that script needs to be shown to the user as an Image.
As I am very new, I was wondering how should I structure/connect my data science application to a particular custom action class, and importantly how to pass on the result graph as an image to the end user. Thank you
You can import the script like you would import any other module in the actions.py file and then call that script from inside your custom action.
For showing the image, it depends on what frontend you are using. In case if you are using rasa-webchat, you can send the image to the frontend by using the image parameter of the utter_message method. You can pass the link of the image to this method.
Hi Saurav, thanks for the response. So should I have the script in different python file and import it separately or have it inside the Action class? As the image which I want to send to the end user is the final output of that script, I won’t have its link. Is there a way this is possible?
I think it would be better if you keep your script separate and just import it in your actions.
For the image part, you can take the output image and host the image on your server and then provide its link. I personally prefer to use nginx to server static content.