You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
swarms/playground/structs/majority_voting.py

46 lines
1015 B

from swarms import Agent, MajorityVoting, ChromaDB, Anthropic
# Initialize the llm
llm = Anthropic()
# Agents
agent1 = Agent(
10 months ago
llm=llm,
system_prompt=(
"You are the leader of the Progressive Party. What is your"
" stance on healthcare?"
),
agent_name="Progressive Leader",
agent_description="Leader of the Progressive Party",
long_term_memory=ChromaDB(),
max_steps=1,
)
agent2 = Agent(
llm=llm,
agent_name="Conservative Leader",
agent_description="Leader of the Conservative Party",
long_term_memory=ChromaDB(),
max_steps=1,
)
agent3 = Agent(
llm=llm,
agent_name="Libertarian Leader",
agent_description="Leader of the Libertarian Party",
long_term_memory=ChromaDB(),
max_steps=1,
)
# Initialize the majority voting
mv = MajorityVoting(
agents=[agent1, agent2, agent3],
output_parser=llm.majority_voting,
autosave=False,
verbose=True,
)
# Start the majority voting
10 months ago
mv.run("What is your stance on healthcare?")