Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions swarms/models/anthropic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
18 changes: 6 additions & 12 deletions swarms/models/dalle3.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,8 @@ def __call__(self, task: str):
# 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",
)
)
Expand Down Expand Up @@ -233,10 +231,8 @@ def create_variations(self, img: str):
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",
)
)
Expand Down Expand Up @@ -310,10 +306,8 @@ def process_batch_concurrently(
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",
)
)
Expand Down
6 changes: 2 additions & 4 deletions swarms/models/huggingface.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,8 @@ def run(self, task: str):
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",
)
)
Expand Down
12 changes: 4 additions & 8 deletions swarms/models/ssd_1b.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,8 @@ def __call__(self, task: str, neg_prompt: str):
# 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",
)
)
Expand Down Expand Up @@ -228,10 +226,8 @@ def process_batch_concurrently(
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",
)
)
Expand Down
10 changes: 4 additions & 6 deletions swarms/structs/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -489,10 +489,8 @@ def activate_autonomous_agent(self):
except Exception as error:
print(
colored(
(
"Error activating autonomous agent. Try optimizing your"
" parameters..."
),
"Error activating autonomous agent. Try optimizing your"
" parameters...",
"red",
)
)
Expand Down Expand Up @@ -652,7 +650,7 @@ async def arun(self, task: str, **kwargs):
while attempt < self.retry_attempts:
try:
response = self.llm(
task**kwargs,
task ** kwargs,
)
if self.interactive:
print(f"AI: {response}")
Expand Down
8 changes: 3 additions & 5 deletions swarms/structs/sequential_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,9 @@ def run(self) -> None:
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"],
)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.