How to get all slot values in one go

Can someone tell how i can access all slot values in one go i mean if i have 3 slots name x,y and z then how can i access all of simultaneously?

A custom action will have access to a tracker. This tracker contains entities, intents but also slots.

I’ve got an example of a tracker being used to fetch the entities in the current utterance here.

Hey Vincent, @koaning

I see in your example you use the latest message. And I also understand how tracker contains all of the message from the beginning of a session, like history of all user inputs. Similarly can we see the slots saved for each message during a single session of the conversation? for example how we can get all the previous messages by saying trigger.events[i][‘text’]…is there anything similar for slots?

Thanks

What’s the end goal you’ve got? Do you want to have the history of slot values for labelling purposes (in which case; check out Rasa X :slight_smile:) or is there another end-goal?

So what I am basically trying to do is write an action function that pings a huggingface model and gets emotions for the user inputs. I want these meta data to be stored just like user message history. Now that I have emotions attached to each message I want to use it for multiple use cases. Such as I have my own database with what to respond according to the emotion for past n messages etc… Its a specific use case i’m trying to handle… I have also tried Rasa X and isn’t that just a host-able platform of the same action Docker i’m running ‘rasa run actions’? Looking forward to hearing from you. @koaning … let me know if you need anything in specific. Also what are your thoughts on maintaining a global dictionary with session codes as keys for my use case?

Ah. So … in that case … I’d like to contribute a few fair warnings. Many of the sentiment/emotion models on huggingface are trained on datasets that have bad labels and they have also been shown to have bias. Whatever you intend to use these models for, you shouldn’t assume they are perfect. I also wouldn’t underestimate the extra compute power required to run these huggingface models.

You’re correct in pointing out that Rasa X needs to run as a separate service. The custom actions are an independent container so that you can scale actions horizontally without needing to scale the other services.

There are a few things you could do though.

  1. In your custom action you could trigger a specific action if a very bad sentiment is detected. If you’d like to respond with “don’t swear” this is a path worth taking.
  2. You could also use a custom action to set a slot if there’s a negative sentiment. Your other custom actions could read this slot to respond appropriately.

How would you like your conversation to go different based on the huggingface output?

I see! @koaning Thanks for sharing these, will look deeper before I take the final call. And with the compute power I understand and have already ran into that issue when I tried to run it on my shell “rasa shell”. But on the github I saw one of the engineer mention that it doesn’t happen on Rasa X.

So right now this is what I am doing,

  1. I have an action function that basically does a bunch of checks before sending out the response. For example runs a bunch of checks on tracker.latest_message[‘text’].
  2. Now based on those checks I have my own database with specific responses that I would append along with my response. For example, “I hope you feel better. (please don’t swear)”. Consider (please don’t swear) to be a specific message I am appending based on the emotion. I would also use that to control the conversation.

Since i’m not just looking at the current emotion but also the history of emotions tagged to each message from the user, it’s important in my use case to have the meta data history stored.

I’m wondering, it may make sense to think of a “moving-average” sentiment then. That way you may be able to track if sentiment goes up/down during the conversation.

Thats an excellent Idea! But In my use case I have more than just two sentiment. It’s a multi classifier. Also to even average it into two big buckets as positive and negative how do you suggest I maintain the mapping file?

Example: 
You: Hello (positive)
Bot: How are you?
You: Good and but my pet is sick (negative)

user_message_slots = 
{ "1":  {"message": "Hello", "emotion": "positive"}, 
  "2": {"message": "Good and but my pet is sick", "emotion": "negative"}
}

I was hoping to do something like this with conversation ID as a key. But if you think of a better way or if I can retrieve the slots from RASA inbuilt functions. Please suggest

Thanks @koaning