Thought Purity: A Defense Framework For Chain-of-Thought Attack