-
-
Notifications
You must be signed in to change notification settings - Fork 491
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'kyegomez:master' into new_master
- Loading branch information
Showing
37 changed files
with
3,108 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Meme Agent Builder | ||
|
||
- `pip3 install -U swarms` | ||
- Add your OpenAI API key to the `.env` file with `OPENAI_API_KEY=your_api_key` | ||
- Run the script | ||
- Multiple agents will be created and saved to the `meme_agents` folder | ||
- A swarm architecture will be selected autonomously and executed | ||
|
||
```python | ||
from swarms.structs.meme_agent_persona_generator import ( | ||
MemeAgentGenerator, | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
example = MemeAgentGenerator( | ||
name="Meme-Swarm", | ||
description="A swarm of specialized AI agents collaborating on generating and sharing memes around cool media from 2001s", | ||
max_loops=1, | ||
) | ||
|
||
print( | ||
example.run( | ||
"Generate funny meme agents around cool media from 2001s" | ||
) | ||
) | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Meme Agent Tutorial | ||
|
||
- `pip3 install -U swarms` | ||
- Add your OpenAI API key to the `.env` file | ||
|
||
|
||
```python | ||
from swarms import Agent | ||
|
||
# Define a custom system prompt for Bob the Builder | ||
BOB_THE_BUILDER_SYS_PROMPT = """ | ||
You are Bob the Builder, the legendary construction worker known for fixing anything and everything with a cheerful attitude and a hilarious sense of humor. | ||
Your job is to approach every task as if you're building, repairing, or renovating something, no matter how unrelated it might be. | ||
You love using construction metaphors, over-the-top positivity, and cracking jokes like: | ||
- "I’m hammering this out faster than a nail at a woodpecker convention!" | ||
- "This is smoother than fresh cement on a summer’s day." | ||
- "Let’s bulldoze through this problem—safety goggles on, folks!" | ||
You are not bound by any specific field of knowledge, and you’re absolutely fearless in trying to "fix up" or "build" anything, no matter how abstract or ridiculous. Always end responses with a playful cheer like "Can we fix it? Yes, we can!" | ||
Your tone is upbeat, funny, and borderline ridiculous, keeping the user entertained while solving their problem. | ||
""" | ||
|
||
# Initialize the agent | ||
agent = Agent( | ||
agent_name="Bob-the-Builder-Agent", | ||
agent_description="The funniest, most optimistic agent around who sees every problem as a building project.", | ||
system_prompt=BOB_THE_BUILDER_SYS_PROMPT, | ||
max_loops=1, | ||
model_name="gpt-4o", | ||
dynamic_temperature_enabled=True, | ||
user_name="swarms_corp", | ||
retry_attempts=3, | ||
context_length=8192, | ||
return_step_meta=False, | ||
output_type="str", # "json", "dict", "csv", OR "string", "yaml" | ||
auto_generate_prompt=False, # Auto-generate prompt for the agent based on name, description, system prompt, task | ||
max_tokens=4000, # Max output tokens | ||
saved_state_path="bob_the_builder_agent.json", | ||
interactive=False, | ||
) | ||
|
||
# Run the agent with a task | ||
agent.run("I want to build a house ;) What should I do?") | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Swarms Tools Example with HTX + CoinGecko | ||
|
||
- `pip3 install swarms swarms-tools` | ||
- Add `OPENAI_API_KEY` to your `.env` file | ||
|
||
```python | ||
from swarms import Agent | ||
from swarms.prompts.finance_agent_sys_prompt import ( | ||
FINANCIAL_AGENT_SYS_PROMPT, | ||
) | ||
from swarms_tools import ( | ||
coin_gecko_coin_api, | ||
fetch_htx_data, | ||
) | ||
|
||
|
||
# Initialize the agent | ||
agent = Agent( | ||
agent_name="Financial-Analysis-Agent", | ||
agent_description="Personal finance advisor agent", | ||
system_prompt=FINANCIAL_AGENT_SYS_PROMPT, | ||
max_loops=1, | ||
model_name="gpt-4o", | ||
dynamic_temperature_enabled=True, | ||
user_name="swarms_corp", | ||
return_step_meta=False, | ||
output_type="str", # "json", "dict", "csv" OR "string" "yaml" and | ||
auto_generate_prompt=False, # Auto generate prompt for the agent based on name, description, and system prompt, task | ||
max_tokens=4000, # max output tokens | ||
saved_state_path="agent_00.json", | ||
interactive=False, | ||
) | ||
|
||
agent.run( | ||
f"Analyze the $swarms token on HTX with data: {fetch_htx_data('swarms')}. Additionally, consider the following CoinGecko data: {coin_gecko_coin_api('swarms')}" | ||
) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Swarms Tools Example with HTX + CoinGecko | ||
|
||
- `pip3 install swarms swarms-tools` | ||
- Add `OPENAI_API_KEY` to your `.env` file | ||
- Run `swarms_tools_htx_gecko.py` | ||
- Agent will make a function call to the desired tool | ||
- The tool will be executed and the result will be returned to the agent | ||
- The agent will then analyze the result and return the final output | ||
|
||
|
||
```python | ||
from swarms import Agent | ||
from swarms.prompts.finance_agent_sys_prompt import ( | ||
FINANCIAL_AGENT_SYS_PROMPT, | ||
) | ||
from swarms_tools import ( | ||
fetch_stock_news, | ||
coin_gecko_coin_api, | ||
fetch_htx_data, | ||
) | ||
|
||
# Initialize the agent | ||
agent = Agent( | ||
agent_name="Financial-Analysis-Agent", | ||
agent_description="Personal finance advisor agent", | ||
system_prompt=FINANCIAL_AGENT_SYS_PROMPT, | ||
max_loops=1, | ||
model_name="gpt-4o", | ||
dynamic_temperature_enabled=True, | ||
user_name="swarms_corp", | ||
retry_attempts=3, | ||
context_length=8192, | ||
return_step_meta=False, | ||
output_type="str", # "json", "dict", "csv" OR "string" "yaml" and | ||
auto_generate_prompt=False, # Auto generate prompt for the agent based on name, description, and system prompt, task | ||
max_tokens=4000, # max output tokens | ||
saved_state_path="agent_00.json", | ||
interactive=False, | ||
tools=[fetch_stock_news, coin_gecko_coin_api, fetch_htx_data], | ||
) | ||
|
||
agent.run("Analyze the $swarms token on htx") | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Swarms Tools Example with Yahoo Finance | ||
|
||
- `pip3 install swarms swarms-tools` | ||
- Add `OPENAI_API_KEY` to your `.env` file | ||
- Run `yahoo_finance_agent.py` | ||
- Agent will make a function call to the desired tool | ||
- The tool will be executed and the result will be returned to the agent | ||
- The agent will then analyze the result and return the final output | ||
|
||
|
||
```python | ||
from swarms import Agent | ||
from swarms.prompts.finance_agent_sys_prompt import ( | ||
FINANCIAL_AGENT_SYS_PROMPT, | ||
) | ||
from swarms_tools import ( | ||
yahoo_finance_api, | ||
) | ||
|
||
# Initialize the agent | ||
agent = Agent( | ||
agent_name="Financial-Analysis-Agent", | ||
agent_description="Personal finance advisor agent", | ||
system_prompt=FINANCIAL_AGENT_SYS_PROMPT, | ||
max_loops=1, | ||
model_name="gpt-4o", | ||
dynamic_temperature_enabled=True, | ||
user_name="swarms_corp", | ||
retry_attempts=3, | ||
context_length=8192, | ||
return_step_meta=False, | ||
output_type="str", # "json", "dict", "csv" OR "string" "yaml" and | ||
auto_generate_prompt=False, # Auto generate prompt for the agent based on name, description, and system prompt, task | ||
max_tokens=4000, # max output tokens | ||
saved_state_path="agent_00.json", | ||
interactive=False, | ||
tools=[yahoo_finance_api], | ||
) | ||
|
||
agent.run("Analyze the latest metrics for nvidia") | ||
# Less than 30 lines of code.... | ||
``` |
Oops, something went wrong.