Slot of type List only takes one element

Hello, I am filling a List Slot from a custom action but the slot is only storing one element.

Here are my slots in the Domain File:

 entities:
  - event
  - date

  slots:
  event:
    type: unfeaturized
  date:
    type: unfeaturized
  matching_events:
    type: list
  username:
    type: unfeaturized
    initial_value: "human"

What does your custom action look like?

I solved the issue. Please delete this post.

HI Leonardo,Akela

Could you please let me know how you access elements from list slot? For example my custom action returns a list with 2 elements - [5,0] or [5,1] or [5,-1]. First element of the list is a value and send element tells me where it is equal to (0) , or greater than (1) or less than (-1) a certain threshold. If I do slot{l"listname":“listvalue”} I check the entire list, but what is I want to check only for second element of the list?

Thank you, Shruti

Hello, I am assuming you want to access the element from python code.

For this task, you can use the tracker.get_slot() method which returns the value of the slot.

In your case you would do something like:

list = tracker.get_slot("listName") #Returns the list in the slot "listName"
secondElement = list[1] #using the python indexing syntax

Hope that helps!

1 Like

Thanks Leonardo, that was helpful!

1 Like

hey guys Thanks for sharing.I found a lot of interesting information here. A really good post, very thankful and hopeful that you will write many more posts like this one. with regards mile smith shareit UC browser MX player

1 Like