Best practices for refining complex search queries and handling multi-step reasoning outputs