From 3297f7fc61277f91fc4bfd768f42d3aad2c7c4bb Mon Sep 17 00:00:00 2001 From: Kye Gomez <98760976+kyegomez@users.noreply.github.com> Date: Fri, 7 Jun 2024 12:05:40 -0700 Subject: [PATCH 1/9] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b0ba9bbe..13f69301 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ Swarms is an enterprise grade and production ready multi-agent collaboration fra | Models | Pre-trained models that can be utilized for various tasks within the swarm framework. | ⭐⭐⭐ | [Documentation](https://docs.swarms.world/en/latest/swarms/models/) | | Models APIs | APIs to interact with and utilize the models effectively, providing interfaces for inference, training, and fine-tuning. | ⭐⭐⭐ | [Documentation](https://docs.swarms.world/en/latest/swarms/models/) | | Agents with Tools | Agents equipped with specialized tools to perform specific tasks more efficiently, such as data processing, analysis, or interaction with external systems. | ⭐⭐⭐⭐ | [Documentation](https://medium.com/@kyeg/the-swarms-tool-system-functions-pydantic-basemodels-as-tools-and-radical-customization-c2a2e227b8ca) | -| Agents with Memory | Mechanisms for agents to store and recall past interactions, improving learning and adaptability over time. | ⭐⭐⭐⭐ | [Documentation]() | +| Agents with Memory | Mechanisms for agents to store and recall past interactions, improving learning and adaptability over time. | ⭐⭐⭐⭐ | [Documentation](https://github.com/kyegomez/swarms/blob/master/playground/structs/agent/agent_with_longterm_memory.py) | | Multi-Agent Orchestration | Coordination of multiple agents to work together seamlessly on complex tasks, leveraging their individual strengths to achieve higher overall performance. | ⭐⭐⭐⭐⭐ | [Documentation]() | The performance impact is rated on a scale from one to five stars, with multi-agent orchestration being the highest due to its ability to combine the strengths of multiple agents and optimize task execution. From 68605261f02636e09982ad0377cbc64b8293d4a4 Mon Sep 17 00:00:00 2001 From: Kye Gomez Date: Fri, 7 Jun 2024 12:11:33 -0700 Subject: [PATCH 2/9] [FEAT][Tool Execution] [CLEANUP] --- .env.example | 34 +--- example.py | 56 ++++-- playground/agents/agent_ops.py | 25 +++ .../agent_delegation.py | 82 ++++++++ pyproject.toml | 2 +- scripts/cleanup/json_log_cleanup.py | 2 +- swarms/models/__init__.py | 13 +- swarms/models/distilled_whisperx.py | 182 ------------------ swarms/structs/__init__.py | 30 +-- swarms/structs/agent.py | 151 ++++++++++----- swarms/structs/base_structure.py | 4 +- swarms/structs/base_swarm.py | 89 ++++++--- swarms/tools/tool_parse_exec.py | 48 +++++ swarms/utils/agent_ops_check.py | 28 +++ 14 files changed, 418 insertions(+), 328 deletions(-) create mode 100644 playground/agents/agent_ops.py create mode 100644 playground/structs/multi_agent_collaboration/agent_delegation.py delete mode 100644 swarms/models/distilled_whisperx.py create mode 100644 swarms/tools/tool_parse_exec.py create mode 100644 swarms/utils/agent_ops_check.py diff --git a/.env.example b/.env.example index 8ae19111..7776faeb 100644 --- a/.env.example +++ b/.env.example @@ -5,46 +5,16 @@ AI21_API_KEY="your_api_key_here" COHERE_API_KEY="your_api_key_here" ALEPHALPHA_API_KEY="your_api_key_here" HUGGINFACEHUB_API_KEY="your_api_key_here" -STABILITY_API_KEY="your_api_key_here" -POSTHOG_API_KEY="" -POSTHOG_HOST="" -WOLFRAM_ALPHA_APPID="your_wolfram_alpha_appid_here" -ZAPIER_NLA_API_KEY="your_zapier_nla_api_key_here" EVAL_PORT=8000 MODEL_NAME="gpt-4" -CELERY_BROKER_URL="redis://localhost:6379" -SERVER="http://localhost:8000" USE_GPU=True PLAYGROUND_DIR="playground" LOG_LEVEL="INFO" BOT_NAME="Orca" - -WINEDB_HOST="your_winedb_host_here" -WINEDB_PASSWORD="your_winedb_password_here" -BING_SEARCH_URL="your_bing_search_url_here" - -BING_SUBSCRIPTION_KEY="your_bing_subscription_key_here" -SERPAPI_API_KEY="your_serpapi_api_key_here" -IFTTTKey="your_iftttkey_here" - -BRAVE_API_KEY="your_brave_api_key_here" -SPOONACULAR_KEY="your_spoonacular_key_here" HF_API_KEY="your_huggingface_api_key_here" -USE_TELEMTRY=True - - -REDIS_HOST= -REDIS_PORT= - -#dbs -PINECONE_API_KEY="" -BING_COOKIE="" -PSG_CONNECTION_STRING="" -GITHUB_USERNAME="" -GITHUB_REPO_NAME="" -GITHUB_TOKEN="" -USE_TELEMETRY=True \ No newline at end of file +USE_TELEMETRY=True +AGENTOPS_API_KEY="" diff --git a/example.py b/example.py index 59ec9392..b6f8d712 100644 --- a/example.py +++ b/example.py @@ -1,27 +1,53 @@ from swarms import Agent, OpenAIChat +def calculate_profit(revenue: float, expenses: float): + """ + Calculates the profit by subtracting expenses from revenue. + + Args: + revenue (float): The total revenue. + expenses (float): The total expenses. + + Returns: + float: The calculated profit. + """ + return revenue - expenses + + +def generate_report(company_name: str, profit: float): + """ + Generates a report for a company's profit. + + Args: + company_name (str): The name of the company. + profit (float): The calculated profit. + + Returns: + str: The report for the company's profit. + """ + return f"The profit for {company_name} is ${profit}." + + # Initialize the agent agent = Agent( - agent_name="Transcript Generator", - system_prompt="Generate a transcript for a youtube video on what swarms are!", - agent_description=( - "Generate a transcript for a youtube video on what swarms" " are!" - ), + agent_name="Accounting Assistant", + system_prompt="You're the accounting agent, your purpose is to generate a profit report for a company!", + agent_description="Generate a profit report for a company!", llm=OpenAIChat(), - max_loops="auto", + max_loops=1, autosave=True, + dynamic_temperature_enabled=True, dashboard=False, - streaming_on=True, verbose=True, - stopping_token="", - interactive=True, - state_save_file_type="json", - saved_state_path="transcript_generator.json", + # interactive=True, # Set to False to disable interactive mode + # stopping_token="", + # saved_state_path="accounting_agent.json", + tools=[calculate_profit, generate_report], + # docs_folder="docs", + # pdf_path="docs/accounting_agent.pdf", ) -# Run the Agent on a task -out = agent.run( - "Generate a transcript for a youtube video on what swarms are!" +agent.run( + "We're the Swarm Corporation, our total revenue is $100,000 and our total expenses are $50,000." ) -print(out) diff --git a/playground/agents/agent_ops.py b/playground/agents/agent_ops.py new file mode 100644 index 00000000..5d9bf467 --- /dev/null +++ b/playground/agents/agent_ops.py @@ -0,0 +1,25 @@ +from swarms import Agent, OpenAIChat + + +# Initialize the agent +agent = Agent( + agent_name="Transcript Generator", + system_prompt="Generate a transcript for a youtube video on what swarms are!", + agent_description=( + "Generate a transcript for a youtube video on what swarms" " are!" + ), + llm=OpenAIChat(), + max_loops=1, + autosave=True, + dashboard=False, + streaming_on=True, + verbose=True, + stopping_token="", + interactive=False, + state_save_file_type="json", + saved_state_path="transcript_generator.json", + agent_ops_on=True, +) + +# Run the Agent on a task +agent.run("Generate a transcript for a youtube video on what swarms are!") diff --git a/playground/structs/multi_agent_collaboration/agent_delegation.py b/playground/structs/multi_agent_collaboration/agent_delegation.py new file mode 100644 index 00000000..91ce1eb3 --- /dev/null +++ b/playground/structs/multi_agent_collaboration/agent_delegation.py @@ -0,0 +1,82 @@ +from swarms import Agent, OpenAIChat + + +def calculate_profit(revenue: float, expenses: float): + """ + Calculates the profit by subtracting expenses from revenue. + + Args: + revenue (float): The total revenue. + expenses (float): The total expenses. + + Returns: + float: The calculated profit. + """ + return revenue - expenses + + +def generate_report(company_name: str, profit: float): + """ + Generates a report for a company's profit. + + Args: + company_name (str): The name of the company. + profit (float): The calculated profit. + + Returns: + str: The report for the company's profit. + """ + return f"The profit for {company_name} is ${profit}." + + +def account_agent(task: str = None): + """ + delegate a task to an agent! + + Task: str (What task to give to an agent) + + """ + agent = Agent( + agent_name="Finance Agent", + system_prompt="You're the Finance agent, your purpose is to generate a profit report for a company!", + agent_description="Generate a profit report for a company!", + llm=OpenAIChat(), + max_loops=1, + autosave=True, + dynamic_temperature_enabled=True, + dashboard=False, + verbose=True, + # interactive=True, # Set to False to disable interactive mode + # stopping_token="", + # saved_state_path="accounting_agent.json", + # tools=[calculate_profit, generate_report], + # docs_folder="docs", + # pdf_path="docs/accounting_agent.pdf", + ) + + out = agent.run(task) + return out + + +# Initialize the agent +agent = Agent( + agent_name="Accounting Assistant", + system_prompt="You're the accounting agent, your purpose is to generate a profit report for a company!", + agent_description="Generate a profit report for a company!", + llm=OpenAIChat(), + max_loops=1, + autosave=True, + dynamic_temperature_enabled=True, + dashboard=False, + verbose=True, + # interactive=True, # Set to False to disable interactive mode + # stopping_token="", + # saved_state_path="accounting_agent.json", + tools=[account_agent], + # docs_folder="docs", + # pdf_path="docs/accounting_agent.pdf", +) + +agent.run( + "Delegate a task to the accounting agent: what are the best ways to read cashflow statements" +) diff --git a/pyproject.toml b/pyproject.toml index 27af93cf..34d050c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "swarms" -version = "5.1.6" +version = "5.1.8" description = "Swarms - Pytorch" license = "MIT" authors = ["Kye Gomez "] diff --git a/scripts/cleanup/json_log_cleanup.py b/scripts/cleanup/json_log_cleanup.py index b376ea74..8e3ee53a 100644 --- a/scripts/cleanup/json_log_cleanup.py +++ b/scripts/cleanup/json_log_cleanup.py @@ -31,4 +31,4 @@ def cleanup_json_logs(name: str = None): # Call the function -cleanup_json_logs("artifacts_seven") +cleanup_json_logs("artifacts_three") diff --git a/swarms/models/__init__.py b/swarms/models/__init__.py index a9b26c7c..e7823eff 100644 --- a/swarms/models/__init__.py +++ b/swarms/models/__init__.py @@ -3,15 +3,17 @@ from swarms.models.base_llm import BaseLLM # noqa: E402 from swarms.models.base_multimodal_model import BaseMultiModalModel from swarms.models.fuyu import Fuyu # noqa: E402 from swarms.models.gpt4_vision_api import GPT4VisionAPI # noqa: E402 +from swarms.models.gpt_o import GPT4o from swarms.models.huggingface import HuggingfaceLLM # noqa: E402 from swarms.models.idefics import Idefics # noqa: E402 from swarms.models.kosmos_two import Kosmos # noqa: E402 from swarms.models.layoutlm_document_qa import LayoutLMDocumentQA +from swarms.models.llama3_hosted import llama3Hosted from swarms.models.llava import LavaMultiModal # noqa: E402 - from swarms.models.nougat import Nougat # noqa: E402 -from swarms.models.palm import GooglePalm as Palm # noqa: E402 +from swarms.models.openai_embeddings import OpenAIEmbeddings from swarms.models.openai_tts import OpenAITTS # noqa: E402 +from swarms.models.palm import GooglePalm as Palm # noqa: E402 from swarms.models.popular_llms import Anthropic as Anthropic from swarms.models.popular_llms import ( AzureOpenAILLM as AzureOpenAI, @@ -19,15 +21,15 @@ from swarms.models.popular_llms import ( from swarms.models.popular_llms import ( CohereChat as Cohere, ) +from swarms.models.popular_llms import OctoAIChat from swarms.models.popular_llms import ( OpenAIChatLLM as OpenAIChat, ) from swarms.models.popular_llms import ( OpenAILLM as OpenAI, ) -from swarms.models.popular_llms import OctoAIChat -from swarms.models.qwen import QwenVLMultiModal # noqa: E402 from swarms.models.popular_llms import ReplicateChat as Replicate +from swarms.models.qwen import QwenVLMultiModal # noqa: E402 from swarms.models.sampling_params import SamplingParams, SamplingType from swarms.models.together import TogetherLLM # noqa: E402 from swarms.models.types import ( # noqa: E402 @@ -38,9 +40,6 @@ from swarms.models.types import ( # noqa: E402 VideoModality, ) from swarms.models.vilt import Vilt # noqa: E402 -from swarms.models.openai_embeddings import OpenAIEmbeddings -from swarms.models.llama3_hosted import llama3Hosted -from swarms.models.gpt_o import GPT4o __all__ = [ "BaseEmbeddingModel", diff --git a/swarms/models/distilled_whisperx.py b/swarms/models/distilled_whisperx.py deleted file mode 100644 index bd2bbcf3..00000000 --- a/swarms/models/distilled_whisperx.py +++ /dev/null @@ -1,182 +0,0 @@ -import asyncio -import os -import time -from functools import wraps -from typing import Union - -import torch -from termcolor import colored -from transformers import ( - AutoModelForSpeechSeq2Seq, - AutoProcessor, - pipeline, -) - - -def async_retry(max_retries=3, exceptions=(Exception,), delay=1): - """ - A decorator for adding retry logic to async functions. - :param max_retries: Maximum number of retries before giving up. - :param exceptions: A tuple of exceptions to catch and retry on. - :param delay: Delay between retries. - """ - - def decorator(func): - @wraps(func) - async def wrapper(*args, **kwargs): - retries = max_retries - while retries: - try: - return await func(*args, **kwargs) - except exceptions as e: - retries -= 1 - if retries <= 0: - raise - print( - f"Retry after exception: {e}, Attempts" - f" remaining: {retries}" - ) - await asyncio.sleep(delay) - - return wrapper - - return decorator - - -class DistilWhisperModel: - """ - This class encapsulates the Distil-Whisper model for English speech recognition. - It allows for both synchronous and asynchronous transcription of short and long-form audio. - - Args: - model_id: The model ID to use. Defaults to "distil-whisper/distil-large-v2". - - - Attributes: - device: The device to use for inference. - torch_dtype: The torch data type to use for inference. - model_id: The model ID to use. - model: The model instance. - processor: The processor instance. - - Usage: - model_wrapper = DistilWhisperModel() - transcription = model_wrapper('path/to/audio.mp3') - - # For async usage - transcription = asyncio.run(model_wrapper.async_transcribe('path/to/audio.mp3')) - """ - - def __init__(self, model_id="distil-whisper/distil-large-v2"): - self.device = "cuda:0" if torch.cuda.is_available() else "cpu" - self.torch_dtype = ( - torch.float16 if torch.cuda.is_available() else torch.float32 - ) - self.model_id = model_id - self.model = AutoModelForSpeechSeq2Seq.from_pretrained( - model_id, - torch_dtype=self.torch_dtype, - low_cpu_mem_usage=True, - use_safetensors=True, - ).to(self.device) - self.processor = AutoProcessor.from_pretrained(model_id) - - def __call__(self, inputs: Union[str, dict]): - return self.transcribe(inputs) - - def transcribe(self, inputs: Union[str, dict]): - """ - Synchronously transcribe the given audio input using the Distil-Whisper model. - :param inputs: A string representing the file path or a dict with audio data. - :return: The transcribed text. - """ - pipe = pipeline( - "automatic-speech-recognition", - model=self.model, - tokenizer=self.processor.tokenizer, - feature_extractor=self.processor.feature_extractor, - max_new_tokens=128, - torch_dtype=self.torch_dtype, - device=self.device, - ) - - return pipe(inputs)["text"] - - @async_retry() - async def async_transcribe(self, inputs: Union[str, dict]): - """ - Asynchronously transcribe the given audio input using the Distil-Whisper model. - :param inputs: A string representing the file path or a dict with audio data. - :return: The transcribed text. - """ - loop = asyncio.get_event_loop() - return await loop.run_in_executor(None, self.transcribe, inputs) - - def real_time_transcribe(self, audio_file_path, chunk_duration=5): - """ - Simulates real-time transcription of an audio file, processing and printing results - in chunks with colored output for readability. - - :param audio_file_path: Path to the audio file to be transcribed. - :param chunk_duration: Duration in seconds of each audio chunk to be processed. - """ - if not os.path.isfile(audio_file_path): - print(colored("The audio file was not found.", "red")) - return - - # Assuming `chunk_duration` is in seconds and `processor` can handle chunk-wise processing - try: - with torch.no_grad(): - # Load the whole audio file, but process and transcribe it in chunks - audio_input = self.processor.audio_file_to_array( - audio_file_path - ) - sample_rate = audio_input.sampling_rate - len(audio_input.array) / sample_rate - chunks = [ - audio_input.array[i : i + sample_rate * chunk_duration] - for i in range( - 0, - len(audio_input.array), - sample_rate * chunk_duration, - ) - ] - - print( - colored("Starting real-time transcription...", "green") - ) - - for i, chunk in enumerate(chunks): - # Process the current chunk - processed_inputs = self.processor( - chunk, - sampling_rate=sample_rate, - return_tensors="pt", - padding=True, - ) - processed_inputs = processed_inputs.input_values.to( - self.device - ) - - # Generate transcription for the chunk - logits = self.model.generate(processed_inputs) - transcription = self.processor.batch_decode( - logits, skip_special_tokens=True - )[0] - - # Print the chunk's transcription - print( - colored(f"Chunk {i+1}/{len(chunks)}: ", "yellow") - + transcription - ) - - # Wait for the chunk's duration to simulate real-time processing - time.sleep(chunk_duration) - - except Exception as e: - print( - colored( - f"An error occurred during transcription: {e}", - "red", - ) - ) diff --git a/swarms/structs/__init__.py b/swarms/structs/__init__.py index 62c83c87..9bb732c5 100644 --- a/swarms/structs/__init__.py +++ b/swarms/structs/__init__.py @@ -1,3 +1,14 @@ +from swarms.schemas.plan import Plan +from swarms.schemas.schemas import ( + Artifact, + ArtifactUpload, + StepInput, + StepOutput, + StepRequestBody, + TaskInput, + TaskRequestBody, +) +from swarms.schemas.step import Step from swarms.structs.agent import Agent from swarms.structs.agent_job import AgentJob from swarms.structs.agent_process import ( @@ -11,6 +22,7 @@ from swarms.structs.base_workflow import BaseWorkflow from swarms.structs.concurrent_workflow import ConcurrentWorkflow from swarms.structs.conversation import Conversation from swarms.structs.groupchat import GroupChat +from swarms.structs.hiearchical_swarm import HiearchicalSwarm from swarms.structs.majority_voting import ( MajorityVoting, majority_voting, @@ -26,21 +38,13 @@ from swarms.structs.multi_process_workflow import ( from swarms.structs.multi_threaded_workflow import ( MultiThreadedWorkflow, ) -from swarms.schemas.plan import Plan from swarms.structs.rearrange import AgentRearrange, rearrange from swarms.structs.recursive_workflow import RecursiveWorkflow from swarms.structs.round_robin import RoundRobinSwarm -from swarms.schemas.schemas import ( - Artifact, - ArtifactUpload, - StepInput, - StepOutput, - StepRequestBody, - TaskInput, - TaskRequestBody, -) from swarms.structs.sequential_workflow import SequentialWorkflow -from swarms.schemas.step import Step + +# New Swarms +from swarms.structs.swarm_load_balancer import AgentLoadBalancer from swarms.structs.swarm_net import SwarmNetwork from swarms.structs.swarming_architectures import ( broadcast, @@ -83,10 +87,6 @@ from swarms.structs.yaml_model import ( pydantic_type_to_yaml_schema, ) -# New Swarms -from swarms.structs.swarm_load_balancer import AgentLoadBalancer -from swarms.structs.hiearchical_swarm import HiearchicalSwarm - __all__ = [ "Agent", "AgentJob", diff --git a/swarms/structs/agent.py b/swarms/structs/agent.py index 79923198..30fee9a9 100644 --- a/swarms/structs/agent.py +++ b/swarms/structs/agent.py @@ -35,13 +35,13 @@ from swarms.utils.pdf_to_text import pdf_to_text from swarms.tools.py_func_to_openai_func_str import ( get_openai_function_schema_from_func, ) -from swarms.tools.func_calling_executor import openai_tool_executor from swarms.structs.base_structure import BaseStructure from swarms.prompts.tools import tool_sop_prompt from swarms.tools.func_calling_utils import ( pydantic_model_to_json_str, prepare_output_for_output_model, ) +from swarms.tools.tool_parse_exec import parse_and_execute_json # Utils @@ -285,6 +285,7 @@ class Agent(BaseStructure): device: str = None, custom_planning_prompt: str = None, memory_chunk_size: int = 2000, + agent_ops_on: bool = False, *args, **kwargs, ): @@ -366,6 +367,7 @@ class Agent(BaseStructure): self.rules = rules self.custom_tools_prompt = custom_tools_prompt self.memory_chunk_size = memory_chunk_size + self.agent_ops_on = agent_ops_on # Name self.name = agent_name @@ -376,12 +378,12 @@ class Agent(BaseStructure): self.answer = "" # The max_loops will be set dynamically if the dynamic_loop - if self.dynamic_loops: + if self.dynamic_loops is True: logger.info("Dynamic loops enabled") self.max_loops = "auto" # If multimodal = yes then set the sop to the multimodal sop - if self.multi_modal: + if self.multi_modal is True: self.sop = MULTI_MODAL_AUTO_AGENT_SYSTEM_PROMPT_1 # Memory @@ -403,54 +405,26 @@ class Agent(BaseStructure): ) # If the docs exist then ingest the docs - if self.docs is not None: + if exists(self.docs): self.ingest_docs(self.docs) # If docs folder exists then get the docs from docs folder - if self.docs_folder: + if exists(self.docs_folder): self.get_docs_from_doc_folders() - # If tokenizer and context length exists then: - # if self.tokenizer and self.context_length: - # self.truncate_history() - - # If verbose is enabled then set the logger level to info - # if verbose is not False: - # logger.setLevel(logging.INFO) - if tools is not None: - + logger.info( + "Tools provided make sure the functions have documentation ++ type hints, otherwise tool execution won't be reliable." + ) # Add the tool prompt to the memory self.short_memory.add(role="System", content=tool_sop_prompt()) # Print number of tools + logger.info("Tools granted, initializing tool protocol.") logger.info(f"Number of tools: {len(tools)}") - logger.info( - "Tools provided, Automatically converting to OpenAI function" - ) - - # Now the names of the tools - for tool in tools: - logger.info(f"Tool: {tool.__name__}") # Transform the tools into an openai schema - for tool in tools: - - # Transform the tool into a openai function calling schema - tool_schema_list = get_openai_function_schema_from_func( - tool, - name=tool.__name__, - description=tool.__doc__, - ) - - # Transform the dictionary to a string - tool_schema_list = json.dumps(tool_schema_list, indent=4) - # print(tool_schema_list) - - # Add the tool schema to the short memory - self.short_memory.add( - role="System", content=tool_schema_list - ) + self.convert_tool_into_openai_schema() # Now create a function calling map for every tools self.function_map = {tool.__name__: tool for tool in tools} @@ -522,6 +496,23 @@ class Agent(BaseStructure): # If the device is not provided then get the device data + # if agent ops is enabled then import agent ops + if agent_ops_on is True: + try: + from swarms.utils.agent_ops_check import ( + try_import_agentops, + ) + + # Try importing agent ops + logger.info( + "Agent Ops Initializing, ensure that you have the agentops API key and the pip package installed." + ) + try_import_agentops() + except ImportError: + logger.error( + "Could not import agentops, try installing agentops: $ pip3 install agentops" + ) + def set_system_prompt(self, system_prompt: str): """Set the system prompt""" self.system_prompt = system_prompt @@ -751,7 +742,7 @@ class Agent(BaseStructure): loop_count = 0 # Clear the short memory - # response = None + response = None while self.max_loops == "auto" or loop_count < self.max_loops: loop_count += 1 @@ -807,7 +798,17 @@ class Agent(BaseStructure): # Check if tools is not None if self.tools is not None: - self.parse_and_execute_tools(response) + # self.parse_and_execute_tools(response) + tool_call_output = parse_and_execute_json( + self.tools, response, parse_md=True + ) + logger.info( + f"Tool Call Output: {tool_call_output}" + ) + self.short_memory.add( + role=self.agent_name, + content=tool_call_output, + ) if self.code_interpreter is not False: self.code_interpreter_execution(response) @@ -916,6 +917,8 @@ class Agent(BaseStructure): print(f"Response after output model: {response}") # print(response) + if self.agent_ops_on is True: + self.check_end_session_agentops() return response except Exception as error: @@ -937,7 +940,7 @@ class Agent(BaseStructure): def parse_and_execute_tools(self, response: str, *args, **kwargs): # Extract json from markdown - response = extract_code_from_markdown(response) + # response = extract_code_from_markdown(response) # Try executing the tool if self.execute_tool is not False: @@ -945,11 +948,8 @@ class Agent(BaseStructure): logger.info("Executing tool...") # try to Execute the tool and return a string - out = openai_tool_executor( - tools=response, - function_map=self.function_map, - *args, - **kwargs, + out = parse_and_execute_json( + self.tools, response, parse_md=True, *args, **kwargs ) print(f"Tool Output: {out}") @@ -980,6 +980,8 @@ class Agent(BaseStructure): Returns: str: The agent history prompt """ + logger.info("Querying long term memory database") + # Query the long term memory database ltr = self.long_term_memory.query(query, *args, **kwargs) ltr = str(ltr) @@ -987,7 +989,6 @@ class Agent(BaseStructure): # Retrieve only the chunk size of the memory ltr = retrieve_tokens(ltr, self.memory_chunk_size) - print(len(ltr)) # print(f"Long Term Memory Query: {ltr}") return ltr @@ -1633,3 +1634,59 @@ class Agent(BaseStructure): "red", ) ) + + def check_end_session_agentops(self): + if self.agent_ops_on is True: + try: + from swarms.utils.agent_ops_check import ( + end_session_agentops, + ) + + # Try ending the session + return end_session_agentops() + except ImportError: + logger.error( + "Could not import agentops, try installing agentops: $ pip3 install agentops" + ) + + def convert_tool_into_openai_schema(self): + # Transform the tools into an openai schema + try: + for tool in self.tools: + # Transform the tool into a openai function calling schema + name = tool.__name__ + description = tool.__doc__ + + try: + logger.info( + "Tool -> OpenAI Schema Process Starting Now." + ) + tool_schema_list = ( + get_openai_function_schema_from_func( + tool, name=name, description=description + ) + ) + + # Transform the dictionary to a string + tool_schema_list = json.dumps( + tool_schema_list, indent=4 + ) + + # Add the tool schema to the short memory + self.short_memory.add( + role="System", content=tool_schema_list + ) + + logger.info( + f"Conversion process successful, the tool {name} has been integrated with the agent successfully." + ) + except Exception as error: + logger.info( + f"There was an error converting your tool into a OpenAI certified function calling schema. Add documentation and type hints: {error}" + ) + raise error + except Exception as error: + logger.info( + f"Error detected: {error} make sure you have inputted a callable and that it has documentation as docstrings" + ) + raise error diff --git a/swarms/structs/base_structure.py b/swarms/structs/base_structure.py index 9e5833bf..48957ac0 100644 --- a/swarms/structs/base_structure.py +++ b/swarms/structs/base_structure.py @@ -68,7 +68,7 @@ class BaseStructure: self, name: Optional[str] = None, description: Optional[str] = None, - save_metadata: bool = True, + save_metadata_on: bool = True, save_artifact_path: Optional[str] = "./artifacts", save_metadata_path: Optional[str] = "./metadata", save_error_path: Optional[str] = "./errors", @@ -76,7 +76,7 @@ class BaseStructure: super().__init__() self.name = name self.description = description - self.save_metadata = save_metadata + self.save_metadata_on = save_metadata_on self.save_artifact_path = save_artifact_path self.save_metadata_path = save_metadata_path self.save_error_path = save_error_path diff --git a/swarms/structs/base_swarm.py b/swarms/structs/base_swarm.py index bd71c60b..2159bdd5 100644 --- a/swarms/structs/base_swarm.py +++ b/swarms/structs/base_swarm.py @@ -1,3 +1,4 @@ +import uuid import asyncio import json from abc import ABC @@ -17,11 +18,12 @@ from swarms.structs.agent import Agent from swarms.structs.conversation import Conversation from swarms.utils.loguru_logger import logger from swarms.structs.omni_agent_types import AgentType +from swarms.memory.base_vectordb import BaseVectorDatabase class BaseSwarm(ABC): """ - Abstract Swarm Class for multi-agent systems + Base Swarm Class for all multi-agent systems Attributes: agents (List[Agent]): A list of agents @@ -83,6 +85,10 @@ class BaseSwarm(ABC): stopping_function: Optional[Callable] = None, stopping_condition: Optional[str] = "stop", stopping_condition_args: Optional[Dict] = None, + agentops_on: Optional[bool] = False, + speaker_selection_func: Optional[Callable] = None, + rules: Optional[str] = None, + collective_memory_system: Optional[BaseVectorDatabase] = False, *args, **kwargs, ): @@ -100,10 +106,28 @@ class BaseSwarm(ABC): self.stopping_function = stopping_function self.stopping_condition = stopping_condition self.stopping_condition_args = stopping_condition_args + self.agentops_on = agentops_on + self.speaker_selection_func = speaker_selection_func + self.rules = rules + self.collective_memory_system = collective_memory_system + + # Ensure that agents is exists + if self.agents is None: + raise ValueError("Agents must be provided.") + + # Ensure that agents is a list + if not isinstance(self.agents, list): + logger.error("Agents must be a list.") + raise TypeError("Agents must be a list.") + + # Ensure that agents is not empty + if len(self.agents) == 0: + logger.error("Agents list must not be empty.") + raise ValueError("Agents list must not be empty.") # Initialize conversation self.conversation = Conversation( - time_enabled=True, *args, **kwargs + time_enabled=True, rules=self.rules, *args, **kwargs ) # Handle callbacks @@ -116,12 +140,6 @@ class BaseSwarm(ABC): if autosave: self.save_to_json(metadata_filename) - # Handle logging - if self.agents: - logger.info( - f"Swarm initialized with {len(self.agents)} agents" - ) - # Handle stopping function if stopping_function is not None: if not callable(stopping_function): @@ -139,8 +157,27 @@ class BaseSwarm(ABC): self.stopping_condition_args = stopping_condition_args self.stopping_condition = stopping_condition + # If agentops is enabled, try to import agentops + if agentops_on is True: + for agent in self.agents: + agent.agent_ops_on = True + + # Handle speaker selection function + if speaker_selection_func is not None: + if not callable(speaker_selection_func): + raise TypeError( + "Speaker selection function must be callable." + ) + self.speaker_selection_func = speaker_selection_func + + # Agents dictionary with agent name as key and agent object as value + self.agents_dict = { + agent.agent_name: agent for agent in self.agents + } + def communicate(self): """Communicate with the swarm through the orchestrator, protocols, and the universal communication layer""" + ... def run(self): """Run the swarm""" @@ -221,6 +258,21 @@ class BaseSwarm(ABC): return agent return None + def self_find_agent_by_id(self, id: uuid.UUID): + """ + Find an agent by its id. + + Args: + id (str): The id of the agent to find. + + Returns: + Agent: The Agent object if found, None otherwise. + """ + for agent in self.agents: + if agent.id == id: + return agent + return None + def agent_exists(self, name: str): """ Check if an agent exists in the swarm. @@ -391,24 +443,6 @@ class BaseSwarm(ABC): """ return self.batched_run(tasks, *args, **kwargs) - def reset_all_agents(self): - """Reset all agents - - Returns: - - """ - for agent in self.agents: - agent.reset() - - def select_agent(self, agent_id: str): - """ - Select an agent through their id - """ - # Find agent with id - for agent in self.agents: - if agent.id == agent_id: - return agent - def select_agent_by_name(self, agent_name: str): """ Select an agent through their name @@ -650,3 +684,6 @@ class BaseSwarm(ABC): def __contains__(self, value): return value in self.agents + + def __eq__(self, other): + return self.__dict__ == other.__dict__ diff --git a/swarms/tools/tool_parse_exec.py b/swarms/tools/tool_parse_exec.py new file mode 100644 index 00000000..cbcb70dd --- /dev/null +++ b/swarms/tools/tool_parse_exec.py @@ -0,0 +1,48 @@ +from typing import List +import json +import loguru +from swarms.utils.parse_code import extract_code_from_markdown + + +def parse_and_execute_json( + functions: List[callable] = None, + json_string: str = None, + parse_md: bool = False, +): + """ + Parses and executes a JSON string containing function name and parameters. + + Args: + functions (List[callable]): A list of callable functions. + json_string (str): The JSON string to parse and execute. + parse_md (bool): Flag indicating whether to extract code from Markdown. + + Returns: + The result of executing the function with the parsed parameters, or None if an error occurs. + + """ + if parse_md: + json_string = extract_code_from_markdown(json_string) + + try: + # Create a dictionary that maps function names to functions + function_dict = {func.__name__: func for func in functions} + + loguru.logger.info(f"Extracted code: {json_string}") + data = json.loads(json_string) + function_name = data.get("function", {}).get("name") + parameters = data.get("function", {}).get("parameters") + + # Check if the function name is in the function dictionary + if function_name in function_dict: + # Call the function with the parsed parameters + result = function_dict[function_name](**parameters) + return result + else: + loguru.logger.warning( + f"No function named '{function_name}' found." + ) + return None + except Exception as e: + loguru.logger.error(f"Error: {e}") + return None diff --git a/swarms/utils/agent_ops_check.py b/swarms/utils/agent_ops_check.py new file mode 100644 index 00000000..4e1df6e7 --- /dev/null +++ b/swarms/utils/agent_ops_check.py @@ -0,0 +1,28 @@ +from swarms.utils.loguru_logger import logger +import os +from dotenv import load_dotenv + + +def try_import_agentops(*args, **kwargs): + try: + load_dotenv() + logger.info("Trying to import agentops") + import agentops + + agentops.init(os.getenv("AGENTOPS_API_KEY"), *args, **kwargs) + + return "agentops imported successfully." + except ImportError: + logger.error("Could not import agentops") + + +def end_session_agentops(): + try: + logger.info("Trying to end session") + import agentops + + agentops.end_session("Success") + return "Session ended successfully." + except ImportError: + logger.error("Could not import agentops") + return "Could not end session." From f90df96ee6594258dde1c46d13610772c429deb9 Mon Sep 17 00:00:00 2001 From: Kye Gomez Date: Sat, 8 Jun 2024 08:19:00 -0700 Subject: [PATCH 3/9] [DOCS] --- docs/mkdocs.yml | 308 +++++----------------------- swarms/structs/base_swarm.py | 10 + swarms/structs/hiearchical_swarm.py | 6 +- 3 files changed, 69 insertions(+), 255 deletions(-) diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 960adbd0..9c037952 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -1,181 +1,4 @@ -# docs_dir: '.' # replace with the correct path if your documentation files are not in the same directory as mkdocs.yml -# site_name: Swarms Documentation -# site_url: https://swarms.apac.ai -# site_author: Swarms -# site_description: Orchestrate Swarms of Agents From Any Framework Like OpenAI, Langchain, and Etc for Real World Workflow Automation. -# repo_name: kyegomez/swarms -# repo_url: https://github.com/kyegomez/swarms -# edit_uri: https://github.com/kyegomez/swarms/tree/main/docs -# copyright: TGSC Corp 2024. All rights reserved. - - -# plugins: -# # - glightbox -# - search -# - git-authors -# - mkdocs-jupyter: -# kernel_name: python3 -# execute: false -# include_source: True -# include_requirejs: true -# - mkdocstrings: -# default_handler: python -# handlers: -# python: -# options: -# parameter_headings: true -# paths: [supervision] -# load_external_modules: true -# allow_inspection: true -# show_bases: true -# group_by_category: true -# docstring_style: google -# show_symbol_type_heading: true -# show_symbol_type_toc: true -# show_category_heading: true -# domains: [std, py] -# - git-committers: -# repository: kyegomez/swarms -# branch: master -# # token: !ENV ["GITHUB_TOKEN"] -# - git-revision-date-localized: -# enable_creation_date: true -# extra_css: -# - assets/css/extra.css -# extra: -# social: -# - icon: fontawesome/brands/twitter -# link: https://x.com/KyeGomezB -# - icon: fontawesome/brands/github -# link: https://github.com/kyegomez/swarms -# theme: -# name: material -# custom_dir: overrides -# logo: assets/img/SwarmsLogoIcon.png -# palette: -# # Palette toggle for light mode -# - scheme: default -# primary: black -# toggle: -# icon: material/brightness-7 -# name: Switch to dark mode -# # Palette toggle for dark mode -# - scheme: slate -# primary: black -# toggle: -# icon: material/brightness-4 -# name: Switch to light mode -# features: -# - content.code.copy -# - content.code.annotate -# - navigation.tabs -# - navigation.sections -# - navigation.expand -# - navigation.top -# - announce.dismiss -# markdown_extensions: -# - pymdownx.highlight: -# anchor_linenums: true -# line_spans: __span -# pygments_lang_class: true -# - admonition -# - pymdownx.inlinehilite -# - pymdownx.snippets -# - pymdownx.superfences -# - pymdownx.details -# - pymdownx.tabbed -# - tables -# - def_list -# - footnotes -# nav: -# - Home: -# - Installation: -# - Overview: "index.md" -# - Install: "swarms/install/install.md" -# - Docker Setup: "swarms/install/docker_setup.md" -# - Usage Examples: -# - Overview: "swarms/usage/index.md" # Explains how the framework is decomposed into agents, models, and swarms -# - Models: -# - How to Create A Custom Language Model: "swarms/models/custom_model.md" -# - Models Available: "swarms/models/index.md" -# - MultiModal Models Available: "swarms/models/multimodal_models.md" -# - Agents: -# - Getting started with Agents: "swarms/structs/diy_your_own_agent.md" -# - Tools: -# - Functions, Pydantic BaseModels, and More: "swarms/tools/main.md" -# - Memory: -# - Building Custom Vector Memory Databases with the BaseVectorDatabase Class: "swarms/memory/diy_memory.md" -# - ShortTermMemory: "swarms/memory/short_term_memory.md" -# - Multi-Agent Collaboration: -# - SwarmNetwork: "swarms/structs/swarmnetwork.md" -# - AgentRearrange: "swarms/structs/agent_rearrange.md" -# - Why does Swarms Exist?: -# - References: -# - Agent Glossary: "swarms/glossary.md" -# - List of The Best Multi-Agent Papers: "swarms/papers.md" -# - Contributors: -# - Contributing: "contributing.md" -# - Reference: -# - Overview: "swarms/index.md" -# # - Framework Structure: "swarms/structs/tree.md" # Explains the tree structure of the framework and where things are located -# - swarms.models: -# - How to Create A Custom Language Model: "swarms/models/custom_model.md" -# - Deploying Azure OpenAI in Production A Comprehensive Guide: "swarms/models/azure_openai.md" -# - Language Models: -# - BaseLLM: "swarms/models/base_llm.md" -# - Overview: "swarms/models/index.md" -# - HuggingFaceLLM: "swarms/models/huggingface.md" -# - Anthropic: "swarms/models/anthropic.md" -# - OpenAIChat: "swarms/models/openai.md" -# - MultiModal Models : -# - BaseMultiModalModel: "swarms/models/base_multimodal_model.md" -# - Fuyu: "swarms/models/fuyu.md" -# - Vilt: "swarms/models/vilt.md" -# - Idefics: "swarms/models/idefics.md" -# - Kosmos: "swarms/models/kosmos.md" -# - Nougat: "swarms/models/nougat.md" -# - Dalle3: "swarms/models/dalle3.md" -# - GPT4VisionAPI: "swarms/models/gpt4v.md" -# - GPT4o: "swarms/models/gpt4o.md" -# - swarms.structs: -# - Foundational Structures: -# - Agent: "swarms/structs/agent.md" -# - BaseStructure: "swarms/structs/basestructure.md" -# - Task: "swarms/structs/task.md" -# - YamlModel: "swarms/structs/yaml_model.md" -# # - BaseSwarm: "swarms/structs/base_swarm.md" -# - BaseWorkflow: "swarms/structs/baseworkflow.md" -# - Workflows: -# - ConcurrentWorkflow: "swarms/structs/concurrentworkflow.md" -# - SequentialWorkflow: "swarms/structs/sequential_workflow.md" -# - Multi Agent Architectures: -# - Conversation: "swarms/structs/conversation.md" -# - SwarmNetwork: "swarms/structs/swarmnetwork.md" -# - MajorityVoting: "swarms/structs/majorityvoting.md" -# - AgentRearrange: "swarms/structs/agent_rearrange.md" -# - RoundRobin: "swarms/structs/round_robin_swarm.md" -# - Swarms Cloud API: -# - Overview: "swarms_cloud/main.md" -# - Available Models: "swarms_cloud/available_models.md" -# - Migrate from OpenAI to Swarms in 3 lines of code: "swarms_cloud/migrate_openai.md" -# - Getting Started with SOTA Vision Language Models VLM: "swarms_cloud/getting_started.md" -# - Enterprise Guide to High-Performance Multi-Agent LLM Deployments: "swarms_cloud/production_deployment.md" -# - Under The Hood The Swarm Cloud Serving Infrastructure: "swarms_cloud/architecture.md" -# - Guides: -# # - Building Custom Vector Memory Databases with the BaseVectorDatabase Class: "swarms/memory/diy_memory.md" -# - Models: -# - How to Create A Custom Language Model: "swarms/models/custom_model.md" -# - Deploying Azure OpenAI in Production, A Comprehensive Guide: "swarms/models/azure_openai.md" -# - Agents: -# - Agent: "examples/flow.md" -# - DIY Build Your Own Agent: "diy_your_own_agent.md" -# - Equipping Autonomous Agents with Tools: "examples/tools_agent.md" -# - Swarms: -# - SequentialWorkflow: "examples/reliable_autonomous_agents.md" - - - docs_dir: '.' # replace with the correct path if your documentation files are not in the same directory as mkdocs.yml site_name: Swarms Documentation site_url: https://swarms.apac.ai @@ -218,20 +41,14 @@ plugins: # token: !ENV ["GITHUB_TOKEN"] - git-revision-date-localized: enable_creation_date: true - -copyright: "© TGSC, Corporation." extra_css: - assets/css/extra.css extra: social: - - icon: fontawesome/solid/house - link: assets/img/SwarmsLogoIcon.png - - icon: fontawesome/brands/discord - link: https://discord.gg/qUtxnK2NMf + - icon: fontawesome/brands/twitter + link: https://x.com/KyeGomezB - icon: fontawesome/brands/github - link: https://github.com/kyegomez/Swarms/ - - icon: fontawesome/brands/python - link: https://pypi.org/project/Swarms/ + link: https://github.com/kyegomez/swarms theme: name: material custom_dir: overrides @@ -272,41 +89,46 @@ markdown_extensions: - def_list - footnotes nav: -- Home: - - Installation: - - Overview: "index.md" - - Install: "install.md" - - Docker Setup: docker_setup.md - - Usage Examples: - - Build an Agent: "diy_your_own_agent.md" - - Build an Agent with tools: "examples/tools_agents.md" - - Why does Swarms Exist?: - - Why Swarms? Orchestrating Agents for Enterprise Automation: "why.md" - - Limitations of Individual Agents: "limits_of_individual_agents.md" - -- Swarms Cloud API: - - Overview: "swarms_cloud/main.md" - - Available Models: "swarms_cloud/available_models.md" - - Migrate from OpenAI to Swarms in 3 lines of code: "swarms_cloud/migrate_openai.md" - - Getting Started with SOTA Vision Language Models VLM: "swarms_cloud/getting_started.md" - - Enterprise Guide to High-Performance Multi-Agent LLM Deployments: "swarms_cloud/production_deployment.md" -- Swarms Framework [PY]: + - Home: + - Installation: + - Overview: "index.md" + - Install: "swarms/install/install.md" + - Docker Setup: "swarms/install/docker_setup.md" + - Usage Examples: + - Overview: "swarms/usage/index.md" # Explains how the framework is decomposed into agents, models, and swarms + - Models: + - How to Create A Custom Language Model: "swarms/models/custom_model.md" + - Models Available: "swarms/models/index.md" + - MultiModal Models Available: "swarms/models/multimodal_models.md" + - Agents: + - Getting started with Agents: "swarms/structs/diy_your_own_agent.md" + - Tools: + - Functions, Pydantic BaseModels, and More: "swarms/tools/main.md" + - Memory: + - Building Custom Vector Memory Databases with the BaseVectorDatabase Class: "swarms/memory/diy_memory.md" + - ShortTermMemory: "swarms/memory/short_term_memory.md" + - Multi-Agent Collaboration: + - SwarmNetwork: "swarms/structs/swarmnetwork.md" + - AgentRearrange: "swarms/structs/agent_rearrange.md" + - Why does Swarms Exist?: + - References: + - Agent Glossary: "swarms/glossary.md" + - List of The Best Multi-Agent Papers: "swarms/papers.md" + - Contributors: + - Contributing: "contributing.md" +- Reference: - Overview: "swarms/index.md" - - DIY Build Your Own Agent: "diy_your_own_agent.md" - - Agents with Tools: "examples/tools_agent.md" + # - Framework Structure: "swarms/structs/tree.md" # Explains the tree structure of the framework and where things are located - swarms.models: - How to Create A Custom Language Model: "swarms/models/custom_model.md" - Deploying Azure OpenAI in Production A Comprehensive Guide: "swarms/models/azure_openai.md" - - Language: + - Language Models: - BaseLLM: "swarms/models/base_llm.md" - Overview: "swarms/models/index.md" - - Llava3: "swarms/models/llama3.md" - HuggingFaceLLM: "swarms/models/huggingface.md" - Anthropic: "swarms/models/anthropic.md" - - OpenAI: "swarms/models/openai.md" - - Mistral: "swarms/models/mistral.md" - - Mixtral: "swarms/models/mixtral.md" - - MultiModal: + - OpenAIChat: "swarms/models/openai.md" + - MultiModal Models : - BaseMultiModalModel: "swarms/models/base_multimodal_model.md" - Fuyu: "swarms/models/fuyu.md" - Vilt: "swarms/models/vilt.md" @@ -314,63 +136,41 @@ nav: - Kosmos: "swarms/models/kosmos.md" - Nougat: "swarms/models/nougat.md" - Dalle3: "swarms/models/dalle3.md" - - GPT4V: "swarms/models/gpt4v.md" - - DistilWhisperModel: "swarms/models/distilled_whisperx.md" + - GPT4VisionAPI: "swarms/models/gpt4v.md" + - GPT4o: "swarms/models/gpt4o.md" - swarms.structs: - Foundational Structures: - Agent: "swarms/structs/agent.md" - BaseStructure: "swarms/structs/basestructure.md" - Task: "swarms/structs/task.md" - YamlModel: "swarms/structs/yaml_model.md" + # - BaseSwarm: "swarms/structs/base_swarm.md" + - BaseWorkflow: "swarms/structs/baseworkflow.md" - Workflows: - ConcurrentWorkflow: "swarms/structs/concurrentworkflow.md" - - SequentialWorkflow: "swarms/structs/sequential_workflow.md" - - BaseWorkflow: "swarms/structs/baseworkflow.md" + - SequentialWorkflow: "swarms/structs/sequential_workflow.md" - Multi Agent Architectures: - Conversation: "swarms/structs/conversation.md" - SwarmNetwork: "swarms/structs/swarmnetwork.md" - MajorityVoting: "swarms/structs/majorityvoting.md" - AgentRearrange: "swarms/structs/agent_rearrange.md" - RoundRobin: "swarms/structs/round_robin_swarm.md" - - swarms.memory: - - Building Custom Vector Memory Databases with the BaseVectorDatabase Class: "swarms/memory/diy_memory.md" - - ShortTermMemory: "swarms/memory/short_term_memory.md" +- Swarms Cloud API: + - Overview: "swarms_cloud/main.md" + - Available Models: "swarms_cloud/available_models.md" + - Migrate from OpenAI to Swarms in 3 lines of code: "swarms_cloud/migrate_openai.md" + - Getting Started with SOTA Vision Language Models VLM: "swarms_cloud/getting_started.md" + - Enterprise Guide to High-Performance Multi-Agent LLM Deployments: "swarms_cloud/production_deployment.md" + - Under The Hood The Swarm Cloud Serving Infrastructure: "swarms_cloud/architecture.md" - Guides: - - Agents: - - Building Custom Vector Memory Databases with the BaseVectorDatabase Class: "swarms/memory/diy_memory.md" + # - Building Custom Vector Memory Databases with the BaseVectorDatabase Class: "swarms/memory/diy_memory.md" + - Models: - How to Create A Custom Language Model: "swarms/models/custom_model.md" - Deploying Azure OpenAI in Production, A Comprehensive Guide: "swarms/models/azure_openai.md" + - Agents: + - Agent: "examples/flow.md" - DIY Build Your Own Agent: "diy_your_own_agent.md" - Equipping Autonomous Agents with Tools: "examples/tools_agent.md" - - Overview: "examples/index.md" - - Agents: - - Agent: "examples/flow.md" - - OmniAgent: "examples/omni_agent.md" - - Swarms: - - SequentialWorkflow: "examples/reliable_autonomous_agents.md" - - 2O+ Autonomous Agent Blogs: "examples/ideas.md" -- Applications: - - CustomerSupport: - - Overview: "applications/customer_support.md" - - Marketing: - - Overview: "applications/marketing_agencies.md" - - Operations: - - Intoducing The Swarm of Automated Business Analyts: "applications/business-analyst-agent.md" -- Corporate: - - Corporate Documents: - - Data Room: "corporate/data_room.md" - - The Swarm Memo: "corporate/swarm_memo.md" - - Corporate Architecture: "corporate/architecture.md" - - Flywheel: "corporate/flywheel.md" - - Sales: - - FAQ: "corporate/faq.md" - - Distribution: "corporate/distribution" - - Product: - - SwarmCloud: "corporate/swarm_cloud.md" - - Weaknesses of Langchain: "corporate/failures.md" - - Design: "corporate/design.md" - - Metric: "corporate/metric.md" - - Organization: - - FrontEnd Member Onboarding: "corporate/front_end_contributors.md" -- Contributors: - - Contributing: "contributing.md" \ No newline at end of file + - Swarms: + - SequentialWorkflow: "examples/reliable_autonomous_agents.md" + diff --git a/swarms/structs/base_swarm.py b/swarms/structs/base_swarm.py index 2159bdd5..f91bb0af 100644 --- a/swarms/structs/base_swarm.py +++ b/swarms/structs/base_swarm.py @@ -687,3 +687,13 @@ class BaseSwarm(ABC): def __eq__(self, other): return self.__dict__ == other.__dict__ + + def agent_error_handling_check(self): + try: + if self.agents is None: + message = "You have not passed in any agents, you need to input agents to run a swarm" + logger.info(message) + raise ValueError(message) + except Exception as error: + logger.info(error) + raise error diff --git a/swarms/structs/hiearchical_swarm.py b/swarms/structs/hiearchical_swarm.py index 4763396d..610a1091 100644 --- a/swarms/structs/hiearchical_swarm.py +++ b/swarms/structs/hiearchical_swarm.py @@ -97,6 +97,10 @@ class HiearchicalSwarm(BaseSwarm): self.max_loops = max_loops self.long_term_memory_system = long_term_memory_system self.custom_parse_function = custom_parse_function + self.rules = rules + + # Check to see agents is not empty + self.agent_error_handling_check() # Set the director to max_one loop if self.director.max_loops > 1: @@ -112,7 +116,7 @@ class HiearchicalSwarm(BaseSwarm): # Initialize the conversation message pool self.swarm_history = Conversation( - time_enabled=True, + time_enabled=True, *args, **kwargs ) def swarm_initialization(self, *args, **kwargs): From 6e702f58d97cd1206181469189a93d4c19c54071 Mon Sep 17 00:00:00 2001 From: Kye Gomez Date: Sat, 8 Jun 2024 08:53:54 -0700 Subject: [PATCH 4/9] [CLEANUP] --- docs/index.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/index.md b/docs/index.md index e5f963a7..0d24cea9 100644 --- a/docs/index.md +++ b/docs/index.md @@ -7,27 +7,27 @@ Orchestrate enterprise-grade agents for multi-agent collaboration and orchestrat

Core Concepts

  • - + Agents
  • - + Memory
  • - + Tools
  • - + Tasks
  • - + Multi-Agent Orchestration
  • @@ -37,12 +37,12 @@ Orchestrate enterprise-grade agents for multi-agent collaboration and orchestrat

    How-To Guides

    • - + Installing Swarms
    • - + Docker Setup
    • @@ -52,12 +52,12 @@ Orchestrate enterprise-grade agents for multi-agent collaboration and orchestrat
    • - + Multi-Agent Flows
    • - + Sequential Workflows
    • @@ -87,7 +87,7 @@ Orchestrate enterprise-grade agents for multi-agent collaboration and orchestrat

      Examples

      • - + Swarm of Buisness Analysts for Business Reports
      • From e032b7f6636a54396a496868ed1e585e1e56f4f0 Mon Sep 17 00:00:00 2001 From: Kye Gomez Date: Sat, 8 Jun 2024 09:41:04 -0700 Subject: [PATCH 5/9] [DOCS][Index] --- docs/index.md | 139 +++++--------------------------------------------- 1 file changed, 12 insertions(+), 127 deletions(-) diff --git a/docs/index.md b/docs/index.md index 0d24cea9..bb6f2ee0 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,131 +1,16 @@ + # Swarms Orchestrate enterprise-grade agents for multi-agent collaboration and orchestration to automate real-world problems. - \ No newline at end of file +| Core Concepts | How-To Guides | Examples | Community | +|--------------------------------------------------|----------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------| +| [Agents](swarms/structs/agent) | [Installing Swarms](swarms/install/install) | [Swarm of Business Analysts for Business Reports](applications/business-analyst-agent) | [Join the Swarms Community!](https://discord.gg/3Zck7nX6) | +| [Memory](swarms/memory/diy_memory) | [Docker Setup](swarms/install/docker_setup) | [Compliance Swarm for Customer Privacy](https://medium.com/@kyeg/building-compliance-agents-with-chroma-db-llama3-sop-prompting-0ed3e73559d2) | [Swarms Ecosystem](https://github.com/kyegomez/swarm-ecosystem) | +| [Tools](swarms/tools/main) | [Create Custom Tools](./how-to/Create-Custom-Tools) | [Self-Replicating Hierarchical Swarms](https://medium.com/@kyeg/announcing-neosapiens-self-replicating-swarms-0a47410aafa7) | [Support Team](https://cal.com/swarms/swarms-onboarding-session) | +| [Tasks](swarms/structs/task) | [Multi-Agent Flows](swarms/structs/agent_rearrange) | | [Book a 1 on 1 Call With Founder: Kye](https://cal.com/swarms/swarms-onboarding-session) | +| [Multi-Agent Orchestration](swarms/structs/agent_rearrange) | [Sequential Workflows](swarms/structs/sequential_workflow) | | | +| | [Connecting to LLMs](./how-to/LLM-Connections) | | | +| | [Customizing Agents](./how-to/Customizing-Agents) | | | +| | [Human Input on Execution](./how-to/Human-Input-on-Execution) | | | +| | [Agent Monitoring with AgentOps](./how-to/AgentOps-Observability) | | | \ No newline at end of file From c06528341b8eee3b0b0e467a8c2b5b550abf1a8c Mon Sep 17 00:00:00 2001 From: Kye Gomez Date: Sat, 8 Jun 2024 10:19:21 -0700 Subject: [PATCH 6/9] [DOCS] --- docs/mkdocs.yml | 84 +++++++++++++++++++++++-------------------------- 1 file changed, 40 insertions(+), 44 deletions(-) diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 9c037952..3b9f5e59 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -95,7 +95,7 @@ nav: - Install: "swarms/install/install.md" - Docker Setup: "swarms/install/docker_setup.md" - Usage Examples: - - Overview: "swarms/usage/index.md" # Explains how the framework is decomposed into agents, models, and swarms + - Overview: "swarms/usage/index.md" - Models: - How to Create A Custom Language Model: "swarms/models/custom_model.md" - Models Available: "swarms/models/index.md" @@ -116,35 +116,33 @@ nav: - List of The Best Multi-Agent Papers: "swarms/papers.md" - Contributors: - Contributing: "contributing.md" -- Reference: - - Overview: "swarms/index.md" - # - Framework Structure: "swarms/structs/tree.md" # Explains the tree structure of the framework and where things are located - - swarms.models: - - How to Create A Custom Language Model: "swarms/models/custom_model.md" - - Deploying Azure OpenAI in Production A Comprehensive Guide: "swarms/models/azure_openai.md" - - Language Models: - - BaseLLM: "swarms/models/base_llm.md" - - Overview: "swarms/models/index.md" - - HuggingFaceLLM: "swarms/models/huggingface.md" - - Anthropic: "swarms/models/anthropic.md" - - OpenAIChat: "swarms/models/openai.md" - - MultiModal Models : - - BaseMultiModalModel: "swarms/models/base_multimodal_model.md" - - Fuyu: "swarms/models/fuyu.md" - - Vilt: "swarms/models/vilt.md" - - Idefics: "swarms/models/idefics.md" - - Kosmos: "swarms/models/kosmos.md" - - Nougat: "swarms/models/nougat.md" - - Dalle3: "swarms/models/dalle3.md" - - GPT4VisionAPI: "swarms/models/gpt4v.md" - - GPT4o: "swarms/models/gpt4o.md" - - swarms.structs: + - Reference: + - Overview: "swarms/index.md" + - swarms.models: + - How to Create A Custom Language Model: "swarms/models/custom_model.md" + - Deploying Azure OpenAI in Production A Comprehensive Guide: "swarms/models/azure_openai.md" + - Language Models: + - BaseLLM: "swarms/models/base_llm.md" + - Overview: "swarms/models/index.md" + - HuggingFaceLLM: "swarms/models/huggingface.md" + - Anthropic: "swarms/models/anthropic.md" + - OpenAIChat: "swarms/models/openai.md" + - MultiModal Models : + - BaseMultiModalModel: "swarms/models/base_multimodal_model.md" + - Fuyu: "swarms/models/fuyu.md" + - Vilt: "swarms/models/vilt.md" + - Idefics: "swarms/models/idefics.md" + - Kosmos: "swarms/models/kosmos.md" + - Nougat: "swarms/models/nougat.md" + - Dalle3: "swarms/models/dalle3.md" + - GPT4VisionAPI: "swarms/models/gpt4v.md" + - GPT4o: "swarms/models/gpt4o.md" + - swarms.structs: - Foundational Structures: - Agent: "swarms/structs/agent.md" - BaseStructure: "swarms/structs/basestructure.md" - Task: "swarms/structs/task.md" - YamlModel: "swarms/structs/yaml_model.md" - # - BaseSwarm: "swarms/structs/base_swarm.md" - BaseWorkflow: "swarms/structs/baseworkflow.md" - Workflows: - ConcurrentWorkflow: "swarms/structs/concurrentworkflow.md" @@ -155,22 +153,20 @@ nav: - MajorityVoting: "swarms/structs/majorityvoting.md" - AgentRearrange: "swarms/structs/agent_rearrange.md" - RoundRobin: "swarms/structs/round_robin_swarm.md" -- Swarms Cloud API: - - Overview: "swarms_cloud/main.md" - - Available Models: "swarms_cloud/available_models.md" - - Migrate from OpenAI to Swarms in 3 lines of code: "swarms_cloud/migrate_openai.md" - - Getting Started with SOTA Vision Language Models VLM: "swarms_cloud/getting_started.md" - - Enterprise Guide to High-Performance Multi-Agent LLM Deployments: "swarms_cloud/production_deployment.md" - - Under The Hood The Swarm Cloud Serving Infrastructure: "swarms_cloud/architecture.md" -- Guides: - # - Building Custom Vector Memory Databases with the BaseVectorDatabase Class: "swarms/memory/diy_memory.md" - - Models: - - How to Create A Custom Language Model: "swarms/models/custom_model.md" - - Deploying Azure OpenAI in Production, A Comprehensive Guide: "swarms/models/azure_openai.md" - - Agents: - - Agent: "examples/flow.md" - - DIY Build Your Own Agent: "diy_your_own_agent.md" - - Equipping Autonomous Agents with Tools: "examples/tools_agent.md" - - Swarms: - - SequentialWorkflow: "examples/reliable_autonomous_agents.md" - + - Swarms Cloud API: + - Overview: "swarms_cloud/main.md" + - Available Models: "swarms_cloud/available_models.md" + - Migrate from OpenAI to Swarms in 3 lines of code: "swarms_cloud/migrate_openai.md" + - Getting Started with SOTA Vision Language Models VLM: "swarms_cloud/getting_started.md" + - Enterprise Guide to High-Performance Multi-Agent LLM Deployments: "swarms_cloud/production_deployment.md" + - Under The Hood The Swarm Cloud Serving Infrastructure: "swarms_cloud/architecture.md" + - Guides: + - Models: + - How to Create A Custom Language Model: "swarms/models/custom_model.md" + - Deploying Azure OpenAI in Production, A Comprehensive Guide: "swarms/models/azure_openai.md" + - Agents: + - Agent: "examples/flow.md" + - DIY Build Your Own Agent: "diy_your_own_agent.md" + - Equipping Autonomous Agents with Tools: "examples/tools_agent.md" + - Swarms: + - SequentialWorkflow: "examples/reliable_autonomous_agents.md" From ff874c7f7bbda08adfd69799b4f9e4967f1280d4 Mon Sep 17 00:00:00 2001 From: Kye Gomez Date: Sat, 8 Jun 2024 10:26:08 -0700 Subject: [PATCH 7/9] [DOCS] --- docs/mkdocs.yml | 135 ++++++++++++++++++++++++------------------------ 1 file changed, 67 insertions(+), 68 deletions(-) diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 3b9f5e59..e508ca96 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -90,83 +90,82 @@ markdown_extensions: - footnotes nav: - Home: - - Installation: - Overview: "index.md" - Install: "swarms/install/install.md" - Docker Setup: "swarms/install/docker_setup.md" - - Usage Examples: - - Overview: "swarms/usage/index.md" + - Usage Examples: + - Overview: "swarms/usage/index.md" # Explains how the framework is decomposed into agents, models, and swarms - Models: - - How to Create A Custom Language Model: "swarms/models/custom_model.md" - - Models Available: "swarms/models/index.md" - - MultiModal Models Available: "swarms/models/multimodal_models.md" + - How to Create A Custom Language Model: "swarms/models/custom_model.md" + - Models Available: "swarms/models/index.md" + - MultiModal Models Available: "swarms/models/multimodal_models.md" - Agents: - - Getting started with Agents: "swarms/structs/diy_your_own_agent.md" - - Tools: - - Functions, Pydantic BaseModels, and More: "swarms/tools/main.md" - - Memory: - - Building Custom Vector Memory Databases with the BaseVectorDatabase Class: "swarms/memory/diy_memory.md" - - ShortTermMemory: "swarms/memory/short_term_memory.md" + - Getting started with Agents: "swarms/structs/diy_your_own_agent.md" + - Tools: + - Functions, Pydantic BaseModels, and More: "swarms/tools/main.md" + - Memory: + - Building Custom Vector Memory Databases with the BaseVectorDatabase Class: "swarms/memory/diy_memory.md" + - ShortTermMemory: "swarms/memory/short_term_memory.md" - Multi-Agent Collaboration: - - SwarmNetwork: "swarms/structs/swarmnetwork.md" - - AgentRearrange: "swarms/structs/agent_rearrange.md" - - Why does Swarms Exist?: - - References: + - SwarmNetwork: "swarms/structs/swarmnetwork.md" + - AgentRearrange: "swarms/structs/agent_rearrange.md" + - Why does Swarms Exist?: "swarms/usage/why_swarms.md" + - References: - Agent Glossary: "swarms/glossary.md" - List of The Best Multi-Agent Papers: "swarms/papers.md" - - Contributors: + - Contributors: - Contributing: "contributing.md" - Reference: - - Overview: "swarms/index.md" - - swarms.models: - - How to Create A Custom Language Model: "swarms/models/custom_model.md" - - Deploying Azure OpenAI in Production A Comprehensive Guide: "swarms/models/azure_openai.md" - - Language Models: - - BaseLLM: "swarms/models/base_llm.md" - - Overview: "swarms/models/index.md" - - HuggingFaceLLM: "swarms/models/huggingface.md" - - Anthropic: "swarms/models/anthropic.md" - - OpenAIChat: "swarms/models/openai.md" - - MultiModal Models : - - BaseMultiModalModel: "swarms/models/base_multimodal_model.md" - - Fuyu: "swarms/models/fuyu.md" - - Vilt: "swarms/models/vilt.md" - - Idefics: "swarms/models/idefics.md" - - Kosmos: "swarms/models/kosmos.md" - - Nougat: "swarms/models/nougat.md" - - Dalle3: "swarms/models/dalle3.md" - - GPT4VisionAPI: "swarms/models/gpt4v.md" - - GPT4o: "swarms/models/gpt4o.md" - - swarms.structs: - - Foundational Structures: - - Agent: "swarms/structs/agent.md" - - BaseStructure: "swarms/structs/basestructure.md" - - Task: "swarms/structs/task.md" - - YamlModel: "swarms/structs/yaml_model.md" - - BaseWorkflow: "swarms/structs/baseworkflow.md" - - Workflows: - - ConcurrentWorkflow: "swarms/structs/concurrentworkflow.md" - - SequentialWorkflow: "swarms/structs/sequential_workflow.md" - - Multi Agent Architectures: - - Conversation: "swarms/structs/conversation.md" - - SwarmNetwork: "swarms/structs/swarmnetwork.md" - - MajorityVoting: "swarms/structs/majorityvoting.md" - - AgentRearrange: "swarms/structs/agent_rearrange.md" - - RoundRobin: "swarms/structs/round_robin_swarm.md" + - Overview: "swarms/index.md" + - swarms.models: + - How to Create A Custom Language Model: "swarms/models/custom_model.md" + - Deploying Azure OpenAI in Production A Comprehensive Guide: "swarms/models/azure_openai.md" + - Language Models: + - BaseLLM: "swarms/models/base_llm.md" + - Overview: "swarms/models/index.md" + - HuggingFaceLLM: "swarms/models/huggingface.md" + - Anthropic: "swarms/models/anthropic.md" + - OpenAIChat: "swarms/models/openai.md" + - MultiModal Models: + - BaseMultiModalModel: "swarms/models/base_multimodal_model.md" + - Fuyu: "swarms/models/fuyu.md" + - Vilt: "swarms/models/vilt.md" + - Idefics: "swarms/models/idefics.md" + - Kosmos: "swarms/models/kosmos.md" + - Nougat: "swarms/models/nougat.md" + - Dalle3: "swarms/models/dalle3.md" + - GPT4VisionAPI: "swarms/models/gpt4v.md" + - GPT4o: "swarms/models/gpt4o.md" + - swarms.structs: + - Foundational Structures: + - Agent: "swarms/structs/agent.md" + - BaseStructure: "swarms/structs/basestructure.md" + - Task: "swarms/structs/task.md" + - YamlModel: "swarms/structs/yaml_model.md" + - BaseWorkflow: "swarms/structs/baseworkflow.md" + - Workflows: + - ConcurrentWorkflow: "swarms/structs/concurrentworkflow.md" + - SequentialWorkflow: "swarms/structs/sequential_workflow.md" + - Multi Agent Architectures: + - Conversation: "swarms/structs/conversation.md" + - SwarmNetwork: "swarms/structs/swarmnetwork.md" + - MajorityVoting: "swarms/structs/majorityvoting.md" + - AgentRearrange: "swarms/structs/agent_rearrange.md" + - RoundRobin: "swarms/structs/round_robin_swarm.md" - Swarms Cloud API: - - Overview: "swarms_cloud/main.md" - - Available Models: "swarms_cloud/available_models.md" - - Migrate from OpenAI to Swarms in 3 lines of code: "swarms_cloud/migrate_openai.md" - - Getting Started with SOTA Vision Language Models VLM: "swarms_cloud/getting_started.md" - - Enterprise Guide to High-Performance Multi-Agent LLM Deployments: "swarms_cloud/production_deployment.md" - - Under The Hood The Swarm Cloud Serving Infrastructure: "swarms_cloud/architecture.md" + - Overview: "swarms_cloud/main.md" + - Available Models: "swarms_cloud/available_models.md" + - Migrate from OpenAI to Swarms in 3 lines of code: "swarms_cloud/migrate_openai.md" + - Getting Started with SOTA Vision Language Models VLM: "swarms_cloud/getting_started.md" + - Enterprise Guide to High-Performance Multi-Agent LLM Deployments: "swarms_cloud/production_deployment.md" + - Under The Hood The Swarm Cloud Serving Infrastructure: "swarms_cloud/architecture.md" - Guides: - - Models: - - How to Create A Custom Language Model: "swarms/models/custom_model.md" - - Deploying Azure OpenAI in Production, A Comprehensive Guide: "swarms/models/azure_openai.md" - - Agents: - - Agent: "examples/flow.md" - - DIY Build Your Own Agent: "diy_your_own_agent.md" - - Equipping Autonomous Agents with Tools: "examples/tools_agent.md" - - Swarms: - - SequentialWorkflow: "examples/reliable_autonomous_agents.md" + - Models: + - How to Create A Custom Language Model: "swarms/models/custom_model.md" + - Deploying Azure OpenAI in Production, A Comprehensive Guide: "swarms/models/azure_openai.md" + - Agents: + - Agent: "examples/flow.md" + - DIY Build Your Own Agent: "diy_your_own_agent.md" + - Equipping Autonomous Agents with Tools: "examples/tools_agent.md" + - Swarms: + - SequentialWorkflow: "examples/reliable_autonomous_agents.md" From d9f039e18a13a90baf625e682cea67c99a8961a9 Mon Sep 17 00:00:00 2001 From: Kye Gomez Date: Sat, 8 Jun 2024 10:28:56 -0700 Subject: [PATCH 8/9] [DOCS] --- docs/mkdocs.yml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index e508ca96..ff5dae8a 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -93,23 +93,23 @@ nav: - Overview: "index.md" - Install: "swarms/install/install.md" - Docker Setup: "swarms/install/docker_setup.md" - - Usage Examples: - - Overview: "swarms/usage/index.md" # Explains how the framework is decomposed into agents, models, and swarms - - Models: - - How to Create A Custom Language Model: "swarms/models/custom_model.md" - - Models Available: "swarms/models/index.md" - - MultiModal Models Available: "swarms/models/multimodal_models.md" - - Agents: - - Getting started with Agents: "swarms/structs/diy_your_own_agent.md" - - Tools: - - Functions, Pydantic BaseModels, and More: "swarms/tools/main.md" - - Memory: - - Building Custom Vector Memory Databases with the BaseVectorDatabase Class: "swarms/memory/diy_memory.md" - - ShortTermMemory: "swarms/memory/short_term_memory.md" - - Multi-Agent Collaboration: - - SwarmNetwork: "swarms/structs/swarmnetwork.md" - - AgentRearrange: "swarms/structs/agent_rearrange.md" - - Why does Swarms Exist?: "swarms/usage/why_swarms.md" + - Usage Examples: + - Overview: "swarms/usage/index.md" # Explains how the framework is decomposed into agents, models, and swarms + - Models: + - How to Create A Custom Language Model: "swarms/models/custom_model.md" + - Models Available: "swarms/models/index.md" + - MultiModal Models Available: "swarms/models/multimodal_models.md" + - Agents: + - Getting started with Agents: "swarms/structs/diy_your_own_agent.md" + - Tools: + - Functions, Pydantic BaseModels, and More: "swarms/tools/main.md" + - Memory: + - Building Custom Vector Memory Databases with the BaseVectorDatabase Class: "swarms/memory/diy_memory.md" + - ShortTermMemory: "swarms/memory/short_term_memory.md" + - Multi-Agent Collaboration: + - SwarmNetwork: "swarms/structs/swarmnetwork.md" + - AgentRearrange: "swarms/structs/agent_rearrange.md" + - Why does Swarms Exist?: "swarms/usage/why_swarms.md" - References: - Agent Glossary: "swarms/glossary.md" - List of The Best Multi-Agent Papers: "swarms/papers.md" From c952a2eebd175141621208d76dea2f675b67464e Mon Sep 17 00:00:00 2001 From: Kye Gomez Date: Sat, 8 Jun 2024 10:33:33 -0700 Subject: [PATCH 9/9] [CLEANUP][DOCS] --- docs/mkdocs.yml | 43 +++++++++++++++++-------------------------- 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index ff5dae8a..18c6a0a8 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -93,36 +93,15 @@ nav: - Overview: "index.md" - Install: "swarms/install/install.md" - Docker Setup: "swarms/install/docker_setup.md" - - Usage Examples: - - Overview: "swarms/usage/index.md" # Explains how the framework is decomposed into agents, models, and swarms - - Models: - - How to Create A Custom Language Model: "swarms/models/custom_model.md" - - Models Available: "swarms/models/index.md" - - MultiModal Models Available: "swarms/models/multimodal_models.md" - - Agents: - - Getting started with Agents: "swarms/structs/diy_your_own_agent.md" - - Tools: - - Functions, Pydantic BaseModels, and More: "swarms/tools/main.md" - - Memory: - - Building Custom Vector Memory Databases with the BaseVectorDatabase Class: "swarms/memory/diy_memory.md" - - ShortTermMemory: "swarms/memory/short_term_memory.md" - - Multi-Agent Collaboration: - - SwarmNetwork: "swarms/structs/swarmnetwork.md" - - AgentRearrange: "swarms/structs/agent_rearrange.md" - - Why does Swarms Exist?: "swarms/usage/why_swarms.md" - - References: - - Agent Glossary: "swarms/glossary.md" - - List of The Best Multi-Agent Papers: "swarms/papers.md" - - Contributors: - - Contributing: "contributing.md" - - Reference: + - Framework: - Overview: "swarms/index.md" - - swarms.models: + - Models: - How to Create A Custom Language Model: "swarms/models/custom_model.md" + - Models Available: "swarms/models/index.md" + - MultiModal Models Available: "swarms/models/multimodal_models.md" - Deploying Azure OpenAI in Production A Comprehensive Guide: "swarms/models/azure_openai.md" - Language Models: - BaseLLM: "swarms/models/base_llm.md" - - Overview: "swarms/models/index.md" - HuggingFaceLLM: "swarms/models/huggingface.md" - Anthropic: "swarms/models/anthropic.md" - OpenAIChat: "swarms/models/openai.md" @@ -136,7 +115,14 @@ nav: - Dalle3: "swarms/models/dalle3.md" - GPT4VisionAPI: "swarms/models/gpt4v.md" - GPT4o: "swarms/models/gpt4o.md" - - swarms.structs: + - Agents: + - Overview: "swarms/structs/diy_your_own_agent.md" + - Tools: + - Functions, Pydantic BaseModels, and More: "swarms/tools/main.md" + - Memory: + - Building Custom Vector Memory Databases with the BaseVectorDatabase Class: "swarms/memory/diy_memory.md" + - ShortTermMemory: "swarms/memory/short_term_memory.md" + - Structs: - Foundational Structures: - Agent: "swarms/structs/agent.md" - BaseStructure: "swarms/structs/basestructure.md" @@ -169,3 +155,8 @@ nav: - Equipping Autonomous Agents with Tools: "examples/tools_agent.md" - Swarms: - SequentialWorkflow: "examples/reliable_autonomous_agents.md" + - References: + - Agent Glossary: "swarms/glossary.md" + - List of The Best Multi-Agent Papers: "swarms/papers.md" + - Contributors: + - Contributing: "contributing.md"