Smart lithium batteries with AI