uasername commited on
Commit
1de96ad
·
verified ·
1 Parent(s): 680f625

Update unit2/llama-index/workflows.ipynb

Browse files

wrong placement of "| LoopEvent". It should be placed in "step_one": step_one(self, ev: StartEvent | LoopEvent), and NOT in "step_two"! The "step_two" should be without the "| LoopEvent": step_two(self, ev: ProcessingEvent). Why can't you even copy the demo code correctly?! The whole code of Chapter 2 is messed up!

Files changed (1) hide show
  1. unit2/llama-index/workflows.ipynb +2 -2
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 | LoopEvent) -> 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",
 
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",