Quantum Bianchi identities and characteristic classes via DG categories