Implement multi-stage reasoning in Azure Databricks