Many legal departments are going through transformations, using artificial intelligence to perform some tasks that used to be done by lawyers.