Skip to content

Commit e1fc052

Browse files
committed
[Examples][ReasoningAgentRouter]
1 parent 88eaeed commit e1fc052

14 files changed

Lines changed: 163 additions & 1004 deletions

File tree

examples/rag/README.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

examples/rag/qdrant_rag_example.py

Lines changed: 0 additions & 98 deletions
This file was deleted.

examples/reasoning_agents/README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,25 @@
22

33
This directory contains examples demonstrating advanced reasoning capabilities and agent evaluation systems in Swarms.
44

5+
## Reasoning Agent Router Examples
6+
7+
The `reasoning_agent_router_examples/` folder contains simple examples for each agent type supported by the `ReasoningAgentRouter`:
8+
9+
- [reasoning_duo_example.py](reasoning_agent_router_examples/reasoning_duo_example.py) - Reasoning Duo agent for collaborative reasoning
10+
- [self_consistency_example.py](reasoning_agent_router_examples/self_consistency_example.py) - Self-Consistency agent with multiple samples
11+
- [ire_example.py](reasoning_agent_router_examples/ire_example.py) - Iterative Reflective Expansion (IRE) agent
12+
- [agent_judge_example.py](reasoning_agent_router_examples/agent_judge_example.py) - Agent Judge for evaluation and judgment
13+
- [reflexion_agent_example.py](reasoning_agent_router_examples/reflexion_agent_example.py) - Reflexion agent with memory capabilities
14+
- [gkp_agent_example.py](reasoning_agent_router_examples/gkp_agent_example.py) - Generated Knowledge Prompting (GKP) agent
15+
516
## Agent Judge Examples
17+
18+
The `agent_judge_examples/` folder contains detailed examples of the AgentJudge system:
19+
620
- [example1_basic_evaluation.py](agent_judge_examples/example1_basic_evaluation.py) - Basic agent evaluation
721
- [example2_technical_evaluation.py](agent_judge_examples/example2_technical_evaluation.py) - Technical evaluation criteria
822
- [example3_creative_evaluation.py](agent_judge_examples/example3_creative_evaluation.py) - Creative evaluation patterns
923

10-
## O3 Integration
11-
- [example_o3.py](example_o3.py) - O3 model integration example
12-
- [o3_agent.py](o3_agent.py) - O3 agent implementation
24+
## Self-MoA Sequential Examples
25+
26+
- [moa_seq_example.py](moa_seq_example.py) - Self-MoA Sequential reasoning example for complex problem-solving

examples/reasoning_agents/example_o3.py

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from swarms.agents.reasoning_agents import ReasoningAgentRouter
2+
3+
router = ReasoningAgentRouter(
4+
swarm_type="AgentJudge",
5+
model_name="gpt-4o-mini",
6+
max_loops=1,
7+
)
8+
9+
result = router.run("Is Python a good programming language?")
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from swarms.agents.reasoning_agents import ReasoningAgentRouter
2+
3+
router = ReasoningAgentRouter(
4+
swarm_type="GKPAgent",
5+
model_name="gpt-4o-mini",
6+
num_knowledge_items=3,
7+
)
8+
9+
result = router.run("What is artificial intelligence?")
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from swarms.agents.reasoning_agents import ReasoningAgentRouter
2+
3+
router = ReasoningAgentRouter(
4+
swarm_type="ire",
5+
model_name="gpt-4o-mini",
6+
num_samples=1,
7+
)
8+
9+
result = router.run("Explain photosynthesis in one sentence.")
10+
print(result)
11+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from swarms.agents.reasoning_agents import ReasoningAgentRouter
2+
3+
router = ReasoningAgentRouter(
4+
swarm_type="reasoning-duo",
5+
model_name="gpt-4o-mini",
6+
max_loops=1,
7+
)
8+
9+
result = router.run("What is 2+2?")
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from swarms.agents.reasoning_agents import ReasoningAgentRouter
2+
3+
router = ReasoningAgentRouter(
4+
swarm_type="ReflexionAgent",
5+
model_name="gpt-4o-mini",
6+
max_loops=1,
7+
memory_capacity=3,
8+
)
9+
10+
result = router.run("What is machine learning?")
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from swarms.agents.reasoning_agents import ReasoningAgentRouter
2+
3+
router = ReasoningAgentRouter(
4+
swarm_type="self-consistency",
5+
model_name="gpt-4o-mini",
6+
max_loops=1,
7+
num_samples=3,
8+
)
9+
10+
result = router.run("What is the capital of France?")

0 commit comments

Comments
 (0)