swarms 7.8.4__tar.gz → 7.8.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. {swarms-7.8.4 → swarms-7.8.8}/PKG-INFO +31 -55
  2. {swarms-7.8.4 → swarms-7.8.8}/README.md +30 -54
  3. {swarms-7.8.4 → swarms-7.8.8}/pyproject.toml +2 -2
  4. {swarms-7.8.4 → swarms-7.8.8}/swarms/agents/ape_agent.py +5 -22
  5. {swarms-7.8.4 → swarms-7.8.8}/swarms/agents/consistency_agent.py +1 -1
  6. {swarms-7.8.4 → swarms-7.8.8}/swarms/agents/i_agent.py +1 -1
  7. {swarms-7.8.4 → swarms-7.8.8}/swarms/agents/reasoning_agents.py +99 -3
  8. {swarms-7.8.4 → swarms-7.8.8}/swarms/agents/reasoning_duo.py +1 -1
  9. {swarms-7.8.4 → swarms-7.8.8}/swarms/cli/main.py +1 -1
  10. swarms-7.8.8/swarms/communication/__init__.py +1 -0
  11. {swarms-7.8.4 → swarms-7.8.8}/swarms/communication/duckdb_wrap.py +32 -2
  12. {swarms-7.8.4 → swarms-7.8.8}/swarms/communication/pulsar_struct.py +45 -19
  13. {swarms-7.8.4 → swarms-7.8.8}/swarms/communication/redis_wrap.py +56 -11
  14. swarms-7.8.8/swarms/communication/supabase_wrap.py +1659 -0
  15. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/prompt.py +0 -3
  16. swarms-7.8.8/swarms/schemas/agent_completion_response.py +71 -0
  17. swarms-7.8.8/swarms/schemas/agent_rag_schema.py +7 -0
  18. swarms-7.8.8/swarms/schemas/conversation_schema.py +9 -0
  19. swarms-7.8.8/swarms/schemas/llm_agent_schema.py +110 -0
  20. swarms-7.8.8/swarms/schemas/swarms_api_schemas.py +164 -0
  21. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/__init__.py +14 -11
  22. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/agent.py +219 -199
  23. swarms-7.8.8/swarms/structs/agent_rag_handler.py +685 -0
  24. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/base_swarm.py +2 -1
  25. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/conversation.py +608 -87
  26. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/csv_to_agent.py +153 -100
  27. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/deep_research_swarm.py +197 -193
  28. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/dynamic_conversational_swarm.py +18 -7
  29. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/hiearchical_swarm.py +1 -1
  30. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/hybrid_hiearchical_peer_swarm.py +2 -18
  31. swarms-7.8.8/swarms/structs/image_batch_processor.py +261 -0
  32. swarms-7.8.8/swarms/structs/interactive_groupchat.py +356 -0
  33. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/ma_blocks.py +75 -0
  34. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/majority_voting.py +1 -1
  35. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/mixture_of_agents.py +1 -1
  36. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/multi_agent_router.py +3 -2
  37. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/rearrange.py +3 -3
  38. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/sequential_workflow.py +3 -3
  39. swarms-7.8.8/swarms/structs/swarm_matcher.py +693 -0
  40. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/swarm_router.py +15 -97
  41. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/swarming_architectures.py +1 -1
  42. {swarms-7.8.4 → swarms-7.8.8}/swarms/tools/mcp_client_call.py +3 -0
  43. {swarms-7.8.4 → swarms-7.8.8}/swarms/utils/__init__.py +10 -2
  44. swarms-7.8.8/swarms/utils/check_all_model_max_tokens.py +43 -0
  45. {swarms-7.8.4 → swarms-7.8.8}/swarms/utils/generate_keys.py +0 -27
  46. {swarms-7.8.4 → swarms-7.8.8}/swarms/utils/history_output_formatter.py +5 -20
  47. {swarms-7.8.4 → swarms-7.8.8}/swarms/utils/litellm_wrapper.py +208 -60
  48. swarms-7.8.8/swarms/utils/output_types.py +24 -0
  49. {swarms-7.8.4 → swarms-7.8.8}/swarms/utils/vllm_wrapper.py +5 -6
  50. {swarms-7.8.4 → swarms-7.8.8}/swarms/utils/xml_utils.py +37 -2
  51. swarms-7.8.4/swarms/communication/__init__.py +0 -0
  52. swarms-7.8.4/swarms/schemas/llm_agent_schema.py +0 -92
  53. swarms-7.8.4/swarms/structs/multi_agent_collab.py +0 -242
  54. swarms-7.8.4/swarms/structs/output_types.py +0 -6
  55. swarms-7.8.4/swarms/structs/swarm_matcher.py +0 -604
  56. swarms-7.8.4/swarms/utils/markdown_message.py +0 -21
  57. swarms-7.8.4/swarms/utils/visualizer.py +0 -510
  58. swarms-7.8.4/swarms/utils/wrapper_clusterop.py +0 -127
  59. {swarms-7.8.4 → swarms-7.8.8}/LICENSE +0 -0
  60. {swarms-7.8.4 → swarms-7.8.8}/swarms/__init__.py +0 -0
  61. {swarms-7.8.4 → swarms-7.8.8}/swarms/agents/__init__.py +0 -0
  62. {swarms-7.8.4 → swarms-7.8.8}/swarms/agents/agent_judge.py +0 -0
  63. {swarms-7.8.4 → swarms-7.8.8}/swarms/agents/agent_print.py +0 -0
  64. {swarms-7.8.4 → swarms-7.8.8}/swarms/agents/auto_generate_swarm_config.py +0 -0
  65. {swarms-7.8.4 → swarms-7.8.8}/swarms/agents/cort_agent.py +0 -0
  66. {swarms-7.8.4 → swarms-7.8.8}/swarms/agents/create_agents_from_yaml.py +0 -0
  67. {swarms-7.8.4 → swarms-7.8.8}/swarms/agents/flexion_agent.py +0 -0
  68. {swarms-7.8.4 → swarms-7.8.8}/swarms/agents/gkp_agent.py +0 -0
  69. {swarms-7.8.4 → swarms-7.8.8}/swarms/agents/openai_assistant.py +0 -0
  70. {swarms-7.8.4 → swarms-7.8.8}/swarms/agents/react_agent.py +0 -0
  71. {swarms-7.8.4 → swarms-7.8.8}/swarms/agents/self_agent_builder.py +0 -0
  72. {swarms-7.8.4 → swarms-7.8.8}/swarms/agents/tool_agent.py +0 -0
  73. {swarms-7.8.4 → swarms-7.8.8}/swarms/artifacts/__init__.py +0 -0
  74. {swarms-7.8.4 → swarms-7.8.8}/swarms/artifacts/main_artifact.py +0 -0
  75. {swarms-7.8.4 → swarms-7.8.8}/swarms/cli/__init__.py +0 -0
  76. {swarms-7.8.4 → swarms-7.8.8}/swarms/cli/create_agent.py +0 -0
  77. {swarms-7.8.4 → swarms-7.8.8}/swarms/cli/onboarding_process.py +0 -0
  78. {swarms-7.8.4 → swarms-7.8.8}/swarms/communication/base_communication.py +0 -0
  79. {swarms-7.8.4 → swarms-7.8.8}/swarms/communication/sqlite_wrap.py +0 -0
  80. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/__init__.py +0 -0
  81. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/accountant_swarm_prompts.py +0 -0
  82. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/ag_prompt.py +0 -0
  83. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/aga.py +0 -0
  84. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/agent_conversation_aggregator.py +0 -0
  85. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/agent_judge_prompt.py +0 -0
  86. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/agent_prompt.py +0 -0
  87. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/agent_prompts.py +0 -0
  88. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/agent_self_builder_prompt.py +0 -0
  89. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/agent_system_prompts.py +0 -0
  90. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/ai_research_team.py +0 -0
  91. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/aot_prompt.py +0 -0
  92. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/autobloggen.py +0 -0
  93. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/autoswarm.py +0 -0
  94. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/chat_prompt.py +0 -0
  95. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/code_interpreter.py +0 -0
  96. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/code_spawner.py +0 -0
  97. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/debate.py +0 -0
  98. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/documentation.py +0 -0
  99. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/education.py +0 -0
  100. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/finance_agent_prompt.py +0 -0
  101. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/finance_agent_sys_prompt.py +0 -0
  102. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/growth_agent_prompt.py +0 -0
  103. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/idea2img.py +0 -0
  104. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/legal_agent_prompt.py +0 -0
  105. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/logistics.py +0 -0
  106. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/max_loop_prompt.py +0 -0
  107. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/meta_system_prompt.py +0 -0
  108. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/multi_agent_collab_prompt.py +0 -0
  109. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/multi_modal_autonomous_instruction_prompt.py +0 -0
  110. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/multi_modal_prompts.py +0 -0
  111. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/multi_modal_visual_prompts.py +0 -0
  112. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/operations_agent_prompt.py +0 -0
  113. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/paper_idea_agent.py +0 -0
  114. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/personal_stylist.py +0 -0
  115. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/product_agent_prompt.py +0 -0
  116. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/programming.py +0 -0
  117. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/project_manager.py +0 -0
  118. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/prompt_generator.py +0 -0
  119. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/prompt_generator_optimizer.py +0 -0
  120. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/python.py +0 -0
  121. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/react.py +0 -0
  122. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/react_base_prompt.py +0 -0
  123. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/reasoning_prompt.py +0 -0
  124. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/refiner_agent_prompt.py +0 -0
  125. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/safety_prompt.py +0 -0
  126. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/sales.py +0 -0
  127. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/sales_prompts.py +0 -0
  128. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/security_team.py +0 -0
  129. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/self_operating_prompt.py +0 -0
  130. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/sop_generator_agent_prompt.py +0 -0
  131. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/summaries_prompts.py +0 -0
  132. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/support_agent_prompt.py +0 -0
  133. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/swarm_manager_agent.py +0 -0
  134. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/task_assignment_prompt.py +0 -0
  135. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/tests.py +0 -0
  136. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/tools.py +0 -0
  137. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/urban_planning.py +0 -0
  138. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/visual_cot.py +0 -0
  139. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/worker_prompt.py +0 -0
  140. {swarms-7.8.4 → swarms-7.8.8}/swarms/prompts/xray_swarm_prompt.py +0 -0
  141. {swarms-7.8.4 → swarms-7.8.8}/swarms/schemas/__init__.py +0 -0
  142. {swarms-7.8.4 → swarms-7.8.8}/swarms/schemas/agent_class_schema.py +0 -0
  143. {swarms-7.8.4 → swarms-7.8.8}/swarms/schemas/agent_mcp_errors.py +0 -0
  144. {swarms-7.8.4 → swarms-7.8.8}/swarms/schemas/agent_step_schemas.py +0 -0
  145. {swarms-7.8.4 → swarms-7.8.8}/swarms/schemas/agent_tool_schema.py +0 -0
  146. {swarms-7.8.4 → swarms-7.8.8}/swarms/schemas/base_schemas.py +0 -0
  147. {swarms-7.8.4 → swarms-7.8.8}/swarms/schemas/mcp_schemas.py +0 -0
  148. {swarms-7.8.4/swarms/tools → swarms-7.8.8/swarms/schemas}/tool_schema_base_model.py +0 -0
  149. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/agent_builder.py +0 -0
  150. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/agent_registry.py +0 -0
  151. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/agent_roles.py +0 -0
  152. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/agent_router.py +0 -0
  153. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/aop.py +0 -0
  154. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/auto_swarm_builder.py +0 -0
  155. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/base_structure.py +0 -0
  156. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/base_workflow.py +0 -0
  157. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/batch_agent_execution.py +0 -0
  158. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/concat.py +0 -0
  159. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/concurrent_workflow.py +0 -0
  160. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/council_judge.py +0 -0
  161. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/de_hallucination_swarm.py +0 -0
  162. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/graph_workflow.py +0 -0
  163. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/groupchat.py +0 -0
  164. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/long_agent.py +0 -0
  165. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/ma_utils.py +0 -0
  166. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/malt.py +0 -0
  167. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/matrix_swarm.py +0 -0
  168. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/meme_agent_persona_generator.py +0 -0
  169. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/model_router.py +0 -0
  170. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/multi_agent_exec.py +0 -0
  171. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/multi_model_gpu_manager.py +0 -0
  172. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/omni_agent_types.py +0 -0
  173. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/round_robin.py +0 -0
  174. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/safe_loading.py +0 -0
  175. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/spreadsheet_swarm.py +0 -0
  176. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/stopping_conditions.py +0 -0
  177. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/swarm_arange.py +0 -0
  178. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/swarm_eval.py +0 -0
  179. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/swarm_id_generator.py +0 -0
  180. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/swarm_registry.py +0 -0
  181. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/tree_swarm.py +0 -0
  182. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/utils.py +0 -0
  183. {swarms-7.8.4 → swarms-7.8.8}/swarms/structs/various_alt_swarms.py +0 -0
  184. {swarms-7.8.4 → swarms-7.8.8}/swarms/telemetry/__init__.py +0 -0
  185. {swarms-7.8.4 → swarms-7.8.8}/swarms/telemetry/bootup.py +0 -0
  186. {swarms-7.8.4 → swarms-7.8.8}/swarms/telemetry/main.py +0 -0
  187. {swarms-7.8.4 → swarms-7.8.8}/swarms/tools/__init__.py +0 -0
  188. {swarms-7.8.4 → swarms-7.8.8}/swarms/tools/base_tool.py +0 -0
  189. {swarms-7.8.4 → swarms-7.8.8}/swarms/tools/cohere_func_call_schema.py +0 -0
  190. {swarms-7.8.4 → swarms-7.8.8}/swarms/tools/create_agent_tool.py +0 -0
  191. {swarms-7.8.4 → swarms-7.8.8}/swarms/tools/func_calling_utils.py +0 -0
  192. {swarms-7.8.4 → swarms-7.8.8}/swarms/tools/func_to_str.py +0 -0
  193. {swarms-7.8.4 → swarms-7.8.8}/swarms/tools/function_util.py +0 -0
  194. {swarms-7.8.4 → swarms-7.8.8}/swarms/tools/json_former.py +0 -0
  195. {swarms-7.8.4 → swarms-7.8.8}/swarms/tools/json_utils.py +0 -0
  196. {swarms-7.8.4 → swarms-7.8.8}/swarms/tools/logits_processor.py +0 -0
  197. {swarms-7.8.4 → swarms-7.8.8}/swarms/tools/openai_func_calling_schema_pydantic.py +0 -0
  198. {swarms-7.8.4 → swarms-7.8.8}/swarms/tools/openai_tool_creator_decorator.py +0 -0
  199. {swarms-7.8.4 → swarms-7.8.8}/swarms/tools/py_func_to_openai_func_str.py +0 -0
  200. {swarms-7.8.4 → swarms-7.8.8}/swarms/tools/pydantic_to_json.py +0 -0
  201. {swarms-7.8.4 → swarms-7.8.8}/swarms/tools/tool_parse_exec.py +0 -0
  202. {swarms-7.8.4 → swarms-7.8.8}/swarms/tools/tool_registry.py +0 -0
  203. {swarms-7.8.4 → swarms-7.8.8}/swarms/tools/tool_utils.py +0 -0
  204. {swarms-7.8.4 → swarms-7.8.8}/swarms/utils/any_to_str.py +0 -0
  205. {swarms-7.8.4 → swarms-7.8.8}/swarms/utils/audio_processing.py +0 -0
  206. {swarms-7.8.4 → swarms-7.8.8}/swarms/utils/auto_download_check_packages.py +0 -0
  207. {swarms-7.8.4 → swarms-7.8.8}/swarms/utils/calculate_func_metrics.py +0 -0
  208. {swarms-7.8.4 → swarms-7.8.8}/swarms/utils/data_to_text.py +0 -0
  209. {swarms-7.8.4 → swarms-7.8.8}/swarms/utils/disable_logging.py +0 -0
  210. {swarms-7.8.4 → swarms-7.8.8}/swarms/utils/file_processing.py +0 -0
  211. {swarms-7.8.4 → swarms-7.8.8}/swarms/utils/formatter.py +0 -0
  212. {swarms-7.8.4 → swarms-7.8.8}/swarms/utils/function_caller_model.py +0 -0
  213. {swarms-7.8.4 → swarms-7.8.8}/swarms/utils/index.py +0 -0
  214. {swarms-7.8.4 → swarms-7.8.8}/swarms/utils/litellm_tokenizer.py +0 -0
  215. {swarms-7.8.4 → swarms-7.8.8}/swarms/utils/loguru_logger.py +0 -0
  216. {swarms-7.8.4 → swarms-7.8.8}/swarms/utils/parse_code.py +0 -0
  217. {swarms-7.8.4 → swarms-7.8.8}/swarms/utils/pdf_to_text.py +0 -0
  218. {swarms-7.8.4 → swarms-7.8.8}/swarms/utils/str_to_dict.py +0 -0
  219. {swarms-7.8.4 → swarms-7.8.8}/swarms/utils/try_except_wrapper.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: swarms
3
- Version: 7.8.4
3
+ Version: 7.8.8
4
4
  Summary: Swarms - TGSC
5
5
  License: MIT
6
6
  Keywords: artificial intelligence,deep learning,optimizers,Prompt Engineering,swarms,agents,llms,transformers,multi-agent,swarms of agents,Enterprise-Grade Agents,Production-Grade Agents,Agents,Multi-Grade-Agents,Swarms,Transformers,LLMs,Prompt Engineering,Agents,Generative Agents,Generative AI,Agent Marketplace,Agent Store,quant,finance,algorithmic trading,portfolio optimization,risk management,financial modeling,machine learning for finance,natural language processing for finance
@@ -1424,15 +1424,13 @@ print(out)
1424
1424
  -------
1425
1425
 
1426
1426
  ## SpreadSheetSwarm
1427
+
1427
1428
  SpreadSheetSwarm manages thousands of agents concurrently for efficient task processing. It supports one-to-many task distribution, scalability, and autosaving results. Initialized with a name, description, agents, and settings, the run method executes tasks and returns a dictionary of agent outputs.
1428
1429
 
1429
1430
  [Learn more:](https://docs.swarms.world/en/latest/swarms/structs/spreadsheet_swarm/)
1430
1431
 
1431
1432
  ```python
1432
- import os
1433
1433
  from swarms import Agent, SpreadSheetSwarm
1434
- from swarm_models import OpenAIChat
1435
-
1436
1434
  # Define custom system prompts for each social media platform
1437
1435
  TWITTER_AGENT_SYS_PROMPT = """
1438
1436
  You are a Twitter marketing expert specializing in real estate. Your task is to create engaging, concise tweets to promote properties, analyze trends to maximize engagement, and use appropriate hashtags and timing to reach potential buyers.
@@ -1459,7 +1457,7 @@ agents = [
1459
1457
  Agent(
1460
1458
  agent_name="Twitter-RealEstate-Agent",
1461
1459
  system_prompt=TWITTER_AGENT_SYS_PROMPT,
1462
- model_name="gpt-4o",
1460
+ model_name="gpt-4o-mini",
1463
1461
  max_loops=1,
1464
1462
  dynamic_temperature_enabled=True,
1465
1463
  saved_state_path="twitter_realestate_agent.json",
@@ -1469,7 +1467,7 @@ agents = [
1469
1467
  Agent(
1470
1468
  agent_name="Instagram-RealEstate-Agent",
1471
1469
  system_prompt=INSTAGRAM_AGENT_SYS_PROMPT,
1472
- model_name="gpt-4o",
1470
+ model_name="gpt-4o-mini",
1473
1471
  max_loops=1,
1474
1472
  dynamic_temperature_enabled=True,
1475
1473
  saved_state_path="instagram_realestate_agent.json",
@@ -1479,7 +1477,7 @@ agents = [
1479
1477
  Agent(
1480
1478
  agent_name="Facebook-RealEstate-Agent",
1481
1479
  system_prompt=FACEBOOK_AGENT_SYS_PROMPT,
1482
- model_name="gpt-4o",
1480
+ model_name="gpt-4o-mini",
1483
1481
  max_loops=1,
1484
1482
  dynamic_temperature_enabled=True,
1485
1483
  saved_state_path="facebook_realestate_agent.json",
@@ -1489,7 +1487,7 @@ agents = [
1489
1487
  Agent(
1490
1488
  agent_name="LinkedIn-RealEstate-Agent",
1491
1489
  system_prompt=LINKEDIN_AGENT_SYS_PROMPT,
1492
- model_name="gpt-4o",
1490
+ model_name="gpt-4o-mini",
1493
1491
  max_loops=1,
1494
1492
  dynamic_temperature_enabled=True,
1495
1493
  saved_state_path="linkedin_realestate_agent.json",
@@ -1499,7 +1497,7 @@ agents = [
1499
1497
  Agent(
1500
1498
  agent_name="Email-RealEstate-Agent",
1501
1499
  system_prompt=EMAIL_AGENT_SYS_PROMPT,
1502
- model_name="gpt-4o",
1500
+ model_name="gpt-4o-mini",
1503
1501
  max_loops=1,
1504
1502
  dynamic_temperature_enabled=True,
1505
1503
  saved_state_path="email_realestate_agent.json",
@@ -1963,32 +1961,18 @@ A production-grade multi-agent system enabling sophisticated group conversations
1963
1961
 
1964
1962
 
1965
1963
  ```python
1966
-
1967
- import os
1968
- from dotenv import load_dotenv
1969
- from swarm_models import OpenAIChat
1970
1964
  from swarms import Agent, GroupChat, expertise_based
1971
1965
 
1972
1966
 
1973
1967
  if __name__ == "__main__":
1974
1968
 
1975
- load_dotenv()
1976
-
1977
- # Get the OpenAI API key from the environment variable
1978
- api_key = os.getenv("OPENAI_API_KEY")
1979
-
1980
- # Create an instance of the OpenAIChat class
1981
- model = OpenAIChat(
1982
- openai_api_key=api_key,
1983
- model_name="gpt-4o-mini",
1984
- temperature=0.1,
1985
- )
1986
1969
 
1987
1970
  # Example agents
1988
1971
  agent1 = Agent(
1989
1972
  agent_name="Financial-Analysis-Agent",
1990
1973
  system_prompt="You are a financial analyst specializing in investment strategies.",
1991
- llm=model,
1974
+ model_name="gpt-4o-mini",
1975
+ temperature=0.1,
1992
1976
  max_loops=1,
1993
1977
  autosave=False,
1994
1978
  dashboard=False,
@@ -2004,7 +1988,8 @@ if __name__ == "__main__":
2004
1988
  agent2 = Agent(
2005
1989
  agent_name="Tax-Adviser-Agent",
2006
1990
  system_prompt="You are a tax adviser who provides clear and concise guidance on tax-related queries.",
2007
- llm=model,
1991
+ model_name="gpt-4o-mini",
1992
+ temperature=0.1,
2008
1993
  max_loops=1,
2009
1994
  autosave=False,
2010
1995
  dashboard=False,
@@ -2029,7 +2014,8 @@ if __name__ == "__main__":
2029
2014
  history = chat.run(
2030
2015
  "How to optimize tax strategy for investments?"
2031
2016
  )
2032
- print(history.model_dump_json(indent=2))
2017
+ print(history)
2018
+
2033
2019
 
2034
2020
  ```
2035
2021
 
@@ -2087,35 +2073,18 @@ if __name__ == "__main__":
2087
2073
  ----------
2088
2074
 
2089
2075
  ## Onboarding Session
2076
+
2090
2077
  Get onboarded now with the creator and lead maintainer of Swarms, Kye Gomez, who will show you how to get started with the installation, usage examples, and starting to build your custom use case! [CLICK HERE](https://cal.com/swarms/swarms-onboarding-session)
2091
2078
 
2092
2079
 
2093
2080
  ---
2094
2081
 
2095
2082
  ## Documentation
2083
+
2096
2084
  Documentation is located here at: [docs.swarms.world](https://docs.swarms.world)
2097
2085
 
2098
2086
  -----
2099
2087
 
2100
- ## Folder Structure
2101
- The swarms package has been meticulously crafted for extreme usability and understanding,the swarms package is split up into various modules such as `swarms.agents` that holds pre-built agents, `swarms.structs` that holds a vast array of structures like `Agent` and multi agent structures. The package is split into various modules, with the most important being `structs`, `tools`, and `agents`.
2102
-
2103
- ```sh
2104
- ├── __init__.py
2105
- ├── agents/
2106
- ├── artifacts/
2107
- ├── client/
2108
- ├── cli/
2109
- ├── prompts/
2110
- ├── schemas/
2111
- ├── structs/
2112
- ├── telemetry/
2113
- ├── tools/
2114
- └── utils/
2115
- ```
2116
-
2117
- ----
2118
-
2119
2088
  ## 🫶 Contributions:
2120
2089
 
2121
2090
  The easiest way to contribute is to pick any issue with the `good first issue` tag 💪. Read the Contributing guidelines [here](/CONTRIBUTING.md). Bug Report? [File here](https://github.com/swarms/gateway/issues) | Feature Request? [File here](https://github.com/swarms/gateway/issues)
@@ -2125,17 +2094,24 @@ Swarms is an open-source project, and contributions are VERY welcome. If you wan
2125
2094
  ----
2126
2095
 
2127
2096
 
2128
- ## Community
2097
+ ### Connect With Us
2098
+
2099
+ | Platform | Link | Description |
2100
+ |----------|------|-------------|
2101
+ | 📚 Documentation | [docs.swarms.world](https://docs.swarms.world) | Official documentation and guides |
2102
+ | 📝 Blog | [Medium](https://medium.com/@kyeg) | Latest updates and technical articles |
2103
+ | 💬 Discord | [Join Discord](https://discord.gg/jM3Z6M9uMq) | Live chat and community support |
2104
+ | 🐦 Twitter | [@kyegomez](https://twitter.com/kyegomez) | Latest news and announcements |
2105
+ | 👥 LinkedIn | [The Swarm Corporation](https://www.linkedin.com/company/the-swarm-corporation) | Professional network and updates |
2106
+ | 📺 YouTube | [Swarms Channel](https://www.youtube.com/channel/UC9yXyitkbU_WSy7bd_41SqQ) | Tutorials and demos |
2107
+ | 🎫 Events | [Sign up here](https://lu.ma/5p2jnc2v) | Join our community events |
2108
+
2109
+
2110
+
2111
+ ## Citation
2129
2112
 
2130
- Join our growing community around the world, for real-time support, ideas, and discussions on Swarms 😊
2113
+ If you use **swarms** in your research, please cite the project by referencing the metadata in [CITATION.cff](./CITATION.cff).
2131
2114
 
2132
- - View our official [Documents](https://docs.swarms.world)
2133
- - View our official [Blog](https://medium.com/@kyeg)
2134
- - Chat live with us on [Discord](https://discord.gg/jM3Z6M9uMq)
2135
- - Follow us on [Twitter](https://twitter.com/kyegomez)
2136
- - Connect with us on [LinkedIn](https://www.linkedin.com/company/the-swarm-corporation)
2137
- - Visit us on [YouTube](https://www.youtube.com/channel/UC9yXyitkbU_WSy7bd_41SqQ)
2138
- - Sign up for our events [Sign up here](https://lu.ma/5p2jnc2v)
2139
2115
 
2140
2116
  # License
2141
2117
 
@@ -1381,15 +1381,13 @@ print(out)
1381
1381
  -------
1382
1382
 
1383
1383
  ## SpreadSheetSwarm
1384
+
1384
1385
  SpreadSheetSwarm manages thousands of agents concurrently for efficient task processing. It supports one-to-many task distribution, scalability, and autosaving results. Initialized with a name, description, agents, and settings, the run method executes tasks and returns a dictionary of agent outputs.
1385
1386
 
1386
1387
  [Learn more:](https://docs.swarms.world/en/latest/swarms/structs/spreadsheet_swarm/)
1387
1388
 
1388
1389
  ```python
1389
- import os
1390
1390
  from swarms import Agent, SpreadSheetSwarm
1391
- from swarm_models import OpenAIChat
1392
-
1393
1391
  # Define custom system prompts for each social media platform
1394
1392
  TWITTER_AGENT_SYS_PROMPT = """
1395
1393
  You are a Twitter marketing expert specializing in real estate. Your task is to create engaging, concise tweets to promote properties, analyze trends to maximize engagement, and use appropriate hashtags and timing to reach potential buyers.
@@ -1416,7 +1414,7 @@ agents = [
1416
1414
  Agent(
1417
1415
  agent_name="Twitter-RealEstate-Agent",
1418
1416
  system_prompt=TWITTER_AGENT_SYS_PROMPT,
1419
- model_name="gpt-4o",
1417
+ model_name="gpt-4o-mini",
1420
1418
  max_loops=1,
1421
1419
  dynamic_temperature_enabled=True,
1422
1420
  saved_state_path="twitter_realestate_agent.json",
@@ -1426,7 +1424,7 @@ agents = [
1426
1424
  Agent(
1427
1425
  agent_name="Instagram-RealEstate-Agent",
1428
1426
  system_prompt=INSTAGRAM_AGENT_SYS_PROMPT,
1429
- model_name="gpt-4o",
1427
+ model_name="gpt-4o-mini",
1430
1428
  max_loops=1,
1431
1429
  dynamic_temperature_enabled=True,
1432
1430
  saved_state_path="instagram_realestate_agent.json",
@@ -1436,7 +1434,7 @@ agents = [
1436
1434
  Agent(
1437
1435
  agent_name="Facebook-RealEstate-Agent",
1438
1436
  system_prompt=FACEBOOK_AGENT_SYS_PROMPT,
1439
- model_name="gpt-4o",
1437
+ model_name="gpt-4o-mini",
1440
1438
  max_loops=1,
1441
1439
  dynamic_temperature_enabled=True,
1442
1440
  saved_state_path="facebook_realestate_agent.json",
@@ -1446,7 +1444,7 @@ agents = [
1446
1444
  Agent(
1447
1445
  agent_name="LinkedIn-RealEstate-Agent",
1448
1446
  system_prompt=LINKEDIN_AGENT_SYS_PROMPT,
1449
- model_name="gpt-4o",
1447
+ model_name="gpt-4o-mini",
1450
1448
  max_loops=1,
1451
1449
  dynamic_temperature_enabled=True,
1452
1450
  saved_state_path="linkedin_realestate_agent.json",
@@ -1456,7 +1454,7 @@ agents = [
1456
1454
  Agent(
1457
1455
  agent_name="Email-RealEstate-Agent",
1458
1456
  system_prompt=EMAIL_AGENT_SYS_PROMPT,
1459
- model_name="gpt-4o",
1457
+ model_name="gpt-4o-mini",
1460
1458
  max_loops=1,
1461
1459
  dynamic_temperature_enabled=True,
1462
1460
  saved_state_path="email_realestate_agent.json",
@@ -1920,32 +1918,18 @@ A production-grade multi-agent system enabling sophisticated group conversations
1920
1918
 
1921
1919
 
1922
1920
  ```python
1923
-
1924
- import os
1925
- from dotenv import load_dotenv
1926
- from swarm_models import OpenAIChat
1927
1921
  from swarms import Agent, GroupChat, expertise_based
1928
1922
 
1929
1923
 
1930
1924
  if __name__ == "__main__":
1931
1925
 
1932
- load_dotenv()
1933
-
1934
- # Get the OpenAI API key from the environment variable
1935
- api_key = os.getenv("OPENAI_API_KEY")
1936
-
1937
- # Create an instance of the OpenAIChat class
1938
- model = OpenAIChat(
1939
- openai_api_key=api_key,
1940
- model_name="gpt-4o-mini",
1941
- temperature=0.1,
1942
- )
1943
1926
 
1944
1927
  # Example agents
1945
1928
  agent1 = Agent(
1946
1929
  agent_name="Financial-Analysis-Agent",
1947
1930
  system_prompt="You are a financial analyst specializing in investment strategies.",
1948
- llm=model,
1931
+ model_name="gpt-4o-mini",
1932
+ temperature=0.1,
1949
1933
  max_loops=1,
1950
1934
  autosave=False,
1951
1935
  dashboard=False,
@@ -1961,7 +1945,8 @@ if __name__ == "__main__":
1961
1945
  agent2 = Agent(
1962
1946
  agent_name="Tax-Adviser-Agent",
1963
1947
  system_prompt="You are a tax adviser who provides clear and concise guidance on tax-related queries.",
1964
- llm=model,
1948
+ model_name="gpt-4o-mini",
1949
+ temperature=0.1,
1965
1950
  max_loops=1,
1966
1951
  autosave=False,
1967
1952
  dashboard=False,
@@ -1986,7 +1971,8 @@ if __name__ == "__main__":
1986
1971
  history = chat.run(
1987
1972
  "How to optimize tax strategy for investments?"
1988
1973
  )
1989
- print(history.model_dump_json(indent=2))
1974
+ print(history)
1975
+
1990
1976
 
1991
1977
  ```
1992
1978
 
@@ -2044,35 +2030,18 @@ if __name__ == "__main__":
2044
2030
  ----------
2045
2031
 
2046
2032
  ## Onboarding Session
2033
+
2047
2034
  Get onboarded now with the creator and lead maintainer of Swarms, Kye Gomez, who will show you how to get started with the installation, usage examples, and starting to build your custom use case! [CLICK HERE](https://cal.com/swarms/swarms-onboarding-session)
2048
2035
 
2049
2036
 
2050
2037
  ---
2051
2038
 
2052
2039
  ## Documentation
2040
+
2053
2041
  Documentation is located here at: [docs.swarms.world](https://docs.swarms.world)
2054
2042
 
2055
2043
  -----
2056
2044
 
2057
- ## Folder Structure
2058
- The swarms package has been meticulously crafted for extreme usability and understanding,the swarms package is split up into various modules such as `swarms.agents` that holds pre-built agents, `swarms.structs` that holds a vast array of structures like `Agent` and multi agent structures. The package is split into various modules, with the most important being `structs`, `tools`, and `agents`.
2059
-
2060
- ```sh
2061
- ├── __init__.py
2062
- ├── agents/
2063
- ├── artifacts/
2064
- ├── client/
2065
- ├── cli/
2066
- ├── prompts/
2067
- ├── schemas/
2068
- ├── structs/
2069
- ├── telemetry/
2070
- ├── tools/
2071
- └── utils/
2072
- ```
2073
-
2074
- ----
2075
-
2076
2045
  ## 🫶 Contributions:
2077
2046
 
2078
2047
  The easiest way to contribute is to pick any issue with the `good first issue` tag 💪. Read the Contributing guidelines [here](/CONTRIBUTING.md). Bug Report? [File here](https://github.com/swarms/gateway/issues) | Feature Request? [File here](https://github.com/swarms/gateway/issues)
@@ -2082,17 +2051,24 @@ Swarms is an open-source project, and contributions are VERY welcome. If you wan
2082
2051
  ----
2083
2052
 
2084
2053
 
2085
- ## Community
2054
+ ### Connect With Us
2055
+
2056
+ | Platform | Link | Description |
2057
+ |----------|------|-------------|
2058
+ | 📚 Documentation | [docs.swarms.world](https://docs.swarms.world) | Official documentation and guides |
2059
+ | 📝 Blog | [Medium](https://medium.com/@kyeg) | Latest updates and technical articles |
2060
+ | 💬 Discord | [Join Discord](https://discord.gg/jM3Z6M9uMq) | Live chat and community support |
2061
+ | 🐦 Twitter | [@kyegomez](https://twitter.com/kyegomez) | Latest news and announcements |
2062
+ | 👥 LinkedIn | [The Swarm Corporation](https://www.linkedin.com/company/the-swarm-corporation) | Professional network and updates |
2063
+ | 📺 YouTube | [Swarms Channel](https://www.youtube.com/channel/UC9yXyitkbU_WSy7bd_41SqQ) | Tutorials and demos |
2064
+ | 🎫 Events | [Sign up here](https://lu.ma/5p2jnc2v) | Join our community events |
2065
+
2066
+
2067
+
2068
+ ## Citation
2086
2069
 
2087
- Join our growing community around the world, for real-time support, ideas, and discussions on Swarms 😊
2070
+ If you use **swarms** in your research, please cite the project by referencing the metadata in [CITATION.cff](./CITATION.cff).
2088
2071
 
2089
- - View our official [Documents](https://docs.swarms.world)
2090
- - View our official [Blog](https://medium.com/@kyeg)
2091
- - Chat live with us on [Discord](https://discord.gg/jM3Z6M9uMq)
2092
- - Follow us on [Twitter](https://twitter.com/kyegomez)
2093
- - Connect with us on [LinkedIn](https://www.linkedin.com/company/the-swarm-corporation)
2094
- - Visit us on [YouTube](https://www.youtube.com/channel/UC9yXyitkbU_WSy7bd_41SqQ)
2095
- - Sign up for our events [Sign up here](https://lu.ma/5p2jnc2v)
2096
2072
 
2097
2073
  # License
2098
2074
 
@@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api"
5
5
 
6
6
  [tool.poetry]
7
7
  name = "swarms"
8
- version = "7.8.4"
8
+ version = "7.8.8"
9
9
  description = "Swarms - TGSC"
10
10
  license = "MIT"
11
11
  authors = ["Kye Gomez <kye@apac.ai>"]
@@ -86,7 +86,7 @@ swarms = "swarms.cli.main:main"
86
86
 
87
87
  [tool.poetry.group.lint.dependencies]
88
88
  black = ">=23.1,<26.0"
89
- ruff = ">=0.5.1,<0.11.9"
89
+ ruff = ">=0.5.1,<0.11.14"
90
90
  types-toml = "^0.10.8.1"
91
91
  types-pytz = ">=2023.3,<2026.0"
92
92
  types-chardet = "^5.0.4.6"
@@ -1,27 +1,17 @@
1
- from typing import Any
1
+ from typing import Callable
2
2
 
3
- from tenacity import retry, stop_after_attempt, wait_exponential
4
3
 
5
- from swarms.prompts.prompt_generator import (
6
- prompt_generator_sys_prompt as second_sys_prompt,
7
- )
8
4
  from swarms.prompts.prompt_generator_optimizer import (
9
- prompt_generator_sys_prompt,
5
+ OPENAI_PROMPT_GENERATOR_SYS_PROMPT,
10
6
  )
11
7
  from swarms.utils.loguru_logger import initialize_logger
12
8
 
13
9
  logger = initialize_logger(log_folder="ape_agent")
14
10
 
15
11
 
16
- @retry(
17
- stop=stop_after_attempt(3),
18
- wait=wait_exponential(multiplier=1, min=4, max=10),
19
- )
20
12
  def auto_generate_prompt(
21
13
  task: str = None,
22
- model: Any = None,
23
- max_tokens: int = 4000,
24
- use_second_sys_prompt: bool = True,
14
+ model: Callable = None,
25
15
  *args,
26
16
  **kwargs,
27
17
  ):
@@ -38,16 +28,9 @@ def auto_generate_prompt(
38
28
  str: The generated prompt.
39
29
  """
40
30
  try:
41
- system_prompt = (
42
- second_sys_prompt.get_prompt()
43
- if use_second_sys_prompt
44
- else prompt_generator_sys_prompt.get_prompt()
45
- )
46
- output = model.run(
47
- system_prompt + task, max_tokens=max_tokens
31
+ return model.run(
32
+ task=f"{OPENAI_PROMPT_GENERATOR_SYS_PROMPT} \n\n Task: {task}"
48
33
  )
49
- print(output)
50
- return output
51
34
  except Exception as e:
52
35
  logger.error(f"Error generating prompt: {str(e)}")
53
36
  raise
@@ -7,7 +7,7 @@ from loguru import logger
7
7
  from swarms.structs.agent import Agent
8
8
  from swarms.structs.conversation import Conversation
9
9
  from swarms.structs.malt import majority_voting_prompt
10
- from swarms.structs.output_types import OutputType
10
+ from swarms.utils.output_types import OutputType
11
11
  from swarms.utils.any_to_str import any_to_str
12
12
  from swarms.utils.history_output_formatter import (
13
13
  history_output_formatter,
@@ -22,7 +22,7 @@ from typing import List, Tuple
22
22
  from loguru import logger
23
23
  from swarms.structs.agent import Agent
24
24
  from swarms.structs.conversation import Conversation
25
- from swarms.structs.output_types import OutputType
25
+ from swarms.utils.output_types import OutputType
26
26
  from swarms.utils.history_output_formatter import (
27
27
  history_output_formatter,
28
28
  )
@@ -1,4 +1,4 @@
1
- from typing import List, Literal
1
+ from typing import List, Literal, Dict, Callable, Any
2
2
 
3
3
  from swarms.agents.consistency_agent import SelfConsistencyAgent
4
4
  from swarms.agents.flexion_agent import ReflexionAgent
@@ -7,7 +7,7 @@ from swarms.agents.i_agent import (
7
7
  IterativeReflectiveExpansion as IREAgent,
8
8
  )
9
9
  from swarms.agents.reasoning_duo import ReasoningDuo
10
- from swarms.structs.output_types import OutputType
10
+ from swarms.utils.output_types import OutputType
11
11
  from swarms.agents.agent_judge import AgentJudge
12
12
 
13
13
  agent_types = Literal[
@@ -62,13 +62,100 @@ class ReasoningAgentRouter:
62
62
  self.num_knowledge_items = num_knowledge_items
63
63
  self.memory_capacity = memory_capacity
64
64
 
65
+ # Added: Initialize the factory mapping dictionary
66
+ self._initialize_agent_factories()
67
+
68
+ # Added: Factory method initialization function
69
+ def _initialize_agent_factories(self) -> None:
70
+ """
71
+ Initialize the agent factory mapping dictionary, mapping various agent types to their respective creation functions.
72
+ This method replaces the original if-elif chain, making the code easier to maintain and extend.
73
+ """
74
+ self.agent_factories: Dict[str, Callable[[], Any]] = {
75
+ # ReasoningDuo factory methods
76
+ "reasoning-duo": self._create_reasoning_duo,
77
+ "reasoning-agent": self._create_reasoning_duo,
78
+ # SelfConsistencyAgent factory methods
79
+ "self-consistency": self._create_consistency_agent,
80
+ "consistency-agent": self._create_consistency_agent,
81
+ # IREAgent factory methods
82
+ "ire": self._create_ire_agent,
83
+ "ire-agent": self._create_ire_agent,
84
+ # Other agent type factory methods
85
+ "AgentJudge": self._create_agent_judge,
86
+ "ReflexionAgent": self._create_reflexion_agent,
87
+ "GKPAgent": self._create_gkp_agent,
88
+ }
89
+
90
+ # Added: Concrete factory methods for various agent types
91
+ def _create_reasoning_duo(self):
92
+ """Creates an agent instance for ReasoningDuo type"""
93
+ return ReasoningDuo(
94
+ agent_name=self.agent_name,
95
+ agent_description=self.description,
96
+ model_name=[self.model_name, self.model_name],
97
+ system_prompt=self.system_prompt,
98
+ output_type=self.output_type,
99
+ )
100
+
101
+ def _create_consistency_agent(self):
102
+ """Creates an agent instance for SelfConsistencyAgent type"""
103
+ return SelfConsistencyAgent(
104
+ agent_name=self.agent_name,
105
+ description=self.description,
106
+ model_name=self.model_name,
107
+ system_prompt=self.system_prompt,
108
+ max_loops=self.max_loops,
109
+ num_samples=self.num_samples,
110
+ output_type=self.output_type,
111
+ )
112
+
113
+ def _create_ire_agent(self):
114
+ """Creates an agent instance for IREAgent type"""
115
+ return IREAgent(
116
+ agent_name=self.agent_name,
117
+ description=self.description,
118
+ model_name=self.model_name,
119
+ system_prompt=self.system_prompt,
120
+ max_loops=self.max_loops,
121
+ max_iterations=self.num_samples,
122
+ output_type=self.output_type,
123
+ )
124
+
125
+ def _create_agent_judge(self):
126
+ """Creates an agent instance for AgentJudge type"""
127
+ return AgentJudge(
128
+ agent_name=self.agent_name,
129
+ model_name=self.model_name,
130
+ system_prompt=self.system_prompt,
131
+ max_loops=self.max_loops,
132
+ )
133
+
134
+ def _create_reflexion_agent(self):
135
+ """Creates an agent instance for ReflexionAgent type"""
136
+ return ReflexionAgent(
137
+ agent_name=self.agent_name,
138
+ system_prompt=self.system_prompt,
139
+ model_name=self.model_name,
140
+ max_loops=self.max_loops,
141
+ )
142
+
143
+ def _create_gkp_agent(self):
144
+ """Creates an agent instance for GKPAgent type"""
145
+ return GKPAgent(
146
+ agent_name=self.agent_name,
147
+ model_name=self.model_name,
148
+ num_knowledge_items=self.num_knowledge_items,
149
+ )
150
+
65
151
  def select_swarm(self):
66
152
  """
67
153
  Selects and initializes the appropriate reasoning swarm based on the specified swarm type.
68
-
69
154
  Returns:
70
155
  An instance of the selected reasoning swarm.
71
156
  """
157
+ # Commented out original if-elif chain implementation
158
+ """
72
159
  if (
73
160
  self.swarm_type == "reasoning-duo"
74
161
  or self.swarm_type == "reasoning-agent"
@@ -132,6 +219,15 @@ class ReasoningAgentRouter:
132
219
  )
133
220
  else:
134
221
  raise ValueError(f"Invalid swarm type: {self.swarm_type}")
222
+ """
223
+
224
+ # Added: Implementation using factory pattern and dictionary mapping
225
+ try:
226
+ # Get the corresponding creation function from the factory dictionary and call it
227
+ return self.agent_factories[self.swarm_type]()
228
+ except KeyError:
229
+ # Maintain the same error handling as the original code
230
+ raise ValueError(f"Invalid swarm type: {self.swarm_type}")
135
231
 
136
232
  def run(self, task: str, *args, **kwargs):
137
233
  """
@@ -4,7 +4,7 @@ from loguru import logger
4
4
 
5
5
  from swarms.prompts.reasoning_prompt import REASONING_PROMPT
6
6
  from swarms.structs.agent import Agent
7
- from swarms.structs.output_types import OutputType
7
+ from swarms.utils.output_types import OutputType
8
8
  from swarms.structs.conversation import Conversation
9
9
  from swarms.utils.history_output_formatter import (
10
10
  history_output_formatter,
@@ -67,7 +67,7 @@ def show_ascii_art():
67
67
  Text(ASCII_ART, style=f"bold {COLORS['primary']}"),
68
68
  border_style=COLORS["secondary"],
69
69
  title="[bold]Welcome to Swarms[/bold]",
70
- subtitle="[dim]Power to the Swarms[/dim]",
70
+ subtitle="[dim]swarms.ai[/dim]",
71
71
  )
72
72
  console.print(panel)
73
73
 
@@ -7,7 +7,6 @@ from contextlib import contextmanager
7
7
  from pathlib import Path
8
8
  from typing import Any, Callable, Dict, List, Optional, Union
9
9
 
10
- import duckdb
11
10
  import yaml
12
11
 
13
12
  from swarms.communication.base_communication import (
@@ -76,6 +75,37 @@ class DuckDBConversation(BaseCommunication):
76
75
  *args,
77
76
  **kwargs,
78
77
  ):
78
+ # Lazy load duckdb with auto-installation
79
+ try:
80
+ import duckdb
81
+
82
+ self.duckdb = duckdb
83
+ self.duckdb_available = True
84
+ except ImportError:
85
+ # Auto-install duckdb if not available
86
+ print("📦 DuckDB not found. Installing automatically...")
87
+ try:
88
+ import subprocess
89
+ import sys
90
+
91
+ # Install duckdb
92
+ subprocess.check_call(
93
+ [sys.executable, "-m", "pip", "install", "duckdb"]
94
+ )
95
+ print("✅ DuckDB installed successfully!")
96
+
97
+ # Try importing again
98
+ import duckdb
99
+
100
+ self.duckdb = duckdb
101
+ self.duckdb_available = True
102
+ print("✅ DuckDB loaded successfully!")
103
+
104
+ except Exception as e:
105
+ raise ImportError(
106
+ f"Failed to auto-install DuckDB. Please install manually with 'pip install duckdb': {e}"
107
+ )
108
+
79
109
  super().__init__(
80
110
  system_prompt=system_prompt,
81
111
  time_enabled=time_enabled,
@@ -171,7 +201,7 @@ class DuckDBConversation(BaseCommunication):
171
201
  conn = None
172
202
  for attempt in range(self.max_retries):
173
203
  try:
174
- conn = duckdb.connect(str(self.db_path))
204
+ conn = self.duckdb.connect(str(self.db_path))
175
205
  yield conn
176
206
  break
177
207
  except Exception as e: