Slot filling "asynchronously"

Hey there, Hey I’ve a question about slot filling… Let’s say my bot is simply triggered by intents from an user without any entities. All the relevant information for the slots would come from a third party software that will periodically (e.g 30sec) send information. Is there a way to update the slot values transparently ? In the mean time, it seems a slot could be update inside an action (I call it synchrone) using SlotSet. I’m looking for other ways to update slots asynchronously. As an example : “What is the weather ?”, where the slot : “location” will be automatically set by a third party app which knows your position and this slot has been set maybe 5 min earlier.

I suggest you make a separate service that manages location and weather data independently of rasa. Make a process that queries the weather api every 30 seconds and stores the weather data in a local sql. When rasa detects the intent it queries the local sql for the latest data and report it to the user. No need to store the data in a slot. Similar to the example with concertbot, where a custom action pulls info from an external API.

1 Like

@asokolow, If the above solution works for you, then perfect, Alternatively you can also update the tracker irrespective of the chat.

take a look here https://core.rasa.com/http.html#endpoints

1 Like

I agree with you, It thought about this too! thank you, we are on the same track

Thank you, I will have a look now :slight_smile: it seems to be a good approach.

Hey there - I’m trying to click on the link you sent, but it looks like it’s been taken down / changed. I’m trying to get additional fields from Twilio metadata to be added to the conversational tracker. Do you know the most efficient way I might do this? Thanks

take a look at the updated link

for the metadata, you can push metadata in the event tracker as slots

Hi @souvikg10 , thanks for your response. In my case, I imagine that I would extract the extra Twilio metadata from the twilio.py channel in the TwilioInput class. However, after that, I don’t know how to pass the metadata internally from the twilio.py channel script as a variable for use in my custom actions (I imagine that I should want to change the slot in an action function in actions.py). Do you know how I can pass a variable I retrieve in twilio.py to the tracker?

@akelad Hi Akela - do you have any tips for building this feature in Rasa? Thanks!

Can anyone walk me through adding an event through event broker? I’m finding that many steps are left out of the documentation.

This is how you would fill a slot using python’s requests library.

data = {"event": "slot", 
            "name": slot_name,
            "value": slot_value}
params = {"include_events": "ALL", "output_channel": "latest", "execute_side_effects": True}
requests.post(f"http://rasa:2002/conversations/{conversation_id}/tracker/events", 
                    params=params, 
                    json=data)