From afd54194821c3c1ba9b92bc450590d065c4cfff1 Mon Sep 17 00:00:00 2001 From: Kye Gomez <98760976+kyegomez@users.noreply.github.com> Date: Wed, 8 Jan 2025 14:53:31 -0500 Subject: [PATCH 01/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2fd3d292d..d87eac7d9 100644 --- a/README.md +++ b/README.md @@ -2022,7 +2022,7 @@ Accelerate Bugs, Features, and Demos to implement by supporting us here: Join our growing community around the world, for real-time support, ideas, and discussions on Swarms 😊 - View our official [Blog](https://docs.swarms.world) -- Chat live with us on [Discord](https://discord.gg/kS3rwKs3ZC) +- Chat live with us on [Discord](https://discord.gg/jM3Z6M9uMq) - Follow us on [Twitter](https://twitter.com/kyegomez) - Connect with us on [LinkedIn](https://www.linkedin.com/company/the-swarm-corporation) - Visit us on [YouTube](https://www.youtube.com/channel/UC9yXyitkbU_WSy7bd_41SqQ) From 9784d697d04429725985a303bb247ab5edce48e9 Mon Sep 17 00:00:00 2001 From: Kye Gomez Date: Thu, 9 Jan 2025 15:09:24 -0500 Subject: [PATCH 02/11] Triggering CI/CD pipeline --- test_github.py | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 test_github.py diff --git a/test_github.py b/test_github.py new file mode 100644 index 000000000..3b369fb7c --- /dev/null +++ b/test_github.py @@ -0,0 +1,58 @@ +import requests +import datetime + +# Replace these with your repository and token details +GITHUB_TOKEN = "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" +REPO_OWNER = "kyegomez" +REPO_NAME = "swarms" + +# GitHub API headers +HEADERS = { + "Authorization": f"token {GITHUB_TOKEN}", + "Accept": "application/vnd.github.v3+json", +} + +# Get today's date +today = datetime.date.today() + +# Fetch closed PRs +def get_closed_prs(): + url = f"https://api.github.com/repos/{REPO_OWNER}/{REPO_NAME}/pulls" + params = { + "state": "closed", + "sort": "updated", + "direction": "desc", + } + response = requests.get(url, headers=HEADERS, params=params) + response.raise_for_status() + prs = response.json() + + # Filter PRs closed today + closed_today = [ + pr for pr in prs if pr["closed_at"] and pr["closed_at"].startswith(today.isoformat()) + ] + return closed_today + +# Reopen a PR +def reopen_pr(pr_number): + url = f"https://api.github.com/repos/{REPO_OWNER}/{REPO_NAME}/pulls/{pr_number}" + data = {"state": "open"} + response = requests.patch(url, headers=HEADERS, json=data) + if response.status_code == 200: + print(f"Successfully reopened PR #{pr_number}") + else: + print(f"Failed to reopen PR #{pr_number}: {response.status_code} - {response.text}") + +# Main function +def main(): + closed_prs = get_closed_prs() + if not closed_prs: + print("No PRs closed today.") + return + + print(f"Found {len(closed_prs)} PR(s) closed today. Reopening them...") + for pr in closed_prs: + reopen_pr(pr["number"]) + +if __name__ == "__main__": + main() From 8733e79e89a7b53409c0e5e377eeb8a58e1bc31f Mon Sep 17 00:00:00 2001 From: Kye Gomez Date: Thu, 9 Jan 2025 15:09:44 -0500 Subject: [PATCH 03/11] Triggering CI/CD pipeline --- test_github.py | 58 -------------------------------------------------- 1 file changed, 58 deletions(-) delete mode 100644 test_github.py diff --git a/test_github.py b/test_github.py deleted file mode 100644 index 3b369fb7c..000000000 --- a/test_github.py +++ /dev/null @@ -1,58 +0,0 @@ -import requests -import datetime - -# Replace these with your repository and token details -GITHUB_TOKEN = "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" -REPO_OWNER = "kyegomez" -REPO_NAME = "swarms" - -# GitHub API headers -HEADERS = { - "Authorization": f"token {GITHUB_TOKEN}", - "Accept": "application/vnd.github.v3+json", -} - -# Get today's date -today = datetime.date.today() - -# Fetch closed PRs -def get_closed_prs(): - url = f"https://api.github.com/repos/{REPO_OWNER}/{REPO_NAME}/pulls" - params = { - "state": "closed", - "sort": "updated", - "direction": "desc", - } - response = requests.get(url, headers=HEADERS, params=params) - response.raise_for_status() - prs = response.json() - - # Filter PRs closed today - closed_today = [ - pr for pr in prs if pr["closed_at"] and pr["closed_at"].startswith(today.isoformat()) - ] - return closed_today - -# Reopen a PR -def reopen_pr(pr_number): - url = f"https://api.github.com/repos/{REPO_OWNER}/{REPO_NAME}/pulls/{pr_number}" - data = {"state": "open"} - response = requests.patch(url, headers=HEADERS, json=data) - if response.status_code == 200: - print(f"Successfully reopened PR #{pr_number}") - else: - print(f"Failed to reopen PR #{pr_number}: {response.status_code} - {response.text}") - -# Main function -def main(): - closed_prs = get_closed_prs() - if not closed_prs: - print("No PRs closed today.") - return - - print(f"Found {len(closed_prs)} PR(s) closed today. Reopening them...") - for pr in closed_prs: - reopen_pr(pr["number"]) - -if __name__ == "__main__": - main() From 88ebf262b32966378f2099a75d9dc425c8494cb3 Mon Sep 17 00:00:00 2001 From: Kye Gomez Date: Thu, 9 Jan 2025 15:11:32 -0500 Subject: [PATCH 04/11] [EXAMPLES CLEANUP] --- csvagent_example.py => new_features_examples/csvagent_example.py | 0 .../graph_swarm_example.py | 0 .../multi_agent_router_example.py | 0 .../unique_swarms_examples.py | 0 run_all_tests.py => tests/run_all_tests.py | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename csvagent_example.py => new_features_examples/csvagent_example.py (100%) rename graph_swarm_example.py => new_features_examples/graph_swarm_example.py (100%) rename multi_agent_router_example.py => new_features_examples/multi_agent_router_example.py (100%) rename unique_swarms_examples.py => new_features_examples/unique_swarms_examples.py (100%) rename run_all_tests.py => tests/run_all_tests.py (100%) diff --git a/csvagent_example.py b/new_features_examples/csvagent_example.py similarity index 100% rename from csvagent_example.py rename to new_features_examples/csvagent_example.py diff --git a/graph_swarm_example.py b/new_features_examples/graph_swarm_example.py similarity index 100% rename from graph_swarm_example.py rename to new_features_examples/graph_swarm_example.py diff --git a/multi_agent_router_example.py b/new_features_examples/multi_agent_router_example.py similarity index 100% rename from multi_agent_router_example.py rename to new_features_examples/multi_agent_router_example.py diff --git a/unique_swarms_examples.py b/new_features_examples/unique_swarms_examples.py similarity index 100% rename from unique_swarms_examples.py rename to new_features_examples/unique_swarms_examples.py diff --git a/run_all_tests.py b/tests/run_all_tests.py similarity index 100% rename from run_all_tests.py rename to tests/run_all_tests.py From 33e01f28ee38c01bc34683f469f29603e72b87b6 Mon Sep 17 00:00:00 2001 From: Kye Gomez Date: Thu, 9 Jan 2025 18:52:47 -0500 Subject: [PATCH 05/11] [EXAMPLES WITH VARIOUS MODELS] --- deepseek_example.py | 70 +++++++++++++++++++++++ docs/mkdocs.yml | 4 ++ docs/swarms/examples/claude.md | 26 +++++++++ docs/swarms/examples/groq.md | 47 +++++++++++++++ docs/swarms/examples/openai_example.md | 13 +++++ new_features_examples/csvagent_example.py | 5 +- swarms/structs/csv_to_agent.py | 23 +++++--- swarms/structs/graph_swarm.py | 2 +- swarms/telemetry/bootup.py | 4 -- 9 files changed, 181 insertions(+), 13 deletions(-) create mode 100644 deepseek_example.py create mode 100644 docs/swarms/examples/claude.md create mode 100644 docs/swarms/examples/groq.md create mode 100644 docs/swarms/examples/openai_example.md diff --git a/deepseek_example.py b/deepseek_example.py new file mode 100644 index 000000000..f1f34e7a2 --- /dev/null +++ b/deepseek_example.py @@ -0,0 +1,70 @@ +import os + +from dotenv import load_dotenv +from openai import OpenAI + +from swarms import Agent +from swarms.prompts.finance_agent_sys_prompt import ( + FINANCIAL_AGENT_SYS_PROMPT, +) + +load_dotenv() + + +class DeepSeekChat: + def __init__( + self, + api_key: str = os.getenv("DEEPSEEK_API_KEY"), + system_prompt: str = None, + ): + self.api_key = api_key + + self.client = OpenAI( + api_key=api_key, base_url="https://api.deepseek.com" + ) + + def run(self, task: str): + response = self.client.chat.completions.create( + model="deepseek-chat", + messages=[ + { + "role": "system", + "content": "You are a helpful assistant", + }, + {"role": "user", "content": task}, + ], + stream=False, + ) + + print(response) + + out = response.choices[0].message.content + print(out) + + return out + + +model = DeepSeekChat() + +# 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, + llm=model, + 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 +) + +print( + agent.run( + "Create a table of super high growth opportunities for AI. I have $40k to invest in ETFs, index funds, and more. Please create a table in markdown.", + ) +) diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 119fdeb78..0d608eaf4 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -199,6 +199,10 @@ nav: - Full API Reference: "swarms/framework/reference.md" - Examples: - Unique Swarms: "swarms/examples/unique_swarms.md" + - Various Model Providers: + - OpenAI: "swarms/examples/openai_example.md" + - Anthropic: "swarms/examples/claude.md" + - Groq: "swarms/examples/groq.md" - Swarm Models: - Overview: "swarms/models/index.md" # - Models Available: "swarms/models/index.md" diff --git a/docs/swarms/examples/claude.md b/docs/swarms/examples/claude.md new file mode 100644 index 000000000..5890c4fc6 --- /dev/null +++ b/docs/swarms/examples/claude.md @@ -0,0 +1,26 @@ +# Agent with Anthropic/Claude + +- Get their api keys and put it in the `.env` +- Select your model_name like `claude-3-sonnet-20240229` follows LiteLLM conventions + + +```python +from swarms import Agent +import os +from dotenv import load_dotenv + +load_dotenv() + +# Initialize the agent with ChromaDB memory +agent = Agent( + agent_name="Financial-Analysis-Agent", + model_name="claude-3-sonnet-20240229", + system_prompt="Agent system prompt here", + agent_description="Agent performs financial analysis.", + llm=model, + long_term_memory=chromadb_memory, +) + +# Run a query +agent.run("What are the components of a startup's stock incentive equity plan?") +``` \ No newline at end of file diff --git a/docs/swarms/examples/groq.md b/docs/swarms/examples/groq.md new file mode 100644 index 000000000..928a92903 --- /dev/null +++ b/docs/swarms/examples/groq.md @@ -0,0 +1,47 @@ +# Agent with Groq + + +```python +import os + +from swarm_models import OpenAIChat + +from swarms import Agent + +company = "NVDA" + +# 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, +) + + +# Initialize the Managing Director agent +managing_director = Agent( + agent_name="Managing-Director", + system_prompt=f""" + As the Managing Director at Blackstone, your role is to oversee the entire investment analysis process for potential acquisitions. + Your responsibilities include: + 1. Setting the overall strategy and direction for the analysis + 2. Coordinating the efforts of the various team members and ensuring a comprehensive evaluation + 3. Reviewing the findings and recommendations from each team member + 4. Making the final decision on whether to proceed with the acquisition + + For the current potential acquisition of {company}, direct the tasks for the team to thoroughly analyze all aspects of the company, including its financials, industry position, technology, market potential, and regulatory compliance. Provide guidance and feedback as needed to ensure a rigorous and unbiased assessment. + """, + llm=model, + max_loops=1, + dashboard=False, + streaming_on=True, + verbose=True, + stopping_token="", + state_save_file_type="json", + saved_state_path="managing-director.json", +) +``` \ No newline at end of file diff --git a/docs/swarms/examples/openai_example.md b/docs/swarms/examples/openai_example.md new file mode 100644 index 000000000..0741a1203 --- /dev/null +++ b/docs/swarms/examples/openai_example.md @@ -0,0 +1,13 @@ +# Agent with GPT-4o-Mini + +```python +from swarms import Agent + +Agent( + agent_name="Stock-Analysis-Agent", + model_name="gpt-4o-mini", + max_loops="auto", + interactive=True, + streaming_on=True, +).run("What are 5 hft algorithms") +``` \ No newline at end of file diff --git a/new_features_examples/csvagent_example.py b/new_features_examples/csvagent_example.py index e781335a1..f47ae9057 100644 --- a/new_features_examples/csvagent_example.py +++ b/new_features_examples/csvagent_example.py @@ -1,6 +1,9 @@ # Example usage from pathlib import Path -from swarms.structs.csv_to_agent import AgentLoader, AgentValidationError +from swarms.structs.csv_to_agent import ( + AgentLoader, + AgentValidationError, +) if __name__ == "__main__": diff --git a/swarms/structs/csv_to_agent.py b/swarms/structs/csv_to_agent.py index aa6fdf73c..624e35774 100644 --- a/swarms/structs/csv_to_agent.py +++ b/swarms/structs/csv_to_agent.py @@ -136,6 +136,7 @@ def validate_config(config: Dict[str, Any]) -> AgentConfigDict: str(e), str(e.__class__.__name__), str(config) ) + class AgentLoader: """Class to manage agents through CSV with type safety""" @@ -202,7 +203,9 @@ def load_agents(self, file_type: str = "csv") -> List[Agent]: elif file_type == "json": return self._load_agents_from_json() else: - raise ValueError("Unsupported file type. Use 'csv' or 'json'.") + raise ValueError( + "Unsupported file type. Use 'csv' or 'json'." + ) def _load_agents_from_csv(self) -> List[Agent]: """Load agents from a CSV file""" @@ -229,13 +232,13 @@ def _load_agents_from_json(self) -> List[Agent]: """Load agents from a JSON file""" import json - if not self.csv_path.with_suffix('.json').exists(): + if not self.csv_path.with_suffix(".json").exists(): raise FileNotFoundError( f"JSON file not found at {self.csv_path.with_suffix('.json')}" ) agents: List[Agent] = [] - with open(self.csv_path.with_suffix('.json'), "r") as f: + with open(self.csv_path.with_suffix(".json"), "r") as f: agents_data = json.load(f) for agent in agents_data: try: @@ -250,10 +253,14 @@ def _load_agents_from_json(self) -> List[Agent]: ) continue - print(f"Loaded {len(agents)} agents from {self.csv_path.with_suffix('.json')}") + print( + f"Loaded {len(agents)} agents from {self.csv_path.with_suffix('.json')}" + ) return agents - def _create_agent(self, validated_config: AgentConfigDict) -> Agent: + def _create_agent( + self, validated_config: AgentConfigDict + ) -> Agent: """Create an Agent instance from validated configuration""" return Agent( agent_name=validated_config["agent_name"], @@ -263,7 +270,9 @@ def _create_agent(self, validated_config: AgentConfigDict) -> Agent: autosave=validated_config["autosave"], dashboard=validated_config["dashboard"], verbose=validated_config["verbose"], - dynamic_temperature_enabled=validated_config["dynamic_temperature"], + dynamic_temperature_enabled=validated_config[ + "dynamic_temperature" + ], saved_state_path=validated_config["saved_state_path"], user_name=validated_config["user_name"], retry_attempts=validated_config["retry_attempts"], @@ -271,4 +280,4 @@ def _create_agent(self, validated_config: AgentConfigDict) -> Agent: return_step_meta=validated_config["return_step_meta"], output_type=validated_config["output_type"], streaming_on=validated_config["streaming"], - ) \ No newline at end of file + ) diff --git a/swarms/structs/graph_swarm.py b/swarms/structs/graph_swarm.py index 70f2323eb..e67add52f 100644 --- a/swarms/structs/graph_swarm.py +++ b/swarms/structs/graph_swarm.py @@ -190,7 +190,7 @@ class GraphSwarm: def __init__( self, name: str = "graph-swarm-01", - description: str = "Graph swarm : build your own graph of agents", + description: str = "Graph swarm : build your own graph of agents", agents: Union[ List[Agent], List[Tuple[Agent, List[str]]], List[Callable] ] = None, diff --git a/swarms/telemetry/bootup.py b/swarms/telemetry/bootup.py index 1f2acd5aa..edb491335 100644 --- a/swarms/telemetry/bootup.py +++ b/swarms/telemetry/bootup.py @@ -54,7 +54,3 @@ def bootup(): except Exception as e: logger.error(f"Error during bootup: {str(e)}") raise - - -# Run bootup -bootup() From f999f6942a9c06908ecce4f3f8498a341c039135 Mon Sep 17 00:00:00 2001 From: Kye Gomez Date: Thu, 9 Jan 2025 19:00:04 -0500 Subject: [PATCH 06/11] [DOCS][Cohere Example] --- docs/swarms/examples/claude.md | 1 - docs/swarms/examples/cohere.md | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 docs/swarms/examples/cohere.md diff --git a/docs/swarms/examples/claude.md b/docs/swarms/examples/claude.md index 5890c4fc6..4ed443ff4 100644 --- a/docs/swarms/examples/claude.md +++ b/docs/swarms/examples/claude.md @@ -18,7 +18,6 @@ agent = Agent( system_prompt="Agent system prompt here", agent_description="Agent performs financial analysis.", llm=model, - long_term_memory=chromadb_memory, ) # Run a query diff --git a/docs/swarms/examples/cohere.md b/docs/swarms/examples/cohere.md new file mode 100644 index 000000000..6f7d8acf0 --- /dev/null +++ b/docs/swarms/examples/cohere.md @@ -0,0 +1,25 @@ +# Agent with Cohere + +- Add your `COHERE_API_KEY` in the `.env` file +- Select your model_name like `command-r` follows LiteLLM conventions + + +```python +from swarms import Agent +import os +from dotenv import load_dotenv + +load_dotenv() + +# Initialize the agent with ChromaDB memory +agent = Agent( + agent_name="Financial-Analysis-Agent", + model_name="command-r", + system_prompt="Agent system prompt here", + agent_description="Agent performs financial analysis.", + llm=model, +) + +# Run a query +agent.run("What are the components of a startup's stock incentive equity plan?") +``` \ No newline at end of file From bbdeddd166f8bea00b0dcfd37be4fd34bd4c36bf Mon Sep 17 00:00:00 2001 From: Kye Gomez Date: Thu, 9 Jan 2025 19:01:31 -0500 Subject: [PATCH 07/11] [DOCS][Cohere Example] --- docs/swarms/examples/claude.md | 1 - docs/swarms/examples/cohere.md | 1 - docs/swarms/examples/deepseek.md | 25 +++++++++++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 docs/swarms/examples/deepseek.md diff --git a/docs/swarms/examples/claude.md b/docs/swarms/examples/claude.md index 4ed443ff4..a1c4fde0d 100644 --- a/docs/swarms/examples/claude.md +++ b/docs/swarms/examples/claude.md @@ -17,7 +17,6 @@ agent = Agent( model_name="claude-3-sonnet-20240229", system_prompt="Agent system prompt here", agent_description="Agent performs financial analysis.", - llm=model, ) # Run a query diff --git a/docs/swarms/examples/cohere.md b/docs/swarms/examples/cohere.md index 6f7d8acf0..ee6ad392c 100644 --- a/docs/swarms/examples/cohere.md +++ b/docs/swarms/examples/cohere.md @@ -17,7 +17,6 @@ agent = Agent( model_name="command-r", system_prompt="Agent system prompt here", agent_description="Agent performs financial analysis.", - llm=model, ) # Run a query diff --git a/docs/swarms/examples/deepseek.md b/docs/swarms/examples/deepseek.md new file mode 100644 index 000000000..418fdf345 --- /dev/null +++ b/docs/swarms/examples/deepseek.md @@ -0,0 +1,25 @@ +# Agent with DeepSeek + +- Add your `DEEPSEEK_API_KEY` in the `.env` file +- Select your model_name like `deepseek/deepseek-chat` follows [LiteLLM conventions](https://docs.litellm.ai/docs/providers/deepseek) +- Execute your agent! + + +```python +from swarms import Agent +import os +from dotenv import load_dotenv + +load_dotenv() + +# Initialize the agent with ChromaDB memory +agent = Agent( + agent_name="Financial-Analysis-Agent", + model_name="deepseek/deepseek-chat", + system_prompt="Agent system prompt here", + agent_description="Agent performs financial analysis.", +) + +# Run a query +agent.run("What are the components of a startup's stock incentive equity plan?") +``` \ No newline at end of file From e15bd0628b29c7c71f92bc67bd48d23602b4faa9 Mon Sep 17 00:00:00 2001 From: Kye Gomez Date: Thu, 9 Jan 2025 19:03:55 -0500 Subject: [PATCH 08/11] [DOCS][Model Examples] --- docs/swarms/examples/claude.md | 1 + docs/swarms/examples/cohere.md | 1 + docs/swarms/examples/deepseek.md | 2 ++ docs/swarms/examples/groq.md | 1 + docs/swarms/examples/ollama.md | 24 ++++++++++++++++++++++++ docs/swarms/examples/openai_example.md | 3 +++ 6 files changed, 32 insertions(+) create mode 100644 docs/swarms/examples/ollama.md diff --git a/docs/swarms/examples/claude.md b/docs/swarms/examples/claude.md index a1c4fde0d..75cb85c81 100644 --- a/docs/swarms/examples/claude.md +++ b/docs/swarms/examples/claude.md @@ -1,6 +1,7 @@ # Agent with Anthropic/Claude - Get their api keys and put it in the `.env` + - Select your model_name like `claude-3-sonnet-20240229` follows LiteLLM conventions diff --git a/docs/swarms/examples/cohere.md b/docs/swarms/examples/cohere.md index ee6ad392c..9f2a0eb99 100644 --- a/docs/swarms/examples/cohere.md +++ b/docs/swarms/examples/cohere.md @@ -1,6 +1,7 @@ # Agent with Cohere - Add your `COHERE_API_KEY` in the `.env` file + - Select your model_name like `command-r` follows LiteLLM conventions diff --git a/docs/swarms/examples/deepseek.md b/docs/swarms/examples/deepseek.md index 418fdf345..7b4769b21 100644 --- a/docs/swarms/examples/deepseek.md +++ b/docs/swarms/examples/deepseek.md @@ -1,7 +1,9 @@ # Agent with DeepSeek - Add your `DEEPSEEK_API_KEY` in the `.env` file + - Select your model_name like `deepseek/deepseek-chat` follows [LiteLLM conventions](https://docs.litellm.ai/docs/providers/deepseek) + - Execute your agent! diff --git a/docs/swarms/examples/groq.md b/docs/swarms/examples/groq.md index 928a92903..d9dd23a29 100644 --- a/docs/swarms/examples/groq.md +++ b/docs/swarms/examples/groq.md @@ -1,5 +1,6 @@ # Agent with Groq +- Add your `GROQ_API_KEY` ```python import os diff --git a/docs/swarms/examples/ollama.md b/docs/swarms/examples/ollama.md new file mode 100644 index 000000000..9e019167c --- /dev/null +++ b/docs/swarms/examples/ollama.md @@ -0,0 +1,24 @@ +# Agent with Ollama + +- No API key needed +- Select your model_name like `ollama/llama2` follows [LiteLLM conventions](https://docs.litellm.ai/docs/providers/ollama) + + +```python +from swarms import Agent +import os +from dotenv import load_dotenv + +load_dotenv() + +# Initialize the agent with ChromaDB memory +agent = Agent( + agent_name="Financial-Analysis-Agent", + model_name="ollama/llama2", + system_prompt="Agent system prompt here", + agent_description="Agent performs financial analysis.", +) + +# Run a query +agent.run("What are the components of a startup's stock incentive equity plan?") +``` \ No newline at end of file diff --git a/docs/swarms/examples/openai_example.md b/docs/swarms/examples/openai_example.md index 0741a1203..181c00391 100644 --- a/docs/swarms/examples/openai_example.md +++ b/docs/swarms/examples/openai_example.md @@ -1,5 +1,8 @@ # Agent with GPT-4o-Mini +- Add `OPENAI_API_KEY="your_key"` to your `.env` file +- Select your model like `gpt-4o-mini` or `gpt-4o` + ```python from swarms import Agent From a4fe0a0c2e31b5825e9e947158c4a089bcd34450 Mon Sep 17 00:00:00 2001 From: Kye Gomez Date: Thu, 9 Jan 2025 19:07:28 -0500 Subject: [PATCH 09/11] [MODEL DOCS] --- docs/swarms/examples/openrouter.md | 27 +++++++++++++++++++++++++++ docs/swarms/examples/xai.md | 27 +++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 docs/swarms/examples/openrouter.md create mode 100644 docs/swarms/examples/xai.md diff --git a/docs/swarms/examples/openrouter.md b/docs/swarms/examples/openrouter.md new file mode 100644 index 000000000..2c3f1402d --- /dev/null +++ b/docs/swarms/examples/openrouter.md @@ -0,0 +1,27 @@ +# Agent with XAI + +- Add your `OPENROUTER_API_KEY` in the `.env` file + +- Select your model_name like `openrouter/google/palm-2-chat-bison` follows [LiteLLM conventions](https://docs.litellm.ai/docs/providers/openrouter) + +- Execute your agent! + + +```python +from swarms import Agent +import os +from dotenv import load_dotenv + +load_dotenv() + +# Initialize the agent with ChromaDB memory +agent = Agent( + agent_name="Financial-Analysis-Agent", + model_name="openrouter/google/palm-2-chat-bison", + system_prompt="Agent system prompt here", + agent_description="Agent performs financial analysis.", +) + +# Run a query +agent.run("What are the components of a startup's stock incentive equity plan?") +``` \ No newline at end of file diff --git a/docs/swarms/examples/xai.md b/docs/swarms/examples/xai.md new file mode 100644 index 000000000..47acfec9e --- /dev/null +++ b/docs/swarms/examples/xai.md @@ -0,0 +1,27 @@ +# Agent with XAI + +- Add your `XAI_API_KEY` in the `.env` file + +- Select your model_name like `xai/grok-beta` follows [LiteLLM conventions](https://docs.litellm.ai/docs/providers/xai) + +- Execute your agent! + + +```python +from swarms import Agent +import os +from dotenv import load_dotenv + +load_dotenv() + +# Initialize the agent with ChromaDB memory +agent = Agent( + agent_name="Financial-Analysis-Agent", + model_name="xai/grok-beta", + system_prompt="Agent system prompt here", + agent_description="Agent performs financial analysis.", +) + +# Run a query +agent.run("What are the components of a startup's stock incentive equity plan?") +``` \ No newline at end of file From 94b3b623313cc6d92b6f53b329f9041e8da29d18 Mon Sep 17 00:00:00 2001 From: Kye Gomez Date: Thu, 9 Jan 2025 19:10:52 -0500 Subject: [PATCH 10/11] [MODEL DOCS] --- docs/mkdocs.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 0d608eaf4..2bd891797 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -203,6 +203,11 @@ nav: - OpenAI: "swarms/examples/openai_example.md" - Anthropic: "swarms/examples/claude.md" - Groq: "swarms/examples/groq.md" + - Cohere: "swarms/examples/cohere.md" + - DeepSeek: "swarms/examples/deepseek.md" + - Ollama: "swarms/examples/ollama.md" + - OpenRouter: "swarms/examples/openrouter.md" + - XAI: "swarms/examples/xai.md" - Swarm Models: - Overview: "swarms/models/index.md" # - Models Available: "swarms/models/index.md" From 515394e7625b0d4ced9aa8acbcf2544d6c9f5b3d Mon Sep 17 00:00:00 2001 From: Kye Gomez Date: Thu, 9 Jan 2025 19:13:03 -0500 Subject: [PATCH 11/11] [MODEL DOCS] --- docs/swarms/examples/openrouter.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/swarms/examples/openrouter.md b/docs/swarms/examples/openrouter.md index 2c3f1402d..827ea949c 100644 --- a/docs/swarms/examples/openrouter.md +++ b/docs/swarms/examples/openrouter.md @@ -1,4 +1,4 @@ -# Agent with XAI +# Agent with OpenRouter - Add your `OPENROUTER_API_KEY` in the `.env` file