I need you to improve the performance of code-related functions, particularly when working with models that perform reasoning in o1. Additionally, please reformat the code blocks to make them easily copyable and ready for use.