As governments around the world consider how to regulate AI, the European Union is planning first-of-its-kind legislation that would put strict limits on the technology.