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

22 lines
441 B

from swarms import Agent, OpenAIChat, MajorityVoting
# Initialize the llm
llm = OpenAIChat()
# Initialize the agents
agent1 = Agent(llm=llm, max_loops=1)
agent2 = Agent(llm=llm, max_loops=1)
agent3 = Agent(llm=llm, max_loops=1)
# Initialize the majority voting
mv = MajorityVoting(
agents=[agent1, agent2, agent3],
concurrent=True,
multithreaded=True,
)
# Start the majority voting
mv.run("What is the capital of France?")