Fix DeprecationWarning: Context.set(key, value) is deprecated. Use 'await ctx.store.set(key, value)' instead (#106)
Browse files- Fix DeprecationWarning: Context.set(key, value) is deprecated. Use 'await ctx.store.set(key, value)' instead (34a498119def599dd145cf53317ab8dbf86cd8a7)
Co-authored-by: Oriel Swisa <Oriel@users.noreply.huggingface.co>
unit2/llama-index/workflows.ipynb
CHANGED
@@ -290,13 +290,13 @@
|
|
290 |
" @step\n",
|
291 |
" async def step_one(self, ev: StartEvent, ctx: Context) -> ProcessingEvent:\n",
|
292 |
" # Process initial data\n",
|
293 |
-
" await ctx.set(\"query\", \"What is the capital of France?\")\n",
|
294 |
" return ProcessingEvent(intermediate_result=\"Step 1 complete\")\n",
|
295 |
"\n",
|
296 |
" @step\n",
|
297 |
" async def step_two(self, ev: ProcessingEvent, ctx: Context) -> StopEvent:\n",
|
298 |
" # Use the intermediate result\n",
|
299 |
-
" query = await ctx.get(\"query\")\n",
|
300 |
" print(f\"Query: {query}\")\n",
|
301 |
" final_result = f\"Finished processing: {ev.intermediate_result}\"\n",
|
302 |
" return StopEvent(result=final_result)\n",
|
|
|
290 |
" @step\n",
|
291 |
" async def step_one(self, ev: StartEvent, ctx: Context) -> ProcessingEvent:\n",
|
292 |
" # Process initial data\n",
|
293 |
+
" await ctx.store.set(\"query\", \"What is the capital of France?\")\n",
|
294 |
" return ProcessingEvent(intermediate_result=\"Step 1 complete\")\n",
|
295 |
"\n",
|
296 |
" @step\n",
|
297 |
" async def step_two(self, ev: ProcessingEvent, ctx: Context) -> StopEvent:\n",
|
298 |
" # Use the intermediate result\n",
|
299 |
+
" query = await ctx.store.get(\"query\")\n",
|
300 |
" print(f\"Query: {query}\")\n",
|
301 |
" final_result = f\"Finished processing: {ev.intermediate_result}\"\n",
|
302 |
" return StopEvent(result=final_result)\n",
|