Toyota has unveiled an artificial-intelligence project, dubbed Yui: an onboard virtual assistant that gauges your mood, indulges in personal chitchat and offers to drive if it senses you are sleepy or distracted. Until now, Toyota, the world’s second-largest car maker by vehicle sales, has kept relatively quiet about autonomous vehicles and how it plans to deal with challenges from Silicon Valley upstarts.