Blocking AI Crawler Bots using robots.txt

While I follow the development of AI with a lot of interest, I do not want my work to be used for training these models. I just learned that it's possible to (at least try to) block AI bots from crawling a website using the robots.txt file.