Skip to content

Commit

Permalink
rename method for nested workflows to add_workflows (#15596)
Browse files Browse the repository at this point in the history
  • Loading branch information
logan-markewich authored Aug 23, 2024
1 parent 256a637 commit 3a125f6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions llama-index-core/llama_index/core/workflow/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ def add_step(cls, func: Callable) -> None:

cls._step_functions[func.__name__] = func

def add_services(self, **services: "Workflow") -> None:
"""Adds one or more services to this workflow.
def add_workflows(self, **workflows: "Workflow") -> None:
"""Adds one or more nested workflows to this workflow.
This method only accepts keyword arguments, and the name of the parameter
will be used as the name of the service.
will be used as the name of the workflow.
"""
for name, wf in services.items():
for name, wf in workflows.items():
self._service_manager.add(name, wf)

def _get_steps(self) -> Dict[str, Callable]:
Expand Down
2 changes: 1 addition & 1 deletion llama-index-core/tests/workflow/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async def test_e2e():
wf = DummyWorkflow()
# We are responsible for passing the ServiceWorkflow instances to the dummy workflow
# and give it a name, in this case "service_workflow"
wf.add_services(service_workflow=ServiceWorkflow())
wf.add_workflows(service_workflow=ServiceWorkflow())
res = await wf.run()
assert res == 84

Expand Down

0 comments on commit 3a125f6

Please sign in to comment.