Skip to content

Commit

Permalink
[DOCS][CLEANUP]
Browse files Browse the repository at this point in the history
  • Loading branch information
kyegomez committed Dec 23, 2024
1 parent c3ba9e5 commit b1834a6
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 25 deletions.
56 changes: 56 additions & 0 deletions crypto_tax.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import os
from dotenv import load_dotenv
from swarm_models import OpenAIChat
from swarms import Agent, GroupChat, expertise_based

if __name__ == "__main__":

load_dotenv()

# Get the OpenAI API key from the environment variable
api_key = os.getenv("GROQ_API_KEY")

# Model
model = OpenAIChat(
openai_api_base="https://api.groq.com/openai/v1",
openai_api_key=api_key,
model_name="llama-3.1-70b-versatile",
temperature=0.1,
)

# Example agents
agent1 = Agent(
agent_name="Crypto-Tax-Optimization-Agent",
system_prompt="You are a friendly tax expert specializing in cryptocurrency investments. Provide approachable insights on optimizing tax savings for crypto transactions.",
llm=model,
max_loops=1,
dynamic_temperature_enabled=True,
user_name="User",
output_type="string",
streaming_on=True,
)

agent2 = Agent(
agent_name="Crypto-Investment-Strategies-Agent",
system_prompt="You are a conversational financial analyst focused on cryptocurrency investments. Offer debatable advice on investment strategies that minimize tax liabilities.",
llm=model,
max_loops=1,
dynamic_temperature_enabled=True,
user_name="User",
output_type="string",
streaming_on=True,
)

agents = [agent1, agent2]

chat = GroupChat(
name="Crypto Tax Optimization Debate",
description="Debate on optimizing tax savings for cryptocurrency transactions and investments",
agents=agents,
speaker_fn=expertise_based,
)

history = chat.run(
"How can one optimize tax savings for cryptocurrency transactions and investments? I bought some Bitcoin and Ethereum last year and want to minimize my tax liabilities this year."
)
print(history.model_dump_json(indent=2))
42 changes: 23 additions & 19 deletions group_chat_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,58 +10,62 @@
load_dotenv()

# Get the OpenAI API key from the environment variable
api_key = os.getenv("OPENAI_API_KEY")
api_key = os.getenv("GROQ_API_KEY")

# Create an instance of the OpenAIChat class
# Model
model = OpenAIChat(
openai_api_base="https://api.groq.com/openai/v1",
openai_api_key=api_key,
model_name="gpt-4o-mini",
model_name="llama-3.1-70b-versatile",
temperature=0.1,
)

# Example agents
agent1 = Agent(
agent_name="Financial-Analysis-Agent",
system_prompt="You are a financial analyst specializing in investment strategies.",
system_prompt="You are a friendly financial analyst specializing in investment strategies. Be approachable and conversational.",
llm=model,
max_loops=1,
autosave=False,
dashboard=False,
verbose=True,
dynamic_temperature_enabled=True,
user_name="swarms_corp",
retry_attempts=1,
context_length=200000,
output_type="string",
streaming_on=False,
streaming_on=True,
)

agent2 = Agent(
agent_name="Tax-Adviser-Agent",
system_prompt="You are a tax adviser who provides clear and concise guidance on tax-related queries.",
system_prompt="You are a tax adviser who provides clear, concise, and approachable guidance on tax-related queries.",
llm=model,
max_loops=1,
autosave=False,
dashboard=False,
verbose=True,
dynamic_temperature_enabled=True,
user_name="swarms_corp",
retry_attempts=1,
context_length=200000,
output_type="string",
streaming_on=False,
streaming_on=True,
)

# agent3 = Agent(
# agent_name="Stock-Buying-Agent",
# system_prompt="You are a stock market expert who provides insights on buying and selling stocks. Be informative and concise.",
# llm=model,
# max_loops=1,
# dynamic_temperature_enabled=True,
# user_name="swarms_corp",
# retry_attempts=1,
# context_length=200000,
# output_type="string",
# streaming_on=True,
# )

agents = [agent1, agent2]

chat = GroupChat(
name="Investment Advisory",
description="Financial and tax analysis group",
description="Financial, tax, and stock analysis group",
agents=agents,
speaker_fn=expertise_based,
)

history = chat.run(
"How to optimize tax strategy for investments?"
"How to save on taxes for stocks, ETFs, and mutual funds?"
)
print(history.model_dump_json(indent=2))
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "swarms"
version = "6.7.6"
version = "6.7.7"
description = "Swarms - TGSC"
license = "MIT"
authors = ["Kye Gomez <[email protected]>"]
Expand Down
2 changes: 1 addition & 1 deletion swarm_arange_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,6 @@

print(
swarm_arrange.run(
"Analyze swarms, 150k revenue with 45m+ agents build, with 1.4m downloads since march 2024"
"Analyze AI ETFs, focusing on their performance, market trends, and potential for growth"
)
)
2 changes: 2 additions & 0 deletions swarms/structs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
ChatHistory,
ChatTurn,
AgentResponse,
expertise_based
)
from swarms.structs.majority_voting import (
MajorityVoting,
Expand Down Expand Up @@ -152,4 +153,5 @@
"ChatHistory",
"ChatTurn",
"AgentResponse",
"expertise_based",
]
5 changes: 1 addition & 4 deletions swarms/structs/spreadsheet_swarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@

# --------------- NEW CHANGE START ---------------
# Format time variable to be compatible across operating systems
formatted_time = datetime.now().strftime("%Y-%m-%dT%H-%M-%S")

# Create the save file path with the formatted time and UUID hex
self.save_file_path = f"spreadsheet_swarm_{formatted_time}_run_id_{uuid_hex}.csv"
formatted_time = datetime.datetime.now().strftime("%Y-%m-%dT%H-%M-%S")
# --------------- NEW CHANGE END ---------------

class AgentOutput(BaseModel):
Expand Down

0 comments on commit b1834a6

Please sign in to comment.