I want a bot to make charts?

I want a bot to make charts{not images} fetching the data from database? can anyone help me with code snippets

Can you elaborate? In case you want to use the utterances template check (It allows for a custom payload) here: Domains

If you mean in a custom action, you could use one of the methods defined in the dispatcher class: rasa-sdk/executor.py at master · RasaHQ/rasa-sdk · GitHub

Actually i want the bot to automatically fetch data from the database and if user asks for show charts the bot should understand and make a chart from the input which he has got.

1 Like

Just add something to your custom action server which pulls data automatically from the database. After that create a custom action linked to your intent that processes the user question and sends the chart back to your frontend (in a format it understands)

@Mappi I am sorry but is there any chance you have an example code which i can implement. I am a beginner to Rasa

What kind of example code? I don’t know what your chart data looks like nor the database you are using. Additionally, I don’t know in what way your bot should understand the message.

1 Like

I wanted a bot which can generate charts from the input passed like : Show me the sales for current year in charts? and the bot should generate a chart[not image] fetching data from the ‘amazon web service’ database and the values will be in tabular format. Is it possible ? if yes can u provide me relevant documents.

Like I stated before, it should be possible, but you would need to implement it yourself. Its very specific to your use case.

The relevant documents to fetch data from AWS and mapping them to a tabular format (if they aren’t already) is not something related to Rasa. You’ll have to research that yourself.

I have a similar requirement did you mange to get it done

@Sahil_More - Were you able to create charts graphs ? I also need to implement this requirement and struggling.

I got the solution!! The solution has been documented by @JiteshGaikwad itself in the project. Today only, i noticed he has explained this in his project docs folder → docs/responses.md.

add following lines in actions.py file and then you can create chart dynamically

sick = 20 casual = 10 earned = 24 flexi = 2

data={ “title”: “Leaves”, “labels”: [ “Sick Leave”, “Casual Leave”, “Earned Leave”, “Flexi Leave” ], “backgroundColor”: [ “#36a2eb”, “#ffcd56”, “#ff6384”, “#009688”, “#c45850” ], “chartsData”: [ sick, casual, earned, flexi ], “chartType”: “pie”, “displayLegend”: “true” }

message={ “payload”: “chart”, “data”: data }

dispatcher.utter_message(text=“Here are your leave balance details”,json_message=message)

Note - I have used JiteshGaikwad’s chat widget, avalable at

3 Likes

Hi @analyticalgagan @JiteshGaikwad ,

I want to implement the charts in the webchat and in react. Can we get some pointer?

Thanks & Regards, Abhi