nlu:
-
intent: secured_isolated
examples: - text: | secured or isolated bay & purpose metadata: ask: secure_bay_purpose
I need to access this metadata “ask” in custom action. How do I do that?
nlu:
intent: secured_isolated
examples:
- text: |
secured or isolated bay & purpose
metadata:
ask: secure_bay_purpose
I need to access this metadata “ask” in custom action. How do I do that?
Hey @AnkitChouhan
I think you intention was to read the metadata in your action python. If yes, here is some sample code which you can refer…
> class ActionSearchResult(Action): > def name(self): > return "action_result" > > def run(self, dispatcher, tracker, domain): > item = tracker.get_slot('item') > item = item.lower() > > > if item =="book": > dispatcher.utter_message("Hello from books...!") > elif item =="course": > dispatcher.utter_message("Hello from courses...!") > elif item =="skill": > dispatcher.utter_message("Hello From Skills...")
Further, you have to register the entity like, from the above code the entity is “item” in your domain.yml
> entities:
> - item
> slots:
> item:
> type: text
> influence_conversation: true
Also, you have to pass these entities from the nlu intents.
- intent: ask_query
examples: |
- i'm looking for important [books](item:book) in machine learning
- [ML Books](item:book)
- [ML Courses](item:course)
- [Machine Learning Courses](item:course)
- [ML Skills](item:skill)
and map the corresponding slots in your stories. Thanks
stories:
story: happy path1 steps:
story: happy path2 steps:
story: happy path3 steps:
Best Regards, Ravi
Thanks for the quick reply. But I wanted to fetch the metadata not the entities(or slots) from user messages.
. This is the screenshot from rasa documentation, I want to implement such kind of feature and fetch “sentiment”:“neutral” (according to the screenshot) in my custom actions.py file@AnkitChouhan Did find solution?