|
|
|
@ -44,17 +44,47 @@ We have a small gallery of examples to run here, [for more check out the docs to
|
|
|
|
|
- `MultiAgentDebate` is a simple class that enables multi agent collaboration.
|
|
|
|
|
|
|
|
|
|
```python
|
|
|
|
|
from swarms import Worker, MultiAgentDebate, select_speaker
|
|
|
|
|
from swarms.workers import Worker
|
|
|
|
|
from swarms.swarms import MultiAgentDebate, select_speaker
|
|
|
|
|
from langchain.models import OpenAIChat
|
|
|
|
|
|
|
|
|
|
# Initialize agents
|
|
|
|
|
worker1 = Worker(openai_api_key="", ai_name="Optimus Prime")
|
|
|
|
|
worker2 = Worker(openai_api_key="", ai_name="Bumblebee")
|
|
|
|
|
worker3 = Worker(openai_api_key="", ai_name="Megatron")
|
|
|
|
|
llm = OpenAIChat(
|
|
|
|
|
model_name='gpt-4',
|
|
|
|
|
openai_api_key="api-key",
|
|
|
|
|
temperature=0.5
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
node = Worker(
|
|
|
|
|
llm=llm,
|
|
|
|
|
ai_name="Optimus Prime",
|
|
|
|
|
ai_role="Worker in a swarm",
|
|
|
|
|
external_tools = None,
|
|
|
|
|
human_in_the_loop = False,
|
|
|
|
|
temperature = 0.5,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
node2 = Worker(
|
|
|
|
|
llm=llm,
|
|
|
|
|
ai_name="Bumble Bee",
|
|
|
|
|
ai_role="Worker in a swarm",
|
|
|
|
|
external_tools = None,
|
|
|
|
|
human_in_the_loop = False,
|
|
|
|
|
temperature = 0.5,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
node3 = Worker(
|
|
|
|
|
llm=llm,
|
|
|
|
|
ai_name="Bumble Bee",
|
|
|
|
|
ai_role="Worker in a swarm",
|
|
|
|
|
external_tools = None,
|
|
|
|
|
human_in_the_loop = False,
|
|
|
|
|
temperature = 0.5,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
agents = [
|
|
|
|
|
worker1,
|
|
|
|
|
worker2,
|
|
|
|
|
worker3
|
|
|
|
|
node,
|
|
|
|
|
node2,
|
|
|
|
|
node3
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
# Initialize multi-agent debate with the selection function
|
|
|
|
|