Fix "WorkflowRuntimeError: Error in step 'step_two': 'LoopEvent' object has no attribute 'intermediate_result'"
#42
by delmaass - opened
181 unmodified lines1821831841851861871882 unmodified lines191192193194195196197181 unmodified lines"\n","class MultiStepWorkflow(Workflow):\n"," @step\n"," async def step_one(self, ev: StartEvent) -> ProcessingEvent | LoopEvent:\n"," if random.randint(0, 1) == 0:\n"," print(\"Bad thing happened\")\n"," return LoopEvent(loop_output=\"Back to step one.\")\n",2 unmodified lines" return ProcessingEvent(intermediate_result=\"First step complete.\")\n","\n"," @step\n"," async def step_two(self, ev: ProcessingEvent | LoopEvent) -> StopEvent:\n"," # Use the intermediate result\n"," final_result = f\"Finished processing: {ev.intermediate_result}\"\n"," return StopEvent(result=final_result)\n",181 unmodified lines1821831841851861871882 unmodified lines191192193194195196197181 unmodified lines"\n","class MultiStepWorkflow(Workflow):\n"," @step\n"," async def step_one(self, ev: StartEvent | LoopEvent) -> ProcessingEvent | LoopEvent:\n"," if random.randint(0, 1) == 0:\n"," print(\"Bad thing happened\")\n"," return LoopEvent(loop_output=\"Back to step one.\")\n",2 unmodified lines" return ProcessingEvent(intermediate_result=\"First step complete.\")\n","\n"," @step\n"," async def step_two(self, ev: ProcessingEvent) -> StopEvent:\n"," # Use the intermediate result\n"," final_result = f\"Finished processing: {ev.intermediate_result}\"\n"," return StopEvent(result=final_result)\n",
unit2/llama-index/workflows.ipynb+2-2