Skip to content

Commit

Permalink
fix agentstudio when using non gpt
Browse files Browse the repository at this point in the history
  • Loading branch information
Devashish Tyagi authored and devashishtyagi committed Jan 18, 2024
1 parent 46e76d2 commit 70704d8
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions samples/apps/autogen-studio/autogenstudio/workflowmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ def sanitize_agent_spec(self, agent_spec: AgentFlowSpec) -> AgentFlowSpec:
"""

agent_spec.config.is_termination_msg = agent_spec.config.is_termination_msg or (
lambda x: "TERMINATE" in x.get("content", "").rstrip()
lambda x: x.get("content", "")
and "TERMINATE" in x.get("content", "").rstrip()
)
skills_prompt = ""
if agent_spec.skills:
Expand Down Expand Up @@ -139,10 +140,18 @@ def load(self, agent_spec: AgentFlowSpec) -> autogen.Agent:
agent_spec = self.sanitize_agent_spec(agent_spec)
if agent_spec.type == "assistant":
agent = autogen.AssistantAgent(**asdict(agent_spec.config))
agent.register_reply([autogen.Agent, None], reply_func=self.process_reply, config={"callback": None})
agent.register_reply(
[autogen.Agent, None],
reply_func=self.process_reply,
config={"callback": None},
)
elif agent_spec.type == "userproxy":
agent = autogen.UserProxyAgent(**asdict(agent_spec.config))
agent.register_reply([autogen.Agent, None], reply_func=self.process_reply, config={"callback": None})
agent.register_reply(
[autogen.Agent, None],
reply_func=self.process_reply,
config={"callback": None},
)
else:
raise ValueError(f"Unknown agent type: {agent_spec.type}")
return agent
Expand Down

0 comments on commit 70704d8

Please sign in to comment.