Fix "WorkflowRuntimeError: Error in step 'step_two': 'LoopEvent' object has no attribute 'intermediate_result'"
#42
by
delmaass
- opened
unit2/llama-index/workflows.ipynb
CHANGED
@@ -182,7 +182,7 @@
|
|
182 |
"\n",
|
183 |
"class MultiStepWorkflow(Workflow):\n",
|
184 |
" @step\n",
|
185 |
-
" async def step_one(self, ev: StartEvent) -> ProcessingEvent | LoopEvent:\n",
|
186 |
" if random.randint(0, 1) == 0:\n",
|
187 |
" print(\"Bad thing happened\")\n",
|
188 |
" return LoopEvent(loop_output=\"Back to step one.\")\n",
|
@@ -191,7 +191,7 @@
|
|
191 |
" return ProcessingEvent(intermediate_result=\"First step complete.\")\n",
|
192 |
"\n",
|
193 |
" @step\n",
|
194 |
-
" async def step_two(self, ev: ProcessingEvent
|
195 |
" # Use the intermediate result\n",
|
196 |
" final_result = f\"Finished processing: {ev.intermediate_result}\"\n",
|
197 |
" return StopEvent(result=final_result)\n",
|
|
|
182 |
"\n",
|
183 |
"class MultiStepWorkflow(Workflow):\n",
|
184 |
" @step\n",
|
185 |
+
" async def step_one(self, ev: StartEvent | LoopEvent) -> ProcessingEvent | LoopEvent:\n",
|
186 |
" if random.randint(0, 1) == 0:\n",
|
187 |
" print(\"Bad thing happened\")\n",
|
188 |
" return LoopEvent(loop_output=\"Back to step one.\")\n",
|
|
|
191 |
" return ProcessingEvent(intermediate_result=\"First step complete.\")\n",
|
192 |
"\n",
|
193 |
" @step\n",
|
194 |
+
" async def step_two(self, ev: ProcessingEvent) -> StopEvent:\n",
|
195 |
" # Use the intermediate result\n",
|
196 |
" final_result = f\"Finished processing: {ev.intermediate_result}\"\n",
|
197 |
" return StopEvent(result=final_result)\n",
|