[FEAT][SequentialWorkflow]

pull/233/head
Kye 1 year ago
parent a47f3a724d
commit 6e42d5424d

@ -27,21 +27,17 @@ agent2 = Agent(llm=llm, max_loops=1)
# Create another agent for a different task # Create another agent for a different task
agent3 = Agent(llm=llm, max_loops=1) agent3 = Agent(llm=llm, max_loops=1)
# agent4 = Agent(llm=anthropic, max_loops="auto")
# Create the workflow # Create the workflow
workflow = SequentialWorkflow(max_loops=1) workflow = SequentialWorkflow(max_loops=1)
# Add tasks to the workflow # Add tasks to the workflow
workflow.add( workflow.add(
"Generate a 10,000 word blog on health and wellness.", agent1 agent1, "Generate a 10,000 word blog on health and wellness.",
) )
# Suppose the next task takes the output of the first task as input # Suppose the next task takes the output of the first task as input
workflow.add("Summarize the generated blog", agent2)
workflow.add( workflow.add(
"Create a references sheet of materials for the curriculm", agent3 agent2, "Summarize the generated blog",
) )
# Run the workflow # Run the workflow

@ -133,7 +133,6 @@ class SequentialWorkflow:
self, self,
agent: Union[Callable, Agent], agent: Union[Callable, Agent],
task: Optional[str] = None, task: Optional[str] = None,
img: Optional[str] = None,
*args, *args,
**kwargs, **kwargs,
) -> None: ) -> None:
@ -143,7 +142,6 @@ class SequentialWorkflow:
Args: Args:
agent (Union[Callable, Agent]): The model or agent to execute the task. agent (Union[Callable, Agent]): The model or agent to execute the task.
task (str): The task description or the initial input for the Agent. task (str): The task description or the initial input for the Agent.
img (str): The image to understand for the task.
*args: Additional arguments to pass to the task execution. *args: Additional arguments to pass to the task execution.
**kwargs: Additional keyword arguments to pass to the task execution. **kwargs: Additional keyword arguments to pass to the task execution.
""" """
@ -154,16 +152,6 @@ class SequentialWorkflow:
) )
# Append the task to the tasks list # Append the task to the tasks list
if img:
self.tasks.append(
Task(
description=task,
agent=agent,
args=list(args),
kwargs=kwargs,
)
)
else:
self.tasks.append( self.tasks.append(
Task( Task(
description=task, description=task,

Loading…
Cancel
Save