diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 930e07ea..3d23ebcc 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -189,6 +189,7 @@ nav: - Overview: "applications/customer_support.md" - Marketing: - Overview: "applications/marketing_agencies.md" + - Swarm of Automated Business Analysis: "applications/business-analyst-agent.md" - Corporate: - Corporate Documents: - Data Room: "corporate/data_room.md" diff --git a/docs/swarms_cloud/available_models.md b/docs/swarms_cloud/available_models.md index ad108c82..0405b893 100644 --- a/docs/swarms_cloud/available_models.md +++ b/docs/swarms_cloud/available_models.md @@ -1,6 +1,6 @@ # Available Models -```markdown +``` | Model Name | Description | Input Price | Output Price | Use Cases | |-----------------------|---------------------------------------------------------------------------------------------------------|--------------|--------------|------------------------------------------------------------------------| | **Llama3-70b** | Llama 3 is an auto-regressive language model that uses an optimized transformer architecture. | $0.80/1M Tokens | $1.60/1M Tokens | General natural language processing tasks. | diff --git a/docs/swarms_cloud/migrate_openai.md b/docs/swarms_cloud/migrate_openai.md index 058241d7..23718eec 100644 --- a/docs/swarms_cloud/migrate_openai.md +++ b/docs/swarms_cloud/migrate_openai.md @@ -75,6 +75,8 @@ Note that you need to supply one of Swarms’s supported LLMs as an argument, as ## Example output The code above produces the following object: -```bash +``` ChatCompletionMessage(content=" Hello! How can I assist you today? Do you have any questions or tasks you'd like help with? Please let me know and I'll do my best to assist you.", role='assistant' function_call=None, tool_calls=None) -``` \ No newline at end of file +``` + + diff --git a/hierarchical_swarm.py b/hierarchical_swarm.py deleted file mode 100644 index 5162da9a..00000000 --- a/hierarchical_swarm.py +++ /dev/null @@ -1,177 +0,0 @@ -from typing import List - -from pydantic import BaseModel, Field - -from swarms.structs.agent import Agent -from swarms.structs.base_swarm import BaseSwarm -from swarms.utils.loguru_logger import logger -from swarms.models.popular_llms import Anthropic, OpenAIChat -from swarms.models.base_llm import BaseLLM -from swarms.memory.base_vectordb import BaseVectorDatabase - - -boss_sys_prompt = ( - "You're the Swarm Orchestrator, like a project manager of a" - " bustling hive. When a task arises, you tap into your network of" - " worker agents who are ready to jump into action. Whether it's" - " organizing data, handling logistics, or crunching numbers, you" - " delegate tasks strategically to maximize efficiency. Picture" - " yourself as the conductor of a well-oiled machine," - " orchestrating the workflow seamlessly to achieve optimal" - " results with your team of dedicated worker agents." -) - - -class AgentSchema(BaseModel): - name: str = Field( - ..., - title="Name of the agent", - description="Name of the agent", - ) - system_prompt: str = ( - Field( - ..., - title="System prompt for the agent", - description="System prompt for the agent", - ), - ) - rules: str = Field( - ..., - title="Rules", - description="Rules for the agent", - ) - llm: str = Field( - ..., - title="Language model", - description="Language model for the agent: `GPT4` or `Claude", - ) - - # tools: List[ToolSchema] = Field( - # ..., - # title="Tools available to the agent", - # description="Either `browser` or `terminal`", - # ) - # task: str = Field( - # ..., - # title="Task assigned to the agent", - # description="Task assigned to the agent", - # ) - # TODO: Add more fields here such as the agent's language model, tools, etc. - - -class HassSchema(BaseModel): - plan: str = Field( - ..., - title="Plan to solve the input problem", - description="List of steps to solve the problem", - ) - agents: List[AgentSchema] = Field( - ..., - title="List of agents to use for the problem", - description="List of agents to use for the problem", - ) - # Rules for the agents - rules: str = Field( - ..., - title="Rules for the agents", - description="Rules for the agents", - ) - - -class HierarchicalSwarm(BaseSwarm): - def __init__( - self, - director: Agent = None, - subordinates: List[Agent] = [], - workers: List[Agent] = [], - director_sys_prompt: str = boss_sys_prompt, - director_name: str = "Swarm Orchestrator", - director_agent_creation_schema: BaseModel = HassSchema, - director_llm: BaseLLM = Anthropic, - communication_protocol: BaseVectorDatabase = None, - *args, - **kwargs, - ): - super().__init__(*args, **kwargs) - self.director = director - self.subordinates = subordinates - self.workers = workers - self.director_sys_prompt = director_sys_prompt - self.director_name = director_name - self.director_agent_creation_schema = ( - director_agent_creation_schema - ) - self.director_llm = director_llm - self.communication_protocol = communication_protocol - - def create_director(self, *args, **kwargs): - """ - Create the director agent based on the provided schema. - """ - name = self.director_name - system_prompt = self.director_sys_prompt - director_llm = self.director_llm - - if director_llm == Anthropic: - Anthropic(*args, **kwargs) - elif director_llm == OpenAIChat: - OpenAIChat(*args, **kwargs) - - logger.info( - f"Creating Director Agent: {name} with system prompt:" - f" {system_prompt}" - ) - - director = Agent( - agent_name=name, - system_prompt=system_prompt, - llm=director_llm, - max_loops=1, - autosave=True, - dashboard=False, - verbose=True, - stopping_token="", - ) - - return director - - def create_worker_agents( - agents: List[AgentSchema], - ) -> List[Agent]: - """ - Create and initialize agents based on the provided AgentSchema objects. - - Args: - agents (List[AgentSchema]): A list of AgentSchema objects containing agent information. - - Returns: - List[Agent]: The initialized Agent objects. - - """ - agent_list = [] - for agent in agents: - name = agent.name - system_prompt = agent.system_prompt - - logger.info( - f"Creating agent: {name} with system prompt:" - f" {system_prompt}" - ) - - out = Agent( - agent_name=name, - system_prompt=system_prompt, - # llm=Anthropic( - # anthropic_api_key=os.getenv("ANTHROPIC_API_KEY") - # ), - max_loops=1, - autosave=True, - dashboard=False, - verbose=True, - stopping_token="", - ) - - # network.add_agent(out) - agent_list.append(out) - - return agent_list