Combine a retrieval action with a custom one

Hello everyone,

I’m developing a FAQ Chatbot using RASA. I was using a retrieval action at first following the RASA tutorial, but now I need to use a custom one that will be triggered for any intent provided by the user.

In my custom action, I am trying to get the name of the current intent name, all I can get is “chitchat”, what I’m trying to retrieve is “chitchat/ask_name”. Is there a way to achieve this ?

PS: I am keeping the nlu format of retrieval actions to avoid writing the same story for every intent, since I will be calling the same custom action all the time.

Thank you.

Hi I am currently trying to do the same thing. I would appreciate if anyone can assist us in this. It is interesting that the bot is able to return a response just by writing one story, but I can’t get it to work with custom actions. Am I missing out something important?

Hi @Jason73, can you show me your stories and custom action files ? maybe I can help you.

Hi @forwitai, thanks for reaching out to me! Although I cannot share you the original file, but I tried using the default files generated by “rasa init” but did not managed to get it working. Would appreciate if you can help me on this. Basically, I am trying to make the bot run my custom action and say “hello” no matter what my intent (I’m actually looking more than that: I need to extract the exact intent like faq/greet inside the action)

Thanks!

faq.zip (2.3 KB)

I’ll share with you what I ended up doing.

I discarded the faq method. I kept my training data in the nlu.md file, and gave each question an intent name. In my stories.md, I wrote a story for every intent in my FAQ questions list, and as an answer I put my custom action. For example :

  • firstFAQquestion
    - mycustomaction

You can do the same, and then in your custom action you can return whatever you want. If you want to return a specific answer for each intent like I did, you can retrieve the last intent’s name via :

last_intent=tracker.latest_message[‘intent’].get(‘name’)

Hope it will help !

Thanks for the reply. However I would want to avoid this method since I am expecting to have thousands (or even 10 thousands) questions and I wouldn’t want to write 10k stories and rules (the ability to avoid tons of stories and rules really attracted me). I am planning to have a json file or a database to store intents and corresponding response so that whenever user types something, the action will extract the intent, query database or json to get responses, and return response to user. An advantage of using this method is whenever I want to add questions, I only need to edit the nlu.yml file instead of (nlu + stories + rules + domain)

I will investigate the source code of Action class and see if I can get what I wanted to work. Will update here if I do.

Hi @Jason73, that is exactly what I’m doing. I’m storing my responses in a file with the corresponding intent. After extracting the intent in my custom action, I look for the right answer in the file. But I still had to right a story for every intent in my stories.md file, I couldn’t do it otherwise.