The EU legislation governing artificial intelligence is to come into force later this year. The new rules are expected to serve as a global signpost for other governments racing to regulate the fast-changing technology.