Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Refactor] dependencies upgrade #408

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ ipython_config.py
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
Expand Down
6 changes: 2 additions & 4 deletions playground/agents/mm_agent_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
img = node.run_img("/image1", "What is this image about?")

chat = node.chat(
(
"What is your name? Generate a picture of yourself. What is"
" this image about?"
),
"What is your name? Generate a picture of yourself. What is"
" this image about?",
streaming=True,
)
6 changes: 2 additions & 4 deletions playground/demos/autobloggen_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,8 @@ def run(self):
except Exception as error:
print(
colored(
(
"Error while running AutoBlogGenSwarm"
f" {error}"
),
"Error while running AutoBlogGenSwarm"
f" {error}",
"red",
)
)
Expand Down
30 changes: 10 additions & 20 deletions playground/demos/autotemp/blog_gen_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,8 @@ def run_workflow(self):
topic_output = topic_result.generations[0][0].text
print(
colored(
(
"\nTopic Selection Task"
f" Output:\n----------------------------\n{topic_output}\n"
),
"\nTopic Selection Task"
f" Output:\n----------------------------\n{topic_output}\n",
"white",
)
)
Expand All @@ -72,10 +70,8 @@ def run_workflow(self):
initial_draft_output = auto_temp_output # Assuming AutoTemp.run returns the best output directly
print(
colored(
(
"\nInitial Draft"
f" Output:\n----------------------------\n{initial_draft_output}\n"
),
"\nInitial Draft"
f" Output:\n----------------------------\n{initial_draft_output}\n",
"white",
)
)
Expand All @@ -88,10 +84,8 @@ def run_workflow(self):
review_output = review_result.generations[0][0].text
print(
colored(
(
"\nReview"
f" Output:\n----------------------------\n{review_output}\n"
),
"\nReview"
f" Output:\n----------------------------\n{review_output}\n",
"white",
)
)
Expand All @@ -110,10 +104,8 @@ def run_workflow(self):
].text
print(
colored(
(
"\nDistribution"
f" Output:\n----------------------------\n{distribution_output}\n"
),
"\nDistribution"
f" Output:\n----------------------------\n{distribution_output}\n",
"white",
)
)
Expand All @@ -122,10 +114,8 @@ def run_workflow(self):
final_blog_content = f"{initial_draft_output}\n\n{review_output}\n\n{distribution_output}"
print(
colored(
(
"\nFinal Blog"
f" Content:\n----------------------------\n{final_blog_content}\n"
),
"\nFinal Blog"
f" Content:\n----------------------------\n{final_blog_content}\n",
"green",
)
)
Expand Down
2 changes: 1 addition & 1 deletion playground/demos/developer_swarm/main_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"""

# Initialize the language model
llm = OpenAIChat(openai_api_key=api_key, max_tokens=5000)
llm = OpenAIChat(openai_api_key=api_key, max_tokens=4096)


# Documentation agent
Expand Down
24 changes: 8 additions & 16 deletions playground/demos/grupa/app_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,8 @@ def feature_codebase_product_agentprompt(
)
print(
colored(
(
"---------------------------- Product Manager Plan:"
f" {product_manager_out}"
),
"---------------------------- Product Manager Plan:"
f" {product_manager_out}",
"cyan",
)
)
Expand All @@ -111,10 +109,8 @@ def feature_codebase_product_agentprompt(
)
print(
colored(
(
"--------------------- Feature Implementer Code logic:"
f" {agent1_out}"
),
"--------------------- Feature Implementer Code logic:"
f" {agent1_out}",
"cyan",
)
)
Expand All @@ -125,10 +121,8 @@ def feature_codebase_product_agentprompt(
)
print(
colored(
(
"---------------------------- Tests for the logic:"
f" {tester_agent_out}"
),
"---------------------------- Tests for the logic:"
f" {tester_agent_out}",
"green",
)
)
Expand All @@ -140,10 +134,8 @@ def feature_codebase_product_agentprompt(
)
print(
colored(
(
"---------------------------- Documentation for the"
f" logic: {documenter_agent_out}"
),
"---------------------------- Documentation for the"
f" logic: {documenter_agent_out}",
"yellow",
)
)
30 changes: 10 additions & 20 deletions playground/demos/personal_stylist/personal_stylist_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,43 +66,33 @@

# Run agents with respective tasks
haircut_suggestions = haircut_stylist_agent.run(
(
"Suggest suitable haircuts for this user, considering their"
" face shape and hair type."
),
"Suggest suitable haircuts for this user, considering their"
" face shape and hair type.",
user_selfie,
)

# Run Makeup or Beard agent based on gender
if user_gender == "woman":
makeup_suggestions = makeup_or_beard_stylist_agent.run(
(
"Recommend makeup styles for this user, complementing"
" their features."
),
"Recommend makeup styles for this user, complementing"
" their features.",
user_selfie,
)
elif user_gender == "man":
beard_suggestions = makeup_or_beard_stylist_agent.run(
(
"Provide beard styling advice for this user, considering"
" their face shape."
),
"Provide beard styling advice for this user, considering"
" their face shape.",
user_selfie,
)

clothing_suggestions = clothing_stylist_agent.run(
(
"Match clothing styles and colors for this user, using color"
" matching principles."
),
"Match clothing styles and colors for this user, using color"
" matching principles.",
clothes_image,
)

accessories_suggestions = accessories_stylist_agent.run(
(
"Suggest accessories to complement this user's outfit,"
" considering the overall style."
),
"Suggest accessories to complement this user's outfit,"
" considering the overall style.",
clothes_image,
)
6 changes: 2 additions & 4 deletions playground/demos/urban_planning/urban_planning_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,8 @@
)
workflow.add(
final_plan_agent,
(
"Generate the final urban improvement plan based on all"
" previous agent's findings"
),
"Generate the final urban improvement plan based on all"
" previous agent's findings",
)
# Run the workflow for individual analysis tasks

Expand Down
File renamed without changes.
File renamed without changes.
18 changes: 12 additions & 6 deletions playground/structs/debate_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,12 @@ def bid(self) -> str:
def generate_character_description(character_name):
character_specifier_prompt = [
player_descriptor_system_message,
HumanMessage(content=f"""{game_description}
HumanMessage(
content=f"""{game_description}
Please reply with a creative description of the presidential candidate, {character_name}, in {word_limit} words or less, that emphasizes their personalities.
Speak directly to {character_name}.
Do not add anything else."""),
Do not add anything else."""
),
]
character_description = ChatOpenAI(temperature=1.0)(
character_specifier_prompt
Expand All @@ -164,7 +166,8 @@ def generate_character_header(character_name, character_description):
def generate_character_system_message(
character_name, character_header
):
return SystemMessage(content=f"""{character_header}
return SystemMessage(
content=f"""{character_header}
You will speak in the style of {character_name}, and exaggerate their personality.
You will come up with creative ideas related to {topic}.
Do not say the same things over and over again.
Expand All @@ -176,7 +179,8 @@ def generate_character_system_message(
Stop speaking the moment you finish speaking from your perspective.
Never forget to keep your response to {word_limit} words!
Do not add anything else.
""")
"""
)


character_descriptions = [
Expand Down Expand Up @@ -261,15 +265,17 @@ def generate_character_bidding_template(character_header):

topic_specifier_prompt = [
SystemMessage(content="You can make a task more specific."),
HumanMessage(content=f"""{game_description}
HumanMessage(
content=f"""{game_description}

You are the debate moderator.
Please make the debate topic more specific.
Frame the debate topic as a problem to be solved.
Be creative and imaginative.
Please reply with the specified topic in {word_limit} words or less.
Speak directly to the presidential candidates: {*character_names,}.
Do not add anything else."""),
Do not add anything else."""
),
]
specified_topic = ChatOpenAI(temperature=1.0)(
topic_specifier_prompt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
from swarms import dataframe_to_text

# # Example usage:
df = pd.DataFrame({
'A': [1, 2, 3],
'B': [4, 5, 6],
'C': [7, 8, 9],
})
df = pd.DataFrame(
{
"A": [1, 2, 3],
"B": [4, 5, 6],
"C": [7, 8, 9],
}
)

print(dataframe_to_text(df))
Loading
Loading