Slot data types in Python

Is this true that every slot has type ‘string’ when writing custom actions regardless of its type in domain.yml? I.e. if I create a slot with type ‘float’ it will still be a string in the tracker?

P.S. Is there a slot type ‘int’? Didn’t notice that in the docs.


Welcome to the forum :slight_smile:

No, you don’t have to worry about that. Why would you purposely set the slot to another data type anyway?

Thank you for a quick answer. It seems I didn’t explain myself properly.

The unexpected behaviour I am encountering is following:

I’ve created a slot of type ‘float’ in domain.yml. However, when I get its value from the tracker in, I receive Python type ‘string’.

Ah I understand now :slight_smile:

Yes this is the behavior, you could just do float(tracker.get_slot('my_float_slot')) to transform it as you probably know, but at least you’re sure the conversion can work.

Thank you or the clarification!

Since that is clear, could you please confirm that I am right that there is no int slot type in Rasa?

That’s right! All the slot types are listed here, as well as how to make a custom slot type if you really need int instead of float :slight_smile:

Thanks! :slight_smile: