# Create a custom slot that stores custom Python object

**URL:** <https://forum.rasa.com/t/create-a-custom-slot-that-stores-custom-python-object/58142>\
**Category:** Getting Started with Rasa\
**Created:** [April 28, 2023, 4:34pm UTC](https://forum.rasa.com/t/create-a-custom-slot-that-stores-custom-python-object/58142 "2023-04-28T16:34:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ScienceGuy](https://avatars.discourse-cdn.com/v4/letter/s/ecccb3/32.png) [@ScienceGuy](https://forum.rasa.com/u/ScienceGuy)\
**Post date:** [April 28, 2023, 4:34pm UTC](https://forum.rasa.com/t/create-a-custom-slot-that-stores-custom-python-object/58142/1 "2023-04-28T16:34:10Z")

</div>

Hi, how could I store a custom Python object in a custom slot?

I though it would be possible following the example here: [https://rasa.com/docs/rasa/domain#custom-slot-types](https://rasa.com/docs/rasa/domain#custom-slot-types)

When I try to train the model, Rasa raises a Type error:

```auto
TypeError: Can't instantiate abstract class MySlot with abstract methods _as_feature, type_name

```

Any idea why this could happen? Is it even possible what I want to do?

---

<div class="post-metadata">

**Author:** ![ScienceGuy](https://avatars.discourse-cdn.com/v4/letter/s/ecccb3/32.png) [@ScienceGuy](https://forum.rasa.com/u/ScienceGuy)\
**Post date:** [April 28, 2023, 4:47pm UTC](https://forum.rasa.com/t/create-a-custom-slot-that-stores-custom-python-object/58142/2 "2023-04-28T16:47:03Z")

</div>

After using ChatGPT I found out that one method is missing in the documentation and one has a typo (it seems). I think the example in the docu has to be like this (added missing method + added missing “\_”):

```auto
from rasa.shared.core.slots import Slot

class NumberOfPeopleSlot(Slot):

    def type_name(self):
        return "NumberOfPeopleSlot"

    def feature_dimensionality(self):
        return 2

    def _as_feature(self):
        r = [0.0] * self.feature_dimensionality()
        if self.value:
            if self.value <= 6:
                r[0] = 1.0
            else:
                r[1] = 1.0
        return r

```
