From d1144ec4fc07701932fa351f2eb6d36a623ea33a Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Fri, 24 Nov 2023 08:01:33 -0700 Subject: [PATCH 1/2] black formatting --- swarms/models/anthropic.py | 6 ++++-- swarms/models/dalle3.py | 18 ++++++------------ swarms/models/huggingface.py | 6 ++---- swarms/models/ssd_1b.py | 12 ++++-------- swarms/structs/flow.py | 10 ++++------ swarms/structs/sequential_workflow.py | 8 +++----- 6 files changed, 23 insertions(+), 37 deletions(-) diff --git a/swarms/models/anthropic.py b/swarms/models/anthropic.py index 1f47e1bf..1f0fe759 100644 --- a/swarms/models/anthropic.py +++ b/swarms/models/anthropic.py @@ -185,9 +185,11 @@ def build_extra_kwargs( if field_name in extra_kwargs: raise ValueError(f"Found {field_name} supplied twice.") if field_name not in all_required_field_names: - warnings.warn(f"""WARNING! {field_name} is not default parameter. + warnings.warn( + f"""WARNING! {field_name} is not default parameter. {field_name} was transferred to model_kwargs. - Please confirm that {field_name} is what you intended.""") + Please confirm that {field_name} is what you intended.""" + ) extra_kwargs[field_name] = values.pop(field_name) invalid_model_kwargs = all_required_field_names.intersection( diff --git a/swarms/models/dalle3.py b/swarms/models/dalle3.py index 3c130670..419cb060 100644 --- a/swarms/models/dalle3.py +++ b/swarms/models/dalle3.py @@ -168,10 +168,8 @@ class Dalle3: # Handling exceptions and printing the errors details print( colored( - ( - f"Error running Dalle3: {error} try optimizing your api" - " key and or try again" - ), + f"Error running Dalle3: {error} try optimizing your api" + " key and or try again", "red", ) ) @@ -233,10 +231,8 @@ class Dalle3: except (Exception, openai.OpenAIError) as error: print( colored( - ( - f"Error running Dalle3: {error} try optimizing your api" - " key and or try again" - ), + f"Error running Dalle3: {error} try optimizing your api" + " key and or try again", "red", ) ) @@ -310,10 +306,8 @@ class Dalle3: except Exception as error: print( colored( - ( - f"Error running Dalle3: {error} try optimizing" - " your api key and or try again" - ), + f"Error running Dalle3: {error} try optimizing" + " your api key and or try again", "red", ) ) diff --git a/swarms/models/huggingface.py b/swarms/models/huggingface.py index 1db435f5..f3f7d45f 100644 --- a/swarms/models/huggingface.py +++ b/swarms/models/huggingface.py @@ -291,10 +291,8 @@ class HuggingfaceLLM: except Exception as e: print( colored( - ( - "HuggingfaceLLM could not generate text because of" - f" error: {e}, try optimizing your arguments" - ), + "HuggingfaceLLM could not generate text because of" + f" error: {e}, try optimizing your arguments", "red", ) ) diff --git a/swarms/models/ssd_1b.py b/swarms/models/ssd_1b.py index 406678ef..aaa3f17e 100644 --- a/swarms/models/ssd_1b.py +++ b/swarms/models/ssd_1b.py @@ -140,10 +140,8 @@ class SSD1B: # Handling exceptions and printing the errors details print( colored( - ( - f"Error running SSD1B: {error} try optimizing your api" - " key and or try again" - ), + f"Error running SSD1B: {error} try optimizing your api" + " key and or try again", "red", ) ) @@ -228,10 +226,8 @@ class SSD1B: except Exception as error: print( colored( - ( - f"Error running SSD1B: {error} try optimizing" - " your api key and or try again" - ), + f"Error running SSD1B: {error} try optimizing" + " your api key and or try again", "red", ) ) diff --git a/swarms/structs/flow.py b/swarms/structs/flow.py index 18a141a3..99a3e587 100644 --- a/swarms/structs/flow.py +++ b/swarms/structs/flow.py @@ -137,7 +137,7 @@ class Flow: """ Flow is the structure that provides autonomy to any llm in a reliable and effective fashion. The flow structure is designed to be used with any llm and provides the following features: - + Features: * Interactive, AI generates, then user input * Message history and performance history fed -> into context -> truncate if too long @@ -489,10 +489,8 @@ class Flow: except Exception as error: print( colored( - ( - "Error activating autonomous agent. Try optimizing your" - " parameters..." - ), + "Error activating autonomous agent. Try optimizing your" + " parameters...", "red", ) ) @@ -652,7 +650,7 @@ class Flow: while attempt < self.retry_attempts: try: response = self.llm( - task**kwargs, + task ** kwargs, ) if self.interactive: print(f"AI: {response}") diff --git a/swarms/structs/sequential_workflow.py b/swarms/structs/sequential_workflow.py index 753ada15..85990854 100644 --- a/swarms/structs/sequential_workflow.py +++ b/swarms/structs/sequential_workflow.py @@ -385,11 +385,9 @@ class SequentialWorkflow: except Exception as e: print( colored( - ( - f"Error initializing the Sequential workflow: {e} try" - " optimizing your inputs like the flow class and task" - " description" - ), + f"Error initializing the Sequential workflow: {e} try" + " optimizing your inputs like the flow class and task" + " description", "red", attrs=["bold", "underline"], ) From a2296856f8137814289f58b1ac34342cda0f9cf4 Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Fri, 24 Nov 2023 08:21:16 -0700 Subject: [PATCH 2/2] renamed tests to allow for pytest autodiscovery --- tests/agents/{idea_to_image.py => test_idea_to_image.py} | 0 tests/agents/{omni_modal.py => test_omni_modal.py} | 0 tests/embeddings/{pegasus.py => test_pegasus.py} | 0 tests/memory/{main.py => test_main.py} | 0 tests/memory/{oceandb.py => test_oceandb.py} | 0 tests/memory/{pg.py => test_pg.py} | 0 tests/memory/{pinecone.py => test_pinecone.py} | 0 tests/models/{LLM.py => test_LLM.py} | 0 tests/models/{ada.py => test_ada.py} | 0 tests/models/{anthropic.py => test_anthropic.py} | 0 tests/models/{auto_temp.py => test_auto_temp.py} | 0 tests/models/{bingchat.py => test_bingchat.py} | 0 tests/models/{bioclip.py => test_bioclip.py} | 0 tests/models/{biogpt.py => test_biogpt.py} | 0 tests/models/{cohere.py => test_cohere.py} | 0 tests/models/{dalle3.py => test_dalle3.py} | 0 tests/models/{distill_whisper.py => test_distill_whisper.py} | 0 .../models/{distilled_whisperx.py => test_distilled_whisperx.py} | 0 tests/models/{elevenlab.py => test_elevenlab.py} | 0 tests/models/{fuyu.py => test_fuyu.py} | 0 tests/models/{gpt4v.py => test_gpt4v.py} | 0 tests/models/{hf.py => test_hf.py} | 0 tests/models/{huggingface.py => test_huggingface.py} | 0 tests/models/{idefics.py => test_idefics.py} | 0 tests/models/{jina_embeds.py => test_jina_embeds.py} | 0 tests/models/{kosmos.py => test_kosmos.py} | 0 tests/models/{kosmos2.py => test_kosmos2.py} | 0 .../{llama_function_caller.py => test_llama_function_caller.py} | 0 tests/models/{mistral.py => test_mistral.py} | 0 tests/models/{mpt7b.py => test_mpt7b.py} | 0 tests/models/{nougat.py => test_nougat.py} | 0 tests/models/{revgptv1.py => test_revgptv1.py} | 0 tests/models/{revgptv4.py => test_revgptv4.py} | 0 tests/models/{speech_t5.py => test_speech_t5.py} | 0 tests/models/{ssd_1b.py => test_ssd_1b.py} | 0 tests/models/{timm_model.py => test_timm_model.py} | 0 tests/models/{vilt.py => test_vilt.py} | 0 tests/models/{whisperx.py => test_whisperx.py} | 0 tests/models/{yi_200k.py => test_yi_200k.py} | 0 tests/structs/{flow.py => test_flow.py} | 0 .../structs/{nonlinear_workflow.py => test_nonlinear_workflow.py} | 0 .../{sequential_workflow.py => test_sequential_workflow.py} | 0 tests/structs/{workflow.py => test_workflow.py} | 0 tests/swarms/{autoscaler.py => test_autoscaler.py} | 0 .../swarms/{dialogue_simulator.py => test_dialogue_simulator.py} | 0 tests/swarms/{godmode.py => test_godmode.py} | 0 tests/swarms/{groupchat.py => test_groupchat.py} | 0 .../swarms/{multi_agent_collab.py => test_multi_agent_collab.py} | 0 .../swarms/{multi_agent_debate.py => test_multi_agent_debate.py} | 0 tests/swarms/{orchestrate.py => test_orchestrate.py} | 0 tests/swarms/{simple_swarm.py => test_simple_swarm.py} | 0 tests/tools/{base.py => test_base.py} | 0 ...ss_code_interpreter.py => test_subprocess_code_interpreter.py} | 0 53 files changed, 0 insertions(+), 0 deletions(-) rename tests/agents/{idea_to_image.py => test_idea_to_image.py} (100%) rename tests/agents/{omni_modal.py => test_omni_modal.py} (100%) rename tests/embeddings/{pegasus.py => test_pegasus.py} (100%) rename tests/memory/{main.py => test_main.py} (100%) rename tests/memory/{oceandb.py => test_oceandb.py} (100%) rename tests/memory/{pg.py => test_pg.py} (100%) rename tests/memory/{pinecone.py => test_pinecone.py} (100%) rename tests/models/{LLM.py => test_LLM.py} (100%) rename tests/models/{ada.py => test_ada.py} (100%) rename tests/models/{anthropic.py => test_anthropic.py} (100%) rename tests/models/{auto_temp.py => test_auto_temp.py} (100%) rename tests/models/{bingchat.py => test_bingchat.py} (100%) rename tests/models/{bioclip.py => test_bioclip.py} (100%) rename tests/models/{biogpt.py => test_biogpt.py} (100%) rename tests/models/{cohere.py => test_cohere.py} (100%) rename tests/models/{dalle3.py => test_dalle3.py} (100%) rename tests/models/{distill_whisper.py => test_distill_whisper.py} (100%) rename tests/models/{distilled_whisperx.py => test_distilled_whisperx.py} (100%) rename tests/models/{elevenlab.py => test_elevenlab.py} (100%) rename tests/models/{fuyu.py => test_fuyu.py} (100%) rename tests/models/{gpt4v.py => test_gpt4v.py} (100%) rename tests/models/{hf.py => test_hf.py} (100%) rename tests/models/{huggingface.py => test_huggingface.py} (100%) rename tests/models/{idefics.py => test_idefics.py} (100%) rename tests/models/{jina_embeds.py => test_jina_embeds.py} (100%) rename tests/models/{kosmos.py => test_kosmos.py} (100%) rename tests/models/{kosmos2.py => test_kosmos2.py} (100%) rename tests/models/{llama_function_caller.py => test_llama_function_caller.py} (100%) rename tests/models/{mistral.py => test_mistral.py} (100%) rename tests/models/{mpt7b.py => test_mpt7b.py} (100%) rename tests/models/{nougat.py => test_nougat.py} (100%) rename tests/models/{revgptv1.py => test_revgptv1.py} (100%) rename tests/models/{revgptv4.py => test_revgptv4.py} (100%) rename tests/models/{speech_t5.py => test_speech_t5.py} (100%) rename tests/models/{ssd_1b.py => test_ssd_1b.py} (100%) rename tests/models/{timm_model.py => test_timm_model.py} (100%) rename tests/models/{vilt.py => test_vilt.py} (100%) rename tests/models/{whisperx.py => test_whisperx.py} (100%) rename tests/models/{yi_200k.py => test_yi_200k.py} (100%) rename tests/structs/{flow.py => test_flow.py} (100%) rename tests/structs/{nonlinear_workflow.py => test_nonlinear_workflow.py} (100%) rename tests/structs/{sequential_workflow.py => test_sequential_workflow.py} (100%) rename tests/structs/{workflow.py => test_workflow.py} (100%) rename tests/swarms/{autoscaler.py => test_autoscaler.py} (100%) rename tests/swarms/{dialogue_simulator.py => test_dialogue_simulator.py} (100%) rename tests/swarms/{godmode.py => test_godmode.py} (100%) rename tests/swarms/{groupchat.py => test_groupchat.py} (100%) rename tests/swarms/{multi_agent_collab.py => test_multi_agent_collab.py} (100%) rename tests/swarms/{multi_agent_debate.py => test_multi_agent_debate.py} (100%) rename tests/swarms/{orchestrate.py => test_orchestrate.py} (100%) rename tests/swarms/{simple_swarm.py => test_simple_swarm.py} (100%) rename tests/tools/{base.py => test_base.py} (100%) rename tests/utils/{subprocess_code_interpreter.py => test_subprocess_code_interpreter.py} (100%) diff --git a/tests/agents/idea_to_image.py b/tests/agents/test_idea_to_image.py similarity index 100% rename from tests/agents/idea_to_image.py rename to tests/agents/test_idea_to_image.py diff --git a/tests/agents/omni_modal.py b/tests/agents/test_omni_modal.py similarity index 100% rename from tests/agents/omni_modal.py rename to tests/agents/test_omni_modal.py diff --git a/tests/embeddings/pegasus.py b/tests/embeddings/test_pegasus.py similarity index 100% rename from tests/embeddings/pegasus.py rename to tests/embeddings/test_pegasus.py diff --git a/tests/memory/main.py b/tests/memory/test_main.py similarity index 100% rename from tests/memory/main.py rename to tests/memory/test_main.py diff --git a/tests/memory/oceandb.py b/tests/memory/test_oceandb.py similarity index 100% rename from tests/memory/oceandb.py rename to tests/memory/test_oceandb.py diff --git a/tests/memory/pg.py b/tests/memory/test_pg.py similarity index 100% rename from tests/memory/pg.py rename to tests/memory/test_pg.py diff --git a/tests/memory/pinecone.py b/tests/memory/test_pinecone.py similarity index 100% rename from tests/memory/pinecone.py rename to tests/memory/test_pinecone.py diff --git a/tests/models/LLM.py b/tests/models/test_LLM.py similarity index 100% rename from tests/models/LLM.py rename to tests/models/test_LLM.py diff --git a/tests/models/ada.py b/tests/models/test_ada.py similarity index 100% rename from tests/models/ada.py rename to tests/models/test_ada.py diff --git a/tests/models/anthropic.py b/tests/models/test_anthropic.py similarity index 100% rename from tests/models/anthropic.py rename to tests/models/test_anthropic.py diff --git a/tests/models/auto_temp.py b/tests/models/test_auto_temp.py similarity index 100% rename from tests/models/auto_temp.py rename to tests/models/test_auto_temp.py diff --git a/tests/models/bingchat.py b/tests/models/test_bingchat.py similarity index 100% rename from tests/models/bingchat.py rename to tests/models/test_bingchat.py diff --git a/tests/models/bioclip.py b/tests/models/test_bioclip.py similarity index 100% rename from tests/models/bioclip.py rename to tests/models/test_bioclip.py diff --git a/tests/models/biogpt.py b/tests/models/test_biogpt.py similarity index 100% rename from tests/models/biogpt.py rename to tests/models/test_biogpt.py diff --git a/tests/models/cohere.py b/tests/models/test_cohere.py similarity index 100% rename from tests/models/cohere.py rename to tests/models/test_cohere.py diff --git a/tests/models/dalle3.py b/tests/models/test_dalle3.py similarity index 100% rename from tests/models/dalle3.py rename to tests/models/test_dalle3.py diff --git a/tests/models/distill_whisper.py b/tests/models/test_distill_whisper.py similarity index 100% rename from tests/models/distill_whisper.py rename to tests/models/test_distill_whisper.py diff --git a/tests/models/distilled_whisperx.py b/tests/models/test_distilled_whisperx.py similarity index 100% rename from tests/models/distilled_whisperx.py rename to tests/models/test_distilled_whisperx.py diff --git a/tests/models/elevenlab.py b/tests/models/test_elevenlab.py similarity index 100% rename from tests/models/elevenlab.py rename to tests/models/test_elevenlab.py diff --git a/tests/models/fuyu.py b/tests/models/test_fuyu.py similarity index 100% rename from tests/models/fuyu.py rename to tests/models/test_fuyu.py diff --git a/tests/models/gpt4v.py b/tests/models/test_gpt4v.py similarity index 100% rename from tests/models/gpt4v.py rename to tests/models/test_gpt4v.py diff --git a/tests/models/hf.py b/tests/models/test_hf.py similarity index 100% rename from tests/models/hf.py rename to tests/models/test_hf.py diff --git a/tests/models/huggingface.py b/tests/models/test_huggingface.py similarity index 100% rename from tests/models/huggingface.py rename to tests/models/test_huggingface.py diff --git a/tests/models/idefics.py b/tests/models/test_idefics.py similarity index 100% rename from tests/models/idefics.py rename to tests/models/test_idefics.py diff --git a/tests/models/jina_embeds.py b/tests/models/test_jina_embeds.py similarity index 100% rename from tests/models/jina_embeds.py rename to tests/models/test_jina_embeds.py diff --git a/tests/models/kosmos.py b/tests/models/test_kosmos.py similarity index 100% rename from tests/models/kosmos.py rename to tests/models/test_kosmos.py diff --git a/tests/models/kosmos2.py b/tests/models/test_kosmos2.py similarity index 100% rename from tests/models/kosmos2.py rename to tests/models/test_kosmos2.py diff --git a/tests/models/llama_function_caller.py b/tests/models/test_llama_function_caller.py similarity index 100% rename from tests/models/llama_function_caller.py rename to tests/models/test_llama_function_caller.py diff --git a/tests/models/mistral.py b/tests/models/test_mistral.py similarity index 100% rename from tests/models/mistral.py rename to tests/models/test_mistral.py diff --git a/tests/models/mpt7b.py b/tests/models/test_mpt7b.py similarity index 100% rename from tests/models/mpt7b.py rename to tests/models/test_mpt7b.py diff --git a/tests/models/nougat.py b/tests/models/test_nougat.py similarity index 100% rename from tests/models/nougat.py rename to tests/models/test_nougat.py diff --git a/tests/models/revgptv1.py b/tests/models/test_revgptv1.py similarity index 100% rename from tests/models/revgptv1.py rename to tests/models/test_revgptv1.py diff --git a/tests/models/revgptv4.py b/tests/models/test_revgptv4.py similarity index 100% rename from tests/models/revgptv4.py rename to tests/models/test_revgptv4.py diff --git a/tests/models/speech_t5.py b/tests/models/test_speech_t5.py similarity index 100% rename from tests/models/speech_t5.py rename to tests/models/test_speech_t5.py diff --git a/tests/models/ssd_1b.py b/tests/models/test_ssd_1b.py similarity index 100% rename from tests/models/ssd_1b.py rename to tests/models/test_ssd_1b.py diff --git a/tests/models/timm_model.py b/tests/models/test_timm_model.py similarity index 100% rename from tests/models/timm_model.py rename to tests/models/test_timm_model.py diff --git a/tests/models/vilt.py b/tests/models/test_vilt.py similarity index 100% rename from tests/models/vilt.py rename to tests/models/test_vilt.py diff --git a/tests/models/whisperx.py b/tests/models/test_whisperx.py similarity index 100% rename from tests/models/whisperx.py rename to tests/models/test_whisperx.py diff --git a/tests/models/yi_200k.py b/tests/models/test_yi_200k.py similarity index 100% rename from tests/models/yi_200k.py rename to tests/models/test_yi_200k.py diff --git a/tests/structs/flow.py b/tests/structs/test_flow.py similarity index 100% rename from tests/structs/flow.py rename to tests/structs/test_flow.py diff --git a/tests/structs/nonlinear_workflow.py b/tests/structs/test_nonlinear_workflow.py similarity index 100% rename from tests/structs/nonlinear_workflow.py rename to tests/structs/test_nonlinear_workflow.py diff --git a/tests/structs/sequential_workflow.py b/tests/structs/test_sequential_workflow.py similarity index 100% rename from tests/structs/sequential_workflow.py rename to tests/structs/test_sequential_workflow.py diff --git a/tests/structs/workflow.py b/tests/structs/test_workflow.py similarity index 100% rename from tests/structs/workflow.py rename to tests/structs/test_workflow.py diff --git a/tests/swarms/autoscaler.py b/tests/swarms/test_autoscaler.py similarity index 100% rename from tests/swarms/autoscaler.py rename to tests/swarms/test_autoscaler.py diff --git a/tests/swarms/dialogue_simulator.py b/tests/swarms/test_dialogue_simulator.py similarity index 100% rename from tests/swarms/dialogue_simulator.py rename to tests/swarms/test_dialogue_simulator.py diff --git a/tests/swarms/godmode.py b/tests/swarms/test_godmode.py similarity index 100% rename from tests/swarms/godmode.py rename to tests/swarms/test_godmode.py diff --git a/tests/swarms/groupchat.py b/tests/swarms/test_groupchat.py similarity index 100% rename from tests/swarms/groupchat.py rename to tests/swarms/test_groupchat.py diff --git a/tests/swarms/multi_agent_collab.py b/tests/swarms/test_multi_agent_collab.py similarity index 100% rename from tests/swarms/multi_agent_collab.py rename to tests/swarms/test_multi_agent_collab.py diff --git a/tests/swarms/multi_agent_debate.py b/tests/swarms/test_multi_agent_debate.py similarity index 100% rename from tests/swarms/multi_agent_debate.py rename to tests/swarms/test_multi_agent_debate.py diff --git a/tests/swarms/orchestrate.py b/tests/swarms/test_orchestrate.py similarity index 100% rename from tests/swarms/orchestrate.py rename to tests/swarms/test_orchestrate.py diff --git a/tests/swarms/simple_swarm.py b/tests/swarms/test_simple_swarm.py similarity index 100% rename from tests/swarms/simple_swarm.py rename to tests/swarms/test_simple_swarm.py diff --git a/tests/tools/base.py b/tests/tools/test_base.py similarity index 100% rename from tests/tools/base.py rename to tests/tools/test_base.py diff --git a/tests/utils/subprocess_code_interpreter.py b/tests/utils/test_subprocess_code_interpreter.py similarity index 100% rename from tests/utils/subprocess_code_interpreter.py rename to tests/utils/test_subprocess_code_interpreter.py