Artificial intelligence has been a significant driver of the stock market over the past three years.