How can I extract data from a CSV file into my RASA chatbot?

I am developing a RASA chatbot, and I want to have a table (csv file) with fields like : book, year, points, author. How can I extract the data from that CSV file into my RASA chatbot? For example if I ask the chatbot: In what year Percy Jackson and The Lightning Thief was published? Answer: 2006 (answer provided from the CSV file) or Who’s the author of the Intelligent Investor book? Answer: Benjamin Graham (also from my CSV file) or How many points does [that book] have? Answer: 100 points (from CSV)

How can I implement something like this ?

Hello @Razvan and welcome to the forum!

Try implementing this using a form and a custom action. The form allows you to fill all the necessary slots (book, year, points, and author) inveractively with the user, and the custom action allow you to load and query the csv file using the filled slots. Custom actions are implemented using python, so you can use pandas to load the csv as a dataframe and query it.

Here are some references:

I hope this helps.

Aciel

@Razvan Heya! Are you able to solve this?

Yup, i figured it out

1 Like

Hi, Can you please help me with how you defined the custom action to read & extract data from the CSV?