Skip to content

Commit e8e6905

Browse files
feat: save context in runtime
1 parent c30a320 commit e8e6905

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

  • packages/uipath-llamaindex/src/uipath_llamaindex/runtime

packages/uipath-llamaindex/src/uipath_llamaindex/runtime/runtime.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,7 @@ async def _run_workflow(
143143
workflow_input = UiPathChatMessagesMapper.map_input(input or {})
144144
is_resuming = bool(options and options.resume)
145145

146-
if is_resuming:
147-
self._context = await self._load_context()
148-
else:
149-
self._context = Context(self.workflow)
146+
self._context = await self._load_context()
150147

151148
# Make the Context discoverable from inside steps
152149
if self.debug_mode and self._context is not None:
@@ -241,7 +238,9 @@ async def _run_workflow(
241238
else:
242239
yield self._create_suspended_result(suspended_event)
243240
else:
244-
yield self._create_success_result(await handler)
241+
final_result = await handler
242+
await self._save_context()
243+
yield self._create_success_result(final_result)
245244

246245
async def get_schema(self) -> UiPathRuntimeSchema:
247246
"""Get schema for this LlamaIndex runtime."""

0 commit comments

Comments
 (0)