rasa-nlurasarasa-core

Extracting faq sub-intent from a custom action


I am using the following configuration: Rasa Version : 2.2.9 Rasa SDK Version : 2.2.0 Rasa X Version : None Python Version : 3.7.6 Operating System : Linux-5.4.0-71-generic-x86_64-with-debian-bullseye-sid

I would like to get a faq or chitchat sub-intent (not intent) form a custom action. When I use this command :

tracker.latest_message['intent'].get('name')

I get the intent faq… I would like to get a sub-intent like faq/ask_weather or faq/ask_name instead or even ask_weather or ask name.

Can you help me?


Solution

  • We do this in our demo here:

    full_intent = (
                tracker.latest_message.get("response_selector", {})
                .get("faq", {})
                .get("full_retrieval_intent")
            )
    

    If you're looking for the full intent of a "chitchat" retrieval intent, you'll have to replace "faq" in the above with "chitchat", and so on, for whatever prefix.