Peaks of each chemical is unique so you can scan database of known chemicals and compare.
You can even measure the amounts of various chemicals in solution, but that would require complex calibration. In this case you are basically writing ML system that is trying to fit various peak heights/areas to amount of compound.