As tech companies gear up to borrow hundreds of billions of dollars to fuel investments in artificial intelligence, lenders and investors are increasingly looking to protect themselves against it all going wrong.