removed is_last parameter which messed up sequential workflow

master
Kye Gomez 2 days ago
parent 3c0298fe3e
commit c7c1ea16f5

@ -1,7 +1,7 @@
from swarms import Agent, SequentialWorkflow from swarms import Agent, SequentialWorkflow
import litellm # import litellm
litellm._turn_on_debug() # litellm._turn_on_debug()
# Initialize market research agent # Initialize market research agent
@ -16,6 +16,7 @@ market_researcher = Agent(
model_name="claude-3-sonnet-20240229", model_name="claude-3-sonnet-20240229",
max_loops=1, max_loops=1,
temperature=0.7, temperature=0.7,
streaming_on=True,
) )
# Initialize financial analyst agent # Initialize financial analyst agent
@ -29,6 +30,7 @@ financial_analyst = Agent(
5. Recommending financial strategies""", 5. Recommending financial strategies""",
model_name="claude-3-sonnet-20240229", model_name="claude-3-sonnet-20240229",
max_loops=1, max_loops=1,
streaming_on=True,
temperature=0.7, temperature=0.7,
) )
@ -44,6 +46,7 @@ technical_analyst = Agent(
model_name="claude-3-sonnet-20240229", model_name="claude-3-sonnet-20240229",
max_loops=1, max_loops=1,
temperature=0.7, temperature=0.7,
streaming_on=True,
) )
# Create list of agents # Create list of agents

@ -2528,6 +2528,10 @@ class Agent:
ValueError: If task is empty. ValueError: If task is empty.
""" """
# Filter out is_last from kwargs if present
if 'is_last' in kwargs:
del kwargs['is_last']
try: try:
# Set streaming parameter in LLM if streaming is enabled # Set streaming parameter in LLM if streaming is enabled
if self.streaming_on and hasattr(self.llm, "stream"): if self.streaming_on and hasattr(self.llm, "stream"):

@ -281,7 +281,6 @@ class AgentRearrange(BaseSwarm):
) )
for task_idx, task in enumerate(tasks): for task_idx, task in enumerate(tasks):
is_last = task == tasks[-1]
agent_names = [ agent_names = [
name.strip() for name in task.split(",") name.strip() for name in task.split(",")
] ]
@ -297,7 +296,6 @@ class AgentRearrange(BaseSwarm):
result = agent.run( result = agent.run(
task=self.conversation.get_str(), task=self.conversation.get_str(),
img=img, img=img,
is_last=is_last,
*args, *args,
**kwargs, **kwargs,
) )
@ -326,7 +324,6 @@ class AgentRearrange(BaseSwarm):
current_task = agent.run( current_task = agent.run(
task=self.conversation.get_str(), task=self.conversation.get_str(),
img=img, img=img,
is_last=is_last,
*args, *args,
**kwargs, **kwargs,
) )

Loading…
Cancel
Save