I want to return to the user a table-like response. This line print(conferences_df) does nothing. And if uncomment the above lines I am getting a dictionary attribute error.
I would like to ask if I am approaching in the right way the problem of returning a table-like response and if yes what should I correct to this code?
Can you show what you mean by “table-like response”?
If you want to display a table, you will have to implement that in your front-end application.
Or, alternatively, you can convert this table as an image in the Custom Action, and then show that image to the user with dispatcher.utter_message(image = image_path).
print(message) will print the message in the terminal where you ran rasa run actions. If you want to show text to the user, you need dispatcher.utter_message(text = text).
So you want to display a table with the | characters, not an HTML table (for example). I’m sure there’s a code somewhere on GitHub or StackOverflow to convert a dictionary to an ASCII table
A follow up question would be once we have the ASCII table can we use dispatcher.utter_message to send/display the table response? and what option would we use in this case to render the table response, would it be attachment, text etc?
Great thanks for the prompt response. We are using Slack as the application, guess this (referring to the fonts settings) will NOT be something we will control from the rasa perspective and something we would need to figure out with slack
You’re not gonna be able to display an ASCII table if the font isn’t monospace. That means you can’t display it with the regular Slack font, but you can use Markdown formatting in Slack, as you can here on the forum.
Markdown lets you make use of backticks to turn a text into a code block - which has a monospace font
```
like this
```
If you don’t care about being able to copy the table contents, maybe you can build a JSON (dictionary) instead, and pass it to an API that converts it to an image, then display the image (or send the link to it).