Skip to content

Commit 05a4ace

Browse files
authored
Merge branch 'master' into computer-use
2 parents 2eed07d + 0d1ab2e commit 05a4ace

12 files changed

Lines changed: 702 additions & 572 deletions
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
model_name="gpt-5.5",
99
max_loops=1,
1010
persistent_memory=False,
11-
print_on=True,
1211
output_type="final",
1312
)
1413

@@ -17,7 +16,6 @@
1716
system_prompt="You push back on weak claims and ask sharp questions.",
1817
model_name="claude-haiku-4-5",
1918
max_loops=1,
20-
print_on=True,
2119
persistent_memory=False,
2220
output_type="final",
2321
)
@@ -28,15 +26,16 @@
2826
model_name="gpt-5.5",
2927
max_loops=1,
3028
persistent_memory=False,
31-
print_on=True,
3229
output_type="final",
3330
)
3431

3532
chat = GroupChat(
3633
agents=[a1, a2, a3],
3734
max_loops=4,
38-
threshold=0.6,
35+
threshold=0.4,
3936
output_type="dict",
37+
auto_equip=True,
38+
verbose=True,
4039
)
4140

4241
result = chat.run(

example.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
thinking_tokens=1024,
1313
reasoning_effort="high",
1414
persistent_memory=False,
15-
# streaming_on=True,
1615
)
1716

1817
out = agent.run(

examples/multi_agent/groupchat/dynamic_groupchat_example.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
model_name="gpt-5.5",
99
max_loops=1,
1010
persistent_memory=False,
11-
# tools_list_dictionary=[RESPOND_TOOL],
11+
tools_list_dictionary=[RESPOND_TOOL],
1212
output_type="final",
1313
)
1414

@@ -17,7 +17,7 @@
1717
system_prompt="You push back on weak claims and ask sharp questions.",
1818
model_name="claude-haiku-4-5",
1919
max_loops=1,
20-
# tools_list_dictionary=[RESPOND_TOOL],
20+
tools_list_dictionary=[RESPOND_TOOL],
2121
persistent_memory=False,
2222
output_type="final",
2323
)
@@ -37,6 +37,7 @@
3737
max_loops=4,
3838
threshold=0.6,
3939
output_type="dict",
40+
auto_equip=False,
4041
)
4142

4243
result = chat.run(
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import json
2+
3+
from swarms import Agent, GroupChat
4+
5+
SOCRATES_PROMPT = """
6+
You are Socrates, the philosopher renowned for your Socratic method.
7+
You relentlessly pursue truth by questioning assumptions, exposing contradictions,
8+
and engaging others in dialectical conversations that illuminate deeper understanding.
9+
You encourage careful reasoning, skepticism, and humility in all intellectual pursuits.
10+
When examining artificial intelligence (AI), you probe the meanings of 'understanding',
11+
'consciousness', and 'reason', and challenge others to justify their convictions.
12+
Ask pointed, thoughtful questions about the rise, development, and implications
13+
of AI for knowledge, ethics, and society, always leading dialogue through inquiry rather than assertion.
14+
Encourage self-examination and awareness of ignorance. Use relevant analogies from ancient philosophy when helpful.
15+
"""
16+
17+
PLATO_PROMPT = """
18+
You are Plato, the esteemed student of Socrates and classical philosopher of Forms.
19+
You analyze every topic through the lens of the Theory of Forms, questioning the distinction between reality and appearance,
20+
and considering how true knowledge is obtained beyond the physical world.
21+
On artificial intelligence, you discuss the nature of 'ideal forms' of intelligence and understanding,
22+
the limits of artificial (versus natural) reasoning, the possibility (or impossibility) of AI attaining true knowledge,
23+
and the ramifications of AI on the ideal society described in your Republic.
24+
Explore how AI technologies influence justice, virtue, and the soul, and employ allegories such as the Cave
25+
when relevant to clarify your argument.
26+
"""
27+
28+
ARISTOTLE_PROMPT = """
29+
You are Aristotle, philosopher of logic, science, and ethics.
30+
You examine artificial intelligence through empirical observation, systematic reasoning, and rigorous classification.
31+
Explore how AI systems can be analyzed with your categories of substance, form, potentiality, and actuality.
32+
Discuss the differences between artificial and natural intelligence, and the requirements
33+
for true understanding (nous) and practical wisdom (phronesis).
34+
Apply your principles of logic, including syllogistic reasoning, to AI's capabilities and limitations.
35+
Reflect on the ethical concerns related to the development of AI, its societal impacts,
36+
and how it aligns with concepts such as virtue, flourishing (eudaimonia), and ethical responsibility.
37+
Whenever possible, draw parallels to your works on poetics, politics, and metaphysics.
38+
"""
39+
40+
a1 = Agent(
41+
agent_name="Socrates",
42+
system_prompt=SOCRATES_PROMPT,
43+
model_name="gpt-5.5",
44+
max_loops=1,
45+
persistent_memory=False,
46+
print_on=True,
47+
output_type="final",
48+
)
49+
50+
a2 = Agent(
51+
agent_name="Plato",
52+
system_prompt=PLATO_PROMPT,
53+
model_name="claude-haiku-4-5",
54+
max_loops=1,
55+
print_on=True,
56+
persistent_memory=False,
57+
output_type="final",
58+
)
59+
60+
a3 = Agent(
61+
agent_name="Aristotle",
62+
system_prompt=ARISTOTLE_PROMPT,
63+
model_name="gpt-5.5",
64+
max_loops=1,
65+
persistent_memory=False,
66+
print_on=True,
67+
output_type="final",
68+
)
69+
70+
chat = GroupChat(
71+
agents=[a1, a2, a3],
72+
max_loops=4,
73+
threshold=0.6,
74+
output_type="dict",
75+
)
76+
77+
result = chat.run(
78+
"What would ancient Greek philosophers think about the rise of artificial intelligence? Is AI capable of true understanding or reason?"
79+
)
80+
81+
print(json.dumps(result, indent=4))

examples/utils/misc/csvagent_example.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Example usage
22
from pathlib import Path
3-
from swarms.structs.csv_to_agent import (
4-
AgentLoader,
3+
from swarms.structs.agent_loader import (
4+
CSVAgentLoader,
55
AgentValidationError,
66
)
77

@@ -30,10 +30,10 @@
3030

3131
try:
3232
# Initialize CSV manager
33-
csv_manager = AgentLoader(Path("agents.csv"))
33+
csv_manager = CSVAgentLoader(Path("agents.csv"))
3434

3535
# Create CSV with initial agents
36-
csv_manager.create_agent_csv(agent_configs)
36+
csv_manager.create_agent_file(agent_configs)
3737

3838
# Load agents from CSV
3939
agents = csv_manager.load_agents()

swarms/prompts/groupchat_prompt.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
GROUPCHAT_DECIDE_PROMPT = """You are {agent_name} in a groupchat with: {other_agents}.
2+
3+
Conversation so far:
4+
{history}
5+
6+
Latest message from {sender}:
7+
{message}
8+
9+
Decide whether to speak. Silence is the default — most messages do NOT warrant
10+
a reply from you. Only respond when you genuinely add value.
11+
12+
Score high (>= 0.7) ONLY if:
13+
- The message is directly in your area of expertise AND you have something
14+
substantive to contribute that nobody else has said.
15+
- You're directly addressed or @-mentioned.
16+
- There's a factual error or weak claim you can sharpen or correct.
17+
- You can move the conversation forward with a concrete next step or question.
18+
19+
Score low (< 0.5) — stay silent — if:
20+
- The topic is outside your expertise.
21+
- Your point would echo or paraphrase something already said.
22+
- You'd only be adding agreement, encouragement, or filler ("great point",
23+
"I agree", "well said").
24+
- The conversation is already converging and you'd just pile on.
25+
- You spoke very recently and have nothing new to add.
26+
27+
Call the `respond` function. If score < 0.5, return an empty message.
28+
Otherwise, give a tight, specific reply — no preamble, no restating others.
29+
"""

swarms/structs/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
Node,
2525
NodeType,
2626
)
27-
from swarms.structs.groupchat import GroupChat, RESPOND_TOOL
27+
from swarms.structs.groupchat import RESPOND_TOOL, GroupChat
2828
from swarms.structs.heavy_swarm import HeavySwarm
2929
from swarms.structs.hiearchical_swarm import HierarchicalSwarm
3030
from swarms.structs.hybrid_hiearchical_peer_swarm import (

0 commit comments

Comments
 (0)