I am new to RASA and trying out few things. I am trying to fetch some details from an external local JSON file which is a success. Now I am storing it in a list and I want to return the elements of those list in individual actions. The problem is that it is not a Slot as it is not received by the user, but a hard value. I have to set it to my dipatcher.utter_message and show the value. The code for the custom action is something like this:
Also, I tried giving the value to template, but it didn’t worked. I get a strong feeling that I am doing some silly mistake, but this will be a life long learning.
Any help is appreciated.
Hey @mishra-atul5001, welcome to the community .
You can send the json message using the json_message
attribute of the utter_message:
dispatcher.utter_message(text = 'Ok: ',json_messgae=hot_count)
Reference:
Hi, actually I was not trying to send I, but just print it and luckily it worked with dispatcher.utter_message("We are processing it! {}".format(hot_count))
. At this moment, it does the Job. Now can you help me if I have different values of Entity, in this case, I have Clusters like Hot/Warm/Cold. In this scenario, I want to capture the cluster name by User and then match to my list and return the specific value regarding to it. I know if-else would work, but I want to understand, how the multiple values of entity can be played with and capturing the entity value from conversation and putting it in my custom action and then as I have just learned, return the value.
This is just an enhancement to the above question. And I appreciate your quick response @JiteshGaikwad:v:t2:
Hi All,
I got I fixed. Solution was to catch the slot, use it as a string and do a normal comparison and run the action server each time when there is any change made in the actions.py!
Loving RASA!