The US midterm elections are turning into a key source of concern for a stock market that is riding high on the artificial intelligence trade.