From fce6e36691c6678de8bc26030265ac0f507b4715 Mon Sep 17 00:00:00 2001 From: Pavan Kumar <66913595+ascender1729@users.noreply.github.com> Date: Wed, 18 Jun 2025 22:16:13 +0530 Subject: [PATCH 1/2] Add ReasoningDuo batch example --- docs/swarms/agents/reasoning_duo.md | 4 ++++ examples/models/reasoning_duo_batched.py | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 examples/models/reasoning_duo_batched.py diff --git a/docs/swarms/agents/reasoning_duo.md b/docs/swarms/agents/reasoning_duo.md index 831310ca..a964fff9 100644 --- a/docs/swarms/agents/reasoning_duo.md +++ b/docs/swarms/agents/reasoning_duo.md @@ -156,3 +156,7 @@ logger.info("Task processing started") - Processing time may vary based on task complexity - Model response quality depends on input clarity - Resource usage scales with batch size + +## Example Script + +For a runnable demonstration, see the [reasoning_duo_batched.py](https://github.com/kyegomez/swarms/blob/master/examples/models/reasoning_duo_batched.py) example. diff --git a/examples/models/reasoning_duo_batched.py b/examples/models/reasoning_duo_batched.py new file mode 100644 index 00000000..a4990ec9 --- /dev/null +++ b/examples/models/reasoning_duo_batched.py @@ -0,0 +1,19 @@ +from swarms.agents.reasoning_duo import ReasoningDuo + +if __name__ == "__main__": + # Initialize the ReasoningDuo with two lightweight models + duo = ReasoningDuo( + model_names=["gpt-4o-mini", "gpt-4o-mini"], + max_loops=1, + ) + + # Batched tasks to process + tasks = [ + "Summarize the benefits of solar energy.", + "List three uses of robotics in healthcare.", + ] + + # Run the batch once and print each result + results = duo.batched_run(tasks) + for task, output in zip(tasks, results): + print(f"Task: {task}\nResult: {output}\n") From 7c4e9bb7bfd193e5e5a5b7c62a365ef2f941219d Mon Sep 17 00:00:00 2001 From: Pavan Kumar <66913595+ascender1729@users.noreply.github.com> Date: Wed, 18 Jun 2025 16:51:23 +0000 Subject: [PATCH 2/2] Remove unsupported max_loops argument from ReasoningDuo initialization --- examples/models/reasoning_duo_batched.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/models/reasoning_duo_batched.py b/examples/models/reasoning_duo_batched.py index a4990ec9..4d75c66f 100644 --- a/examples/models/reasoning_duo_batched.py +++ b/examples/models/reasoning_duo_batched.py @@ -4,7 +4,7 @@ if __name__ == "__main__": # Initialize the ReasoningDuo with two lightweight models duo = ReasoningDuo( model_names=["gpt-4o-mini", "gpt-4o-mini"], - max_loops=1, + # max_loops=1, # Remove this line ) # Batched tasks to process @@ -16,4 +16,4 @@ if __name__ == "__main__": # Run the batch once and print each result results = duo.batched_run(tasks) for task, output in zip(tasks, results): - print(f"Task: {task}\nResult: {output}\n") + print(f"Task: {task}\nResult: {output}\n") \ No newline at end of file