FormValidationAction method header produces NameError

I am trying to define custom slot mappings by writing a FormValidationAction (as described in the docs here: However, when I run rasa actions I get NameError: name 'Optional' is not defined. I simply copied and edited the code snippet from the docs, so I don’t see why I should be getting this error. But what is even more confusing to me is that removing the function annotations don’t fix the problem — instead I get syntax errors. Function annotations are purely optional in Python, and that’s what I understand this method header to be. But there is clearly something more going on that I’m not understanding. I’ve attached the full error message as well as my file. (5.7 KB)

Add the below statement at the beginning of your actions file.

from typing import Optional