diff --git a/setup.py b/setup.py index ae010e1a..e59e3756 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import setup, find_packages setup( name = 'swarms', packages = find_packages(exclude=[]), - version = '1.0.0', + version = '1.0.1', license='MIT', description = 'Swarms - Pytorch', author = 'Kye Gomez', diff --git a/swarms/__init__.py b/swarms/__init__.py index 629a11f2..6f6b97c4 100644 --- a/swarms/__init__.py +++ b/swarms/__init__.py @@ -1,6 +1,7 @@ # from swarms import Swarms, swarm from swarms.swarms import Swarms, swarm -from swarms.agents import worker_node -from swarms.agents.workers.worker_ultra_node import WorkerUltraNode, WorkerUltra -from swarms.agents.workers.worker_agent_ultra import worker_ultra_node -from swarms.agents.workers.WorkerNode import WorkerNode, worker_node \ No newline at end of file +from swarms.workers import worker_node +from swarms.workers.worker_ultra_node import WorkerUltraNode, WorkerUltra +from swarms.workers.worker_agent_ultra import worker_ultra_node +from swarms.workers.WorkerNode import WorkerNode, worker_node +from swarms.boss.boss_node import BossNode \ No newline at end of file diff --git a/swarms/agents/boss/__init__.py b/swarms/agents/prompts/chains/__init__.py similarity index 100% rename from swarms/agents/boss/__init__.py rename to swarms/agents/prompts/chains/__init__.py diff --git a/swarms/agents/prompts/chains/llm.py b/swarms/agents/prompts/chains/llm.py new file mode 100644 index 00000000..a6eba984 --- /dev/null +++ b/swarms/agents/prompts/chains/llm.py @@ -0,0 +1,340 @@ +"""Chain that just formats a prompt and calls an LLM.""" +from __future__ import annotations + +import warnings +from typing import Any, Dict, List, Optional, Sequence, Tuple, Union + +from pydantic import Extra, Field + +from langchain.callbacks.manager import ( + AsyncCallbackManager, + AsyncCallbackManagerForChainRun, + CallbackManager, + CallbackManagerForChainRun, + Callbacks, +) +from langchain.chains.base import Chain +from langchain.input import get_colored_text +from langchain.load.dump import dumpd +from langchain.prompts.prompt import PromptTemplate +from langchain.schema import ( + BaseLLMOutputParser, + BasePromptTemplate, + LLMResult, + NoOpOutputParser, + PromptValue, +) +from langchain.schema.language_model import BaseLanguageModel + + +class LLMChain(Chain): + """Chain to run queries against LLMs. + + Example: + .. code-block:: python + + from langchain import LLMChain, OpenAI, PromptTemplate + prompt_template = "Tell me a {adjective} joke" + prompt = PromptTemplate( + input_variables=["adjective"], template=prompt_template + ) + llm = LLMChain(llm=OpenAI(), prompt=prompt) + """ + + @property + def lc_serializable(self) -> bool: + return True + + prompt: BasePromptTemplate + """Prompt object to use.""" + llm: BaseLanguageModel + """Language model to call.""" + output_key: str = "text" #: :meta private: + output_parser: BaseLLMOutputParser = Field(default_factory=NoOpOutputParser) + """Output parser to use. + Defaults to one that takes the most likely string but does not change it + otherwise.""" + return_final_only: bool = True + """Whether to return only the final parsed result. Defaults to True. + If false, will return a bunch of extra information about the generation.""" + llm_kwargs: dict = Field(default_factory=dict) + + class Config: + """Configuration for this pydantic object.""" + + extra = Extra.forbid + arbitrary_types_allowed = True + + @property + def input_keys(self) -> List[str]: + """Will be whatever keys the prompt expects. + + :meta private: + """ + return self.prompt.input_variables + + @property + def output_keys(self) -> List[str]: + """Will always return text key. + + :meta private: + """ + if self.return_final_only: + return [self.output_key] + else: + return [self.output_key, "full_generation"] + + def _call( + self, + inputs: Dict[str, Any], + run_manager: Optional[CallbackManagerForChainRun] = None, + ) -> Dict[str, str]: + response = self.generate([inputs], run_manager=run_manager) + return self.create_outputs(response)[0] + + def generate( + self, + input_list: List[Dict[str, Any]], + run_manager: Optional[CallbackManagerForChainRun] = None, + ) -> LLMResult: + """Generate LLM result from inputs.""" + prompts, stop = self.prep_prompts(input_list, run_manager=run_manager) + return self.llm.generate_prompt( + prompts, + stop, + callbacks=run_manager.get_child() if run_manager else None, + **self.llm_kwargs, + ) + + async def agenerate( + self, + input_list: List[Dict[str, Any]], + run_manager: Optional[AsyncCallbackManagerForChainRun] = None, + ) -> LLMResult: + """Generate LLM result from inputs.""" + prompts, stop = await self.aprep_prompts(input_list, run_manager=run_manager) + return await self.llm.agenerate_prompt( + prompts, + stop, + callbacks=run_manager.get_child() if run_manager else None, + **self.llm_kwargs, + ) + + def prep_prompts( + self, + input_list: List[Dict[str, Any]], + run_manager: Optional[CallbackManagerForChainRun] = None, + ) -> Tuple[List[PromptValue], Optional[List[str]]]: + """Prepare prompts from inputs.""" + stop = None + if "stop" in input_list[0]: + stop = input_list[0]["stop"] + prompts = [] + for inputs in input_list: + selected_inputs = {k: inputs[k] for k in self.prompt.input_variables} + prompt = self.prompt.format_prompt(**selected_inputs) + _colored_text = get_colored_text(prompt.to_string(), "green") + _text = "Prompt after formatting:\n" + _colored_text + if run_manager: + run_manager.on_text(_text, end="\n", verbose=self.verbose) + if "stop" in inputs and inputs["stop"] != stop: + raise ValueError( + "If `stop` is present in any inputs, should be present in all." + ) + prompts.append(prompt) + return prompts, stop + + async def aprep_prompts( + self, + input_list: List[Dict[str, Any]], + run_manager: Optional[AsyncCallbackManagerForChainRun] = None, + ) -> Tuple[List[PromptValue], Optional[List[str]]]: + """Prepare prompts from inputs.""" + stop = None + if "stop" in input_list[0]: + stop = input_list[0]["stop"] + prompts = [] + for inputs in input_list: + selected_inputs = {k: inputs[k] for k in self.prompt.input_variables} + prompt = self.prompt.format_prompt(**selected_inputs) + _colored_text = get_colored_text(prompt.to_string(), "green") + _text = "Prompt after formatting:\n" + _colored_text + if run_manager: + await run_manager.on_text(_text, end="\n", verbose=self.verbose) + if "stop" in inputs and inputs["stop"] != stop: + raise ValueError( + "If `stop` is present in any inputs, should be present in all." + ) + prompts.append(prompt) + return prompts, stop + + def apply( + self, input_list: List[Dict[str, Any]], callbacks: Callbacks = None + ) -> List[Dict[str, str]]: + """Utilize the LLM generate method for speed gains.""" + callback_manager = CallbackManager.configure( + callbacks, self.callbacks, self.verbose + ) + run_manager = callback_manager.on_chain_start( + dumpd(self), + {"input_list": input_list}, + ) + try: + response = self.generate(input_list, run_manager=run_manager) + except (KeyboardInterrupt, Exception) as e: + run_manager.on_chain_error(e) + raise e + outputs = self.create_outputs(response) + run_manager.on_chain_end({"outputs": outputs}) + return outputs + + async def aapply( + self, input_list: List[Dict[str, Any]], callbacks: Callbacks = None + ) -> List[Dict[str, str]]: + """Utilize the LLM generate method for speed gains.""" + callback_manager = AsyncCallbackManager.configure( + callbacks, self.callbacks, self.verbose + ) + run_manager = await callback_manager.on_chain_start( + dumpd(self), + {"input_list": input_list}, + ) + try: + response = await self.agenerate(input_list, run_manager=run_manager) + except (KeyboardInterrupt, Exception) as e: + await run_manager.on_chain_error(e) + raise e + outputs = self.create_outputs(response) + await run_manager.on_chain_end({"outputs": outputs}) + return outputs + + @property + def _run_output_key(self) -> str: + return self.output_key + + def create_outputs(self, llm_result: LLMResult) -> List[Dict[str, Any]]: + """Create outputs from response.""" + result = [ + # Get the text of the top generated string. + { + self.output_key: self.output_parser.parse_result(generation), + "full_generation": generation, + } + for generation in llm_result.generations + ] + if self.return_final_only: + result = [{self.output_key: r[self.output_key]} for r in result] + return result + + async def _acall( + self, + inputs: Dict[str, Any], + run_manager: Optional[AsyncCallbackManagerForChainRun] = None, + ) -> Dict[str, str]: + response = await self.agenerate([inputs], run_manager=run_manager) + return self.create_outputs(response)[0] + + def predict(self, callbacks: Callbacks = None, **kwargs: Any) -> str: + """Format prompt with kwargs and pass to LLM. + + Args: + callbacks: Callbacks to pass to LLMChain + **kwargs: Keys to pass to prompt template. + + Returns: + Completion from LLM. + + Example: + .. code-block:: python + + completion = llm.predict(adjective="funny") + """ + return self(kwargs, callbacks=callbacks)[self.output_key] + + async def apredict(self, callbacks: Callbacks = None, **kwargs: Any) -> str: + """Format prompt with kwargs and pass to LLM. + + Args: + callbacks: Callbacks to pass to LLMChain + **kwargs: Keys to pass to prompt template. + + Returns: + Completion from LLM. + + Example: + .. code-block:: python + + completion = llm.predict(adjective="funny") + """ + return (await self.acall(kwargs, callbacks=callbacks))[self.output_key] + + def predict_and_parse( + self, callbacks: Callbacks = None, **kwargs: Any + ) -> Union[str, List[str], Dict[str, Any]]: + """Call predict and then parse the results.""" + warnings.warn( + "The predict_and_parse method is deprecated, " + "instead pass an output parser directly to LLMChain." + ) + result = self.predict(callbacks=callbacks, **kwargs) + if self.prompt.output_parser is not None: + return self.prompt.output_parser.parse(result) + else: + return result + + async def apredict_and_parse( + self, callbacks: Callbacks = None, **kwargs: Any + ) -> Union[str, List[str], Dict[str, str]]: + """Call apredict and then parse the results.""" + warnings.warn( + "The apredict_and_parse method is deprecated, " + "instead pass an output parser directly to LLMChain." + ) + result = await self.apredict(callbacks=callbacks, **kwargs) + if self.prompt.output_parser is not None: + return self.prompt.output_parser.parse(result) + else: + return result + + def apply_and_parse( + self, input_list: List[Dict[str, Any]], callbacks: Callbacks = None + ) -> Sequence[Union[str, List[str], Dict[str, str]]]: + """Call apply and then parse the results.""" + warnings.warn( + "The apply_and_parse method is deprecated, " + "instead pass an output parser directly to LLMChain." + ) + result = self.apply(input_list, callbacks=callbacks) + return self._parse_generation(result) + + def _parse_generation( + self, generation: List[Dict[str, str]] + ) -> Sequence[Union[str, List[str], Dict[str, str]]]: + if self.prompt.output_parser is not None: + return [ + self.prompt.output_parser.parse(res[self.output_key]) + for res in generation + ] + else: + return generation + + async def aapply_and_parse( + self, input_list: List[Dict[str, Any]], callbacks: Callbacks = None + ) -> Sequence[Union[str, List[str], Dict[str, str]]]: + """Call apply and then parse the results.""" + warnings.warn( + "The aapply_and_parse method is deprecated, " + "instead pass an output parser directly to LLMChain." + ) + result = await self.aapply(input_list, callbacks=callbacks) + return self._parse_generation(result) + + @property + def _chain_type(self) -> str: + return "llm_chain" + + @classmethod + def from_string(cls, llm: BaseLanguageModel, template: str) -> LLMChain: + """Create LLMChain from LLM and template.""" + prompt_template = PromptTemplate.from_template(template) + return cls(llm=llm, prompt=prompt_template) \ No newline at end of file diff --git a/swarms/agents/workers/PromptWorker.py b/swarms/agents/workers/PromptWorker.py deleted file mode 100644 index 22039c5e..00000000 --- a/swarms/agents/workers/PromptWorker.py +++ /dev/null @@ -1,99 +0,0 @@ -from langchain import OpenAI, LLMChain, PromptTemplate -from langchain.memory import ConversationBufferWindowMemory - -def initialize_chain(instructions, memory=None): - if memory is None: - memory = ConversationBufferWindowMemory() - memory.ai_prefix = "Assistant" - - template = f""" - Instructions: {instructions} - {{{memory.memory_key}}} - Human: {{human_input}} - Assistant:""" - - prompt = PromptTemplate( - input_variables=["history", "human_input"], template=template - ) - - chain = LLMChain( - llm=OpenAI(temperature=0), - prompt=prompt, - verbose=True, - memory=ConversationBufferWindowMemory(), - ) - return chain - - -def initialize_meta_chain(): - meta_template = """ - Assistant has just had the below interactions with a User. Assistant followed their "Instructions" closely. Your job is to critique the Assistant's performance and then revise the Instructions so that Assistant would quickly and correctly respond in the future. - - #### - - {chat_history} - - #### - - Please reflect on these interactions. - - You should first critique Assistant's performance. What could Assistant have done better? What should the Assistant remember about this user? Are there things this user always wants? Indicate this with "Critique: ...". - - You should next revise the Instructions so that Assistant would quickly and correctly respond in the future. Assistant's goal is to satisfy the user in as few interactions as possible. Assistant will only see the new Instructions, not the interaction history, so anything important must be summarized in the Instructions. Don't forget any important details in the current Instructions! Indicate the new Instructions by "Instructions: ...". - """ - - meta_prompt = PromptTemplate( - input_variables=["chat_history"], template=meta_template - ) - - meta_chain = LLMChain( - llm=OpenAI(temperature=0), - prompt=meta_prompt, - verbose=True, - ) - return meta_chain - - -def get_chat_history(chain_memory): - memory_key = chain_memory.memory_key - chat_history = chain_memory.load_memory_variables(memory_key)[memory_key] - return chat_history - - -def get_new_instructions(meta_output): - delimiter = "Instructions: " - new_instructions = meta_output[meta_output.find(delimiter) + len(delimiter) :] - return new_instructions - -def meta_agent(task, max_iters=3, max_meta_iters=5): - failed_phrase = "task failed" - success_phrase = "task succeeded" - key_phrases = [success_phrase, failed_phrase] - - instructions = "None" - for i in range(max_meta_iters): - print(f"[Episode {i+1}/{max_meta_iters}]") - chain = initialize_chain(instructions, memory=None) - output = chain.predict(human_input=task) - for j in range(max_iters): - print(f"(Step {j+1}/{max_iters})") - print(f"Assistant: {output}") - print(f"Human: ") - human_input = input() - if any(phrase in human_input.lower() for phrase in key_phrases): - break - output = chain.predict(human_input=human_input) - if success_phrase in human_input.lower(): - print(f"You succeeded! Thanks for playing!") - return - meta_chain = initialize_meta_chain() - meta_output = meta_chain.predict(chat_history=get_chat_history(chain.memory)) - print(f"Feedback: {meta_output}") - instructions = get_new_instructions(meta_output) - print(f"New Instructions: {instructions}") - print("\n" + "#" * 80 + "\n") - print(f"You failed! Thanks for playing!") - - -task = "Provide a systematic argument for why we should always eat pasta with olives." -meta_agent(task) \ No newline at end of file diff --git a/swarms/agents/workers/multi_modal_workers/__init__.py b/swarms/agents/workers/multi_modal_workers/__init__.py deleted file mode 100644 index 165ac62c..00000000 --- a/swarms/agents/workers/multi_modal_workers/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from swarms.agents.workers.multi_modal_workers.omni_agent.omni_chat import chat_huggingface \ No newline at end of file diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/__init__.py b/swarms/boss/__init__.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/__init__.py rename to swarms/boss/__init__.py diff --git a/swarms/agents/boss/BossNode.py b/swarms/boss/boss_node.py similarity index 100% rename from swarms/agents/boss/BossNode.py rename to swarms/boss/boss_node.py diff --git a/swarms/swarms.py b/swarms/swarms.py index af814247..72be779b 100644 --- a/swarms/swarms.py +++ b/swarms/swarms.py @@ -3,9 +3,9 @@ import asyncio # from swarms.agents.tools.agent_tools import * from swarms.agents.tools.agent_tools import * -from swarms.agents.workers.WorkerNode import WorkerNodeInitializer, worker_node -from swarms.agents.boss.BossNode import BossNodeInitializer as BossNode -from swarms.agents.workers.worker_ultra_node import WorkerUltra +from swarms.workers.WorkerNode import WorkerNodeInitializer, worker_node +from swarms.boss.boss_node import BossNodeInitializer as BossNode +from swarms.workers.worker_ultra_node import WorkerUltra from langchain import LLMMathChain diff --git a/swarms/utils/README.md b/swarms/utils/README.md index e50b7657..8934d6f2 100644 --- a/swarms/utils/README.md +++ b/swarms/utils/README.md @@ -104,7 +104,7 @@ from langchain.vectorstores import FAISS from langchain.docstore import InMemoryDocstore from langchain.embeddings import OpenAIEmbeddings import faiss -from swarms.agents.workers.auto_agent import AutoGPT +from swarms.workers.auto_agent import AutoGPT from collections import deque from typing import Dict, Any diff --git a/swarms/agents/workers/WorkerNode.py b/swarms/workers/WorkerNode.py similarity index 100% rename from swarms/agents/workers/WorkerNode.py rename to swarms/workers/WorkerNode.py diff --git a/swarms/agents/workers/__init__.py b/swarms/workers/__init__.py similarity index 100% rename from swarms/agents/workers/__init__.py rename to swarms/workers/__init__.py diff --git a/swarms/workers/character_generative.py b/swarms/workers/character_generative.py new file mode 100644 index 00000000..1004bd23 --- /dev/null +++ b/swarms/workers/character_generative.py @@ -0,0 +1,268 @@ +import re +from datetime import datetime +from typing import Any, Dict, List, Optional, Tuple + +from pydantic import BaseModel, Field + +from langchain.chains import LLMChain +from langchain.prompts import PromptTemplate +from langchain.experimental.generative_agents.memory import GenerativeAgentMemory + +from swarms.utils.schema.base import BaseLanguageModel + +# TODO: Add ability to integrate with tools +# TODO: Replace with f strings and all PromptTemplate + +class WorkerCharacterAgent(BaseModel): + """A character with memory and innate characteristics.""" + + name: str + """The character's name.""" + + age: Optional[int] = None + """The optional age of the character.""" + traits: str = "N/A" + """Permanent traits to ascribe to the character.""" + status: str + """The traits of the character you wish not to change.""" + memory: GenerativeAgentMemory + """The memory object that combines relevance, recency, and 'importance'.""" + llm: BaseLanguageModel + """The underlying language model.""" + verbose: bool = False + summary: str = "" #: :meta private: + """Stateful self-summary generated via reflection on the character's memory.""" + + summary_refresh_seconds: int = 3600 #: :meta private: + """How frequently to re-generate the summary.""" + + last_refreshed: datetime = Field(default_factory=datetime.now) # : :meta private: + """The last time the character's summary was regenerated.""" + + daily_summaries: List[str] = Field(default_factory=list) # : :meta private: + """Summary of the events in the plan that the agent took.""" + + class Config: + """Configuration for this pydantic object.""" + + arbitrary_types_allowed = True + + # LLM-related methods + @staticmethod + def _parse_list(text: str) -> List[str]: + """Parse a newline-separated string into a list of strings.""" + lines = re.split(r"\n", text.strip()) + return [re.sub(r"^\s*\d+\.\s*", "", line).strip() for line in lines] + + def chain(self, prompt: str) -> LLMChain: + return LLMChain( + llm=self.llm, prompt=prompt, verbose=self.verbose, memory=self.memory + ) + + def _get_entity_from_observation(self, observation: str) -> str: + # prompt = PromptTemplate.from_template( + # "What is the observed entity in the following observation? {observation}" + # + "\nEntity=" + # ) + # return self.chain(prompt).run(observation=observation).strip() + prompt = self.chain(f"What is the observed entity in the following observation? {observation}\n Entity=").strip() + return prompt + + def _get_entity_action(self, observation: str, entity_name: str) -> str: + # prompt = PromptTemplate.from_template( + # "What is the {entity} doing in the following observation? {observation}" + # + "\nThe {entity} is" + # ) + # return ( + # self.chain(prompt).run(entity=entity_name, observation=observation).strip() + # ) + return self.chain(f"What is the {entity_name} doing in the following observation {observation}\n The {entity_name} is?").strip() + + + + # TODO: Replace with f strings and all PromptTemplate + def summarize_related_memories(self, observation: str) -> str: + """Summarize memories that are most relevant to an observation.""" + prompt = f""" + {q1} + Context from Memory: + {relevant_memories} + Relevant Context: + + """ + prompt = PromptTemplate.from_template( + """ + {q1}? + Context from memory: + {relevant_memories} + Relevant context: + """ + ) + entity_name = self._get_entity_from_observation(observation) + entity_action = self._get_entity_action(observation, entity_name) + q1 = f"What is the relationship between {self.name} and {entity_name}" + q2 = f"{entity_name} is {entity_action}" + return self.chain(prompt=prompt).run(q1=q1, queries=[q1, q2]).strip() + + def _generate_reaction( + self, observation: str, suffix: str, now: Optional[datetime] = None + ) -> str: + """React to a given observation or dialogue act.""" + prompt = PromptTemplate.from_template( + "{agent_summary_description}" + + "\nIt is {current_time}." + + "\n{agent_name}'s status: {agent_status}" + + "\nSummary of relevant context from {agent_name}'s memory:" + + "\n{relevant_memories}" + + "\nMost recent observations: {most_recent_memories}" + + "\nObservation: {observation}" + + "\n\n" + + suffix + ) + agent_summary_description = self.get_summary(now=now) + relevant_memories_str = self.summarize_related_memories(observation) + current_time_str = ( + datetime.now().strftime("%B %d, %Y, %I:%M %p") + if now is None + else now.strftime("%B %d, %Y, %I:%M %p") + ) + kwargs: Dict[str, Any] = dict( + agent_summary_description=agent_summary_description, + current_time=current_time_str, + relevant_memories=relevant_memories_str, + agent_name=self.name, + observation=observation, + agent_status=self.status, + ) + consumed_tokens = self.llm.get_num_tokens( + prompt.format(most_recent_memories="", **kwargs) + ) + kwargs[self.memory.most_recent_memories_token_key] = consumed_tokens + return self.chain(prompt=prompt).run(**kwargs).strip() + + def _clean_response(self, text: str) -> str: + return re.sub(f"^{self.name} ", "", text.strip()).strip() + + def generate_reaction( + self, observation: str, now: Optional[datetime] = None + ) -> Tuple[bool, str]: + """React to a given observation.""" + call_to_action_template = ( + "Should {agent_name} react to the observation, and if so," + + " what would be an appropriate reaction? Respond in one line." + + ' If the action is to engage in dialogue, write:\nSAY: "what to say"' + + "\notherwise, write:\nREACT: {agent_name}'s reaction (if anything)." + + "\nEither do nothing, react, or say something but not both.\n\n" + ) + full_result = self._generate_reaction( + observation, call_to_action_template, now=now + ) + result = full_result.strip().split("\n")[0] + # AAA + self.memory.save_context( + {}, + { + self.memory.add_memory_key: f"{self.name} observed " + f"{observation} and reacted by {result}", + self.memory.now_key: now, + }, + ) + if "REACT:" in result: + reaction = self._clean_response(result.split("REACT:")[-1]) + return False, f"{self.name} {reaction}" + if "SAY:" in result: + said_value = self._clean_response(result.split("SAY:")[-1]) + return True, f"{self.name} said {said_value}" + else: + return False, result + + def generate_dialogue_response( + self, observation: str, now: Optional[datetime] = None + ) -> Tuple[bool, str]: + """React to a given observation.""" + call_to_action_template = ( + "What would {agent_name} say? To end the conversation, write:" + ' GOODBYE: "what to say". Otherwise to continue the conversation,' + ' write: SAY: "what to say next"\n\n' + ) + full_result = self._generate_reaction( + observation, call_to_action_template, now=now + ) + result = full_result.strip().split("\n")[0] + if "GOODBYE:" in result: + farewell = self._clean_response(result.split("GOODBYE:")[-1]) + self.memory.save_context( + {}, + { + self.memory.add_memory_key: f"{self.name} observed " + f"{observation} and said {farewell}", + self.memory.now_key: now, + }, + ) + return False, f"{self.name} said {farewell}" + if "SAY:" in result: + response_text = self._clean_response(result.split("SAY:")[-1]) + self.memory.save_context( + {}, + { + self.memory.add_memory_key: f"{self.name} observed " + f"{observation} and said {response_text}", + self.memory.now_key: now, + }, + ) + return True, f"{self.name} said {response_text}" + else: + return False, result + + ###################################################### + # Agent stateful' summary methods. # + # Each dialog or response prompt includes a header # + # summarizing the agent's self-description. This is # + # updated periodically through probing its memories # + ###################################################### + def _compute_agent_summary(self) -> str: + """""" + prompt = PromptTemplate.from_template( + "How would you summarize {name}'s core characteristics given the" + + " following statements:\n" + + "{relevant_memories}" + + "Do not embellish." + + "\n\nSummary: " + ) + # The agent seeks to think about their core characteristics. + return ( + self.chain(prompt) + .run(name=self.name, queries=[f"{self.name}'s core characteristics"]) + .strip() + ) + + def get_summary( + self, force_refresh: bool = False, now: Optional[datetime] = None + ) -> str: + """Return a descriptive summary of the agent.""" + current_time = datetime.now() if now is None else now + since_refresh = (current_time - self.last_refreshed).seconds + if ( + not self.summary + or since_refresh >= self.summary_refresh_seconds + or force_refresh + ): + self.summary = self._compute_agent_summary() + self.last_refreshed = current_time + age = self.age if self.age is not None else "N/A" + return ( + f"Name: {self.name} (age: {age})" + + f"\nInnate traits: {self.traits}" + + f"\n{self.summary}" + ) + + def get_full_header( + self, force_refresh: bool = False, now: Optional[datetime] = None + ) -> str: + """Return a full header of the agent's status, summary, and current time.""" + now = datetime.now() if now is None else now + summary = self.get_summary(force_refresh=force_refresh, now=now) + current_time_str = now.strftime("%B %d, %Y, %I:%M %p") + return ( + f"{summary}\nIt is {current_time_str}.\n{self.name}'s status: {self.status}" + ) \ No newline at end of file diff --git a/swarms/agents/workers/generative_worker.py b/swarms/workers/generative_worker.py similarity index 100% rename from swarms/agents/workers/generative_worker.py rename to swarms/workers/generative_worker.py diff --git a/swarms/agents/workers/models/GroundingDINO/.asset/COCO.png b/swarms/workers/models/GroundingDINO/.asset/COCO.png similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/.asset/COCO.png rename to swarms/workers/models/GroundingDINO/.asset/COCO.png diff --git a/swarms/agents/workers/models/GroundingDINO/.asset/GD_GLIGEN.png b/swarms/workers/models/GroundingDINO/.asset/GD_GLIGEN.png similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/.asset/GD_GLIGEN.png rename to swarms/workers/models/GroundingDINO/.asset/GD_GLIGEN.png diff --git a/swarms/agents/workers/models/GroundingDINO/.asset/GD_SD.png b/swarms/workers/models/GroundingDINO/.asset/GD_SD.png similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/.asset/GD_SD.png rename to swarms/workers/models/GroundingDINO/.asset/GD_SD.png diff --git a/swarms/agents/workers/models/GroundingDINO/.asset/ODinW.png b/swarms/workers/models/GroundingDINO/.asset/ODinW.png similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/.asset/ODinW.png rename to swarms/workers/models/GroundingDINO/.asset/ODinW.png diff --git a/swarms/agents/workers/models/GroundingDINO/.asset/arch.png b/swarms/workers/models/GroundingDINO/.asset/arch.png similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/.asset/arch.png rename to swarms/workers/models/GroundingDINO/.asset/arch.png diff --git a/swarms/agents/workers/models/GroundingDINO/.asset/cat_dog.jpeg b/swarms/workers/models/GroundingDINO/.asset/cat_dog.jpeg similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/.asset/cat_dog.jpeg rename to swarms/workers/models/GroundingDINO/.asset/cat_dog.jpeg diff --git a/swarms/agents/workers/models/GroundingDINO/.asset/cats.png b/swarms/workers/models/GroundingDINO/.asset/cats.png similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/.asset/cats.png rename to swarms/workers/models/GroundingDINO/.asset/cats.png diff --git a/swarms/agents/workers/models/GroundingDINO/.asset/grounding_dino_logo.png b/swarms/workers/models/GroundingDINO/.asset/grounding_dino_logo.png similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/.asset/grounding_dino_logo.png rename to swarms/workers/models/GroundingDINO/.asset/grounding_dino_logo.png diff --git a/swarms/agents/workers/models/GroundingDINO/.asset/hero_figure.png b/swarms/workers/models/GroundingDINO/.asset/hero_figure.png similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/.asset/hero_figure.png rename to swarms/workers/models/GroundingDINO/.asset/hero_figure.png diff --git a/swarms/agents/workers/models/GroundingDINO/.asset/model_explan1.PNG b/swarms/workers/models/GroundingDINO/.asset/model_explan1.PNG similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/.asset/model_explan1.PNG rename to swarms/workers/models/GroundingDINO/.asset/model_explan1.PNG diff --git a/swarms/agents/workers/models/GroundingDINO/.asset/model_explan2.PNG b/swarms/workers/models/GroundingDINO/.asset/model_explan2.PNG similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/.asset/model_explan2.PNG rename to swarms/workers/models/GroundingDINO/.asset/model_explan2.PNG diff --git a/swarms/agents/workers/models/GroundingDINO/.gitignore b/swarms/workers/models/GroundingDINO/.gitignore similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/.gitignore rename to swarms/workers/models/GroundingDINO/.gitignore diff --git a/swarms/agents/workers/models/GroundingDINO/LICENSE b/swarms/workers/models/GroundingDINO/LICENSE similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/LICENSE rename to swarms/workers/models/GroundingDINO/LICENSE diff --git a/swarms/agents/workers/models/GroundingDINO/README.md b/swarms/workers/models/GroundingDINO/README.md similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/README.md rename to swarms/workers/models/GroundingDINO/README.md diff --git a/swarms/agents/workers/models/GroundingDINO/__init__.py b/swarms/workers/models/GroundingDINO/__init__.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/__init__.py rename to swarms/workers/models/GroundingDINO/__init__.py diff --git a/swarms/agents/workers/models/GroundingDINO/demo/create_coco_dataset.py b/swarms/workers/models/GroundingDINO/demo/create_coco_dataset.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/demo/create_coco_dataset.py rename to swarms/workers/models/GroundingDINO/demo/create_coco_dataset.py diff --git a/swarms/agents/workers/models/GroundingDINO/demo/gradio_app.py b/swarms/workers/models/GroundingDINO/demo/gradio_app.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/demo/gradio_app.py rename to swarms/workers/models/GroundingDINO/demo/gradio_app.py diff --git a/swarms/agents/workers/models/GroundingDINO/demo/image_editing_with_groundingdino_gligen.ipynb b/swarms/workers/models/GroundingDINO/demo/image_editing_with_groundingdino_gligen.ipynb similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/demo/image_editing_with_groundingdino_gligen.ipynb rename to swarms/workers/models/GroundingDINO/demo/image_editing_with_groundingdino_gligen.ipynb diff --git a/swarms/agents/workers/models/GroundingDINO/demo/image_editing_with_groundingdino_stablediffusion.ipynb b/swarms/workers/models/GroundingDINO/demo/image_editing_with_groundingdino_stablediffusion.ipynb similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/demo/image_editing_with_groundingdino_stablediffusion.ipynb rename to swarms/workers/models/GroundingDINO/demo/image_editing_with_groundingdino_stablediffusion.ipynb diff --git a/swarms/agents/workers/models/GroundingDINO/demo/inference_on_a_image.py b/swarms/workers/models/GroundingDINO/demo/inference_on_a_image.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/demo/inference_on_a_image.py rename to swarms/workers/models/GroundingDINO/demo/inference_on_a_image.py diff --git a/swarms/agents/workers/models/GroundingDINO/demo/test_ap_on_coco.py b/swarms/workers/models/GroundingDINO/demo/test_ap_on_coco.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/demo/test_ap_on_coco.py rename to swarms/workers/models/GroundingDINO/demo/test_ap_on_coco.py diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/config/__init__.py b/swarms/workers/models/GroundingDINO/groundingdino/__init__.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/config/__init__.py rename to swarms/workers/models/GroundingDINO/groundingdino/__init__.py diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/config/GroundingDINO_SwinB_cfg.py b/swarms/workers/models/GroundingDINO/groundingdino/config/GroundingDINO_SwinB_cfg.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/config/GroundingDINO_SwinB_cfg.py rename to swarms/workers/models/GroundingDINO/groundingdino/config/GroundingDINO_SwinB_cfg.py diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/config/GroundingDINO_SwinT_OGC.py b/swarms/workers/models/GroundingDINO/groundingdino/config/GroundingDINO_SwinT_OGC.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/config/GroundingDINO_SwinT_OGC.py rename to swarms/workers/models/GroundingDINO/groundingdino/config/GroundingDINO_SwinT_OGC.py diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/datasets/__init__.py b/swarms/workers/models/GroundingDINO/groundingdino/config/__init__.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/datasets/__init__.py rename to swarms/workers/models/GroundingDINO/groundingdino/config/__init__.py diff --git a/swarms/agents/workers/multi_modal_workers/omni_agent/__init__.py b/swarms/workers/models/GroundingDINO/groundingdino/datasets/__init__.py similarity index 100% rename from swarms/agents/workers/multi_modal_workers/omni_agent/__init__.py rename to swarms/workers/models/GroundingDINO/groundingdino/datasets/__init__.py diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/datasets/cocogrounding_eval.py b/swarms/workers/models/GroundingDINO/groundingdino/datasets/cocogrounding_eval.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/datasets/cocogrounding_eval.py rename to swarms/workers/models/GroundingDINO/groundingdino/datasets/cocogrounding_eval.py diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/datasets/transforms.py b/swarms/workers/models/GroundingDINO/groundingdino/datasets/transforms.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/datasets/transforms.py rename to swarms/workers/models/GroundingDINO/groundingdino/datasets/transforms.py diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/__init__.py b/swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/__init__.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/__init__.py rename to swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/__init__.py diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/backbone/__init__.py b/swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/backbone/__init__.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/backbone/__init__.py rename to swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/backbone/__init__.py diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/backbone/backbone.py b/swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/backbone/backbone.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/backbone/backbone.py rename to swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/backbone/backbone.py diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/backbone/position_encoding.py b/swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/backbone/position_encoding.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/backbone/position_encoding.py rename to swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/backbone/position_encoding.py diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/backbone/swin_transformer.py b/swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/backbone/swin_transformer.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/backbone/swin_transformer.py rename to swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/backbone/swin_transformer.py diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/bertwarper.py b/swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/bertwarper.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/bertwarper.py rename to swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/bertwarper.py diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn.h b/swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn.h similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn.h rename to swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn.h diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cpu.cpp b/swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cpu.cpp similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cpu.cpp rename to swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cpu.cpp diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cpu.h b/swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cpu.h similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cpu.h rename to swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cpu.h diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cuda.cu b/swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cuda.cu similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cuda.cu rename to swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cuda.cu diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cuda.h b/swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cuda.h similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cuda.h rename to swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_attn_cuda.h diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_im2col_cuda.cuh b/swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_im2col_cuda.cuh similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_im2col_cuda.cuh rename to swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/csrc/MsDeformAttn/ms_deform_im2col_cuda.cuh diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/csrc/cuda_version.cu b/swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/csrc/cuda_version.cu similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/csrc/cuda_version.cu rename to swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/csrc/cuda_version.cu diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/csrc/vision.cpp b/swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/csrc/vision.cpp similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/csrc/vision.cpp rename to swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/csrc/vision.cpp diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/fuse_modules.py b/swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/fuse_modules.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/fuse_modules.py rename to swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/fuse_modules.py diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/groundingdino.py b/swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/groundingdino.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/groundingdino.py rename to swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/groundingdino.py diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/ms_deform_attn.py b/swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/ms_deform_attn.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/ms_deform_attn.py rename to swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/ms_deform_attn.py diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/transformer.py b/swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/transformer.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/transformer.py rename to swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/transformer.py diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/transformer_vanilla.py b/swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/transformer_vanilla.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/transformer_vanilla.py rename to swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/transformer_vanilla.py diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/utils.py b/swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/utils.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/utils.py rename to swarms/workers/models/GroundingDINO/groundingdino/models/GroundingDINO/utils.py diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/models/__init__.py b/swarms/workers/models/GroundingDINO/groundingdino/models/__init__.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/models/__init__.py rename to swarms/workers/models/GroundingDINO/groundingdino/models/__init__.py diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/models/registry.py b/swarms/workers/models/GroundingDINO/groundingdino/models/registry.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/models/registry.py rename to swarms/workers/models/GroundingDINO/groundingdino/models/registry.py diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/util/__init__.py b/swarms/workers/models/GroundingDINO/groundingdino/util/__init__.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/util/__init__.py rename to swarms/workers/models/GroundingDINO/groundingdino/util/__init__.py diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/util/box_ops.py b/swarms/workers/models/GroundingDINO/groundingdino/util/box_ops.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/util/box_ops.py rename to swarms/workers/models/GroundingDINO/groundingdino/util/box_ops.py diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/util/get_tokenlizer.py b/swarms/workers/models/GroundingDINO/groundingdino/util/get_tokenlizer.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/util/get_tokenlizer.py rename to swarms/workers/models/GroundingDINO/groundingdino/util/get_tokenlizer.py diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/util/inference.py b/swarms/workers/models/GroundingDINO/groundingdino/util/inference.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/util/inference.py rename to swarms/workers/models/GroundingDINO/groundingdino/util/inference.py diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/util/logger.py b/swarms/workers/models/GroundingDINO/groundingdino/util/logger.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/util/logger.py rename to swarms/workers/models/GroundingDINO/groundingdino/util/logger.py diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/util/misc.py b/swarms/workers/models/GroundingDINO/groundingdino/util/misc.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/util/misc.py rename to swarms/workers/models/GroundingDINO/groundingdino/util/misc.py diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/util/slconfig.py b/swarms/workers/models/GroundingDINO/groundingdino/util/slconfig.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/util/slconfig.py rename to swarms/workers/models/GroundingDINO/groundingdino/util/slconfig.py diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/util/slio.py b/swarms/workers/models/GroundingDINO/groundingdino/util/slio.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/util/slio.py rename to swarms/workers/models/GroundingDINO/groundingdino/util/slio.py diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/util/time_counter.py b/swarms/workers/models/GroundingDINO/groundingdino/util/time_counter.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/util/time_counter.py rename to swarms/workers/models/GroundingDINO/groundingdino/util/time_counter.py diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/util/utils.py b/swarms/workers/models/GroundingDINO/groundingdino/util/utils.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/util/utils.py rename to swarms/workers/models/GroundingDINO/groundingdino/util/utils.py diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/util/visualizer.py b/swarms/workers/models/GroundingDINO/groundingdino/util/visualizer.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/util/visualizer.py rename to swarms/workers/models/GroundingDINO/groundingdino/util/visualizer.py diff --git a/swarms/agents/workers/models/GroundingDINO/groundingdino/util/vl_utils.py b/swarms/workers/models/GroundingDINO/groundingdino/util/vl_utils.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/groundingdino/util/vl_utils.py rename to swarms/workers/models/GroundingDINO/groundingdino/util/vl_utils.py diff --git a/swarms/agents/workers/models/GroundingDINO/requirements.txt b/swarms/workers/models/GroundingDINO/requirements.txt similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/requirements.txt rename to swarms/workers/models/GroundingDINO/requirements.txt diff --git a/swarms/agents/workers/models/GroundingDINO/setup.py b/swarms/workers/models/GroundingDINO/setup.py similarity index 100% rename from swarms/agents/workers/models/GroundingDINO/setup.py rename to swarms/workers/models/GroundingDINO/setup.py diff --git a/swarms/agents/workers/models/__init__.py b/swarms/workers/models/__init__.py similarity index 51% rename from swarms/agents/workers/models/__init__.py rename to swarms/workers/models/__init__.py index 5dde671e..715fde68 100644 --- a/swarms/agents/workers/models/__init__.py +++ b/swarms/workers/models/__init__.py @@ -3,7 +3,7 @@ # from .GroundingDINO.groundingdino.util import box_ops, SLConfig # from .GroundingDINO.groundingdino.util.utils import clean_state_dict, get_phrases_from_posmap # from .segment_anything.segment_anything import build_sam, SamPredictor, SamAutomaticMaskGenerator -from swarms.agents.workers.models.GroundingDINO.groundingdino.datasets.transforms import ( +from swarms.workers.models.GroundingDINO.groundingdino.datasets.transforms import ( Compose, Normalize, ToTensor, @@ -21,9 +21,9 @@ from swarms.agents.workers.models.GroundingDINO.groundingdino.datasets.transform RandomSelect ) -from swarms.agents.workers.models.GroundingDINO.groundingdino.models import build_model -from swarms.agents.workers.models.GroundingDINO.groundingdino.util import box_ops -from swarms.agents.workers.models.GroundingDINO.groundingdino.util.slconfig import SLConfig -from swarms.agents.workers.models.GroundingDINO.groundingdino.util.utils import clean_state_dict, get_phrases_from_posmap +from swarms.workers.models.GroundingDINO.groundingdino.models import build_model +from swarms.workers.models.GroundingDINO.groundingdino.util import box_ops +from swarms.workers.models.GroundingDINO.groundingdino.util.slconfig import SLConfig +from swarms.workers.models.GroundingDINO.groundingdino.util.utils import clean_state_dict, get_phrases_from_posmap -from swarms.agents.workers.models.segment_anything import build_sam, SamPredictor, SamAutomaticMaskGenerator \ No newline at end of file +from swarms.workers.models.segment_anything import build_sam, SamPredictor, SamAutomaticMaskGenerator \ No newline at end of file diff --git a/swarms/agents/workers/models/segment_anything/.flake8 b/swarms/workers/models/segment_anything/.flake8 similarity index 100% rename from swarms/agents/workers/models/segment_anything/.flake8 rename to swarms/workers/models/segment_anything/.flake8 diff --git a/swarms/agents/workers/models/segment_anything/.gitignore b/swarms/workers/models/segment_anything/.gitignore similarity index 100% rename from swarms/agents/workers/models/segment_anything/.gitignore rename to swarms/workers/models/segment_anything/.gitignore diff --git a/swarms/agents/workers/models/segment_anything/CODE_OF_CONDUCT.md b/swarms/workers/models/segment_anything/CODE_OF_CONDUCT.md similarity index 100% rename from swarms/agents/workers/models/segment_anything/CODE_OF_CONDUCT.md rename to swarms/workers/models/segment_anything/CODE_OF_CONDUCT.md diff --git a/swarms/agents/workers/models/segment_anything/CONTRIBUTING.md b/swarms/workers/models/segment_anything/CONTRIBUTING.md similarity index 100% rename from swarms/agents/workers/models/segment_anything/CONTRIBUTING.md rename to swarms/workers/models/segment_anything/CONTRIBUTING.md diff --git a/swarms/agents/workers/models/segment_anything/LICENSE b/swarms/workers/models/segment_anything/LICENSE similarity index 100% rename from swarms/agents/workers/models/segment_anything/LICENSE rename to swarms/workers/models/segment_anything/LICENSE diff --git a/swarms/agents/workers/models/segment_anything/README.md b/swarms/workers/models/segment_anything/README.md similarity index 100% rename from swarms/agents/workers/models/segment_anything/README.md rename to swarms/workers/models/segment_anything/README.md diff --git a/swarms/agents/workers/models/segment_anything/__init__.py b/swarms/workers/models/segment_anything/__init__.py similarity index 100% rename from swarms/agents/workers/models/segment_anything/__init__.py rename to swarms/workers/models/segment_anything/__init__.py diff --git a/swarms/agents/workers/models/segment_anything/assets/masks1.png b/swarms/workers/models/segment_anything/assets/masks1.png similarity index 100% rename from swarms/agents/workers/models/segment_anything/assets/masks1.png rename to swarms/workers/models/segment_anything/assets/masks1.png diff --git a/swarms/agents/workers/models/segment_anything/assets/masks2.jpg b/swarms/workers/models/segment_anything/assets/masks2.jpg similarity index 100% rename from swarms/agents/workers/models/segment_anything/assets/masks2.jpg rename to swarms/workers/models/segment_anything/assets/masks2.jpg diff --git a/swarms/agents/workers/models/segment_anything/assets/minidemo.gif b/swarms/workers/models/segment_anything/assets/minidemo.gif similarity index 100% rename from swarms/agents/workers/models/segment_anything/assets/minidemo.gif rename to swarms/workers/models/segment_anything/assets/minidemo.gif diff --git a/swarms/agents/workers/models/segment_anything/assets/model_diagram.png b/swarms/workers/models/segment_anything/assets/model_diagram.png similarity index 100% rename from swarms/agents/workers/models/segment_anything/assets/model_diagram.png rename to swarms/workers/models/segment_anything/assets/model_diagram.png diff --git a/swarms/agents/workers/models/segment_anything/assets/notebook1.png b/swarms/workers/models/segment_anything/assets/notebook1.png similarity index 100% rename from swarms/agents/workers/models/segment_anything/assets/notebook1.png rename to swarms/workers/models/segment_anything/assets/notebook1.png diff --git a/swarms/agents/workers/models/segment_anything/assets/notebook2.png b/swarms/workers/models/segment_anything/assets/notebook2.png similarity index 100% rename from swarms/agents/workers/models/segment_anything/assets/notebook2.png rename to swarms/workers/models/segment_anything/assets/notebook2.png diff --git a/swarms/agents/workers/models/segment_anything/demo/README.md b/swarms/workers/models/segment_anything/demo/README.md similarity index 100% rename from swarms/agents/workers/models/segment_anything/demo/README.md rename to swarms/workers/models/segment_anything/demo/README.md diff --git a/swarms/agents/workers/models/segment_anything/demo/configs/webpack/common.js b/swarms/workers/models/segment_anything/demo/configs/webpack/common.js similarity index 100% rename from swarms/agents/workers/models/segment_anything/demo/configs/webpack/common.js rename to swarms/workers/models/segment_anything/demo/configs/webpack/common.js diff --git a/swarms/agents/workers/models/segment_anything/demo/configs/webpack/dev.js b/swarms/workers/models/segment_anything/demo/configs/webpack/dev.js similarity index 100% rename from swarms/agents/workers/models/segment_anything/demo/configs/webpack/dev.js rename to swarms/workers/models/segment_anything/demo/configs/webpack/dev.js diff --git a/swarms/agents/workers/models/segment_anything/demo/configs/webpack/prod.js b/swarms/workers/models/segment_anything/demo/configs/webpack/prod.js similarity index 100% rename from swarms/agents/workers/models/segment_anything/demo/configs/webpack/prod.js rename to swarms/workers/models/segment_anything/demo/configs/webpack/prod.js diff --git a/swarms/agents/workers/models/segment_anything/demo/package.json b/swarms/workers/models/segment_anything/demo/package.json similarity index 100% rename from swarms/agents/workers/models/segment_anything/demo/package.json rename to swarms/workers/models/segment_anything/demo/package.json diff --git a/swarms/agents/workers/models/segment_anything/demo/postcss.config.js b/swarms/workers/models/segment_anything/demo/postcss.config.js similarity index 100% rename from swarms/agents/workers/models/segment_anything/demo/postcss.config.js rename to swarms/workers/models/segment_anything/demo/postcss.config.js diff --git a/swarms/agents/workers/models/segment_anything/demo/src/App.tsx b/swarms/workers/models/segment_anything/demo/src/App.tsx similarity index 100% rename from swarms/agents/workers/models/segment_anything/demo/src/App.tsx rename to swarms/workers/models/segment_anything/demo/src/App.tsx diff --git a/swarms/agents/workers/models/segment_anything/demo/src/assets/data/dogs.jpg b/swarms/workers/models/segment_anything/demo/src/assets/data/dogs.jpg similarity index 100% rename from swarms/agents/workers/models/segment_anything/demo/src/assets/data/dogs.jpg rename to swarms/workers/models/segment_anything/demo/src/assets/data/dogs.jpg diff --git a/swarms/agents/workers/models/segment_anything/demo/src/assets/index.html b/swarms/workers/models/segment_anything/demo/src/assets/index.html similarity index 100% rename from swarms/agents/workers/models/segment_anything/demo/src/assets/index.html rename to swarms/workers/models/segment_anything/demo/src/assets/index.html diff --git a/swarms/agents/workers/models/segment_anything/demo/src/assets/scss/App.scss b/swarms/workers/models/segment_anything/demo/src/assets/scss/App.scss similarity index 100% rename from swarms/agents/workers/models/segment_anything/demo/src/assets/scss/App.scss rename to swarms/workers/models/segment_anything/demo/src/assets/scss/App.scss diff --git a/swarms/agents/workers/models/segment_anything/demo/src/components/Stage.tsx b/swarms/workers/models/segment_anything/demo/src/components/Stage.tsx similarity index 100% rename from swarms/agents/workers/models/segment_anything/demo/src/components/Stage.tsx rename to swarms/workers/models/segment_anything/demo/src/components/Stage.tsx diff --git a/swarms/agents/workers/models/segment_anything/demo/src/components/Tool.tsx b/swarms/workers/models/segment_anything/demo/src/components/Tool.tsx similarity index 100% rename from swarms/agents/workers/models/segment_anything/demo/src/components/Tool.tsx rename to swarms/workers/models/segment_anything/demo/src/components/Tool.tsx diff --git a/swarms/agents/workers/models/segment_anything/demo/src/components/helpers/Interfaces.tsx b/swarms/workers/models/segment_anything/demo/src/components/helpers/Interfaces.tsx similarity index 100% rename from swarms/agents/workers/models/segment_anything/demo/src/components/helpers/Interfaces.tsx rename to swarms/workers/models/segment_anything/demo/src/components/helpers/Interfaces.tsx diff --git a/swarms/agents/workers/models/segment_anything/demo/src/components/helpers/maskUtils.tsx b/swarms/workers/models/segment_anything/demo/src/components/helpers/maskUtils.tsx similarity index 100% rename from swarms/agents/workers/models/segment_anything/demo/src/components/helpers/maskUtils.tsx rename to swarms/workers/models/segment_anything/demo/src/components/helpers/maskUtils.tsx diff --git a/swarms/agents/workers/models/segment_anything/demo/src/components/helpers/onnxModelAPI.tsx b/swarms/workers/models/segment_anything/demo/src/components/helpers/onnxModelAPI.tsx similarity index 100% rename from swarms/agents/workers/models/segment_anything/demo/src/components/helpers/onnxModelAPI.tsx rename to swarms/workers/models/segment_anything/demo/src/components/helpers/onnxModelAPI.tsx diff --git a/swarms/agents/workers/models/segment_anything/demo/src/components/helpers/scaleHelper.tsx b/swarms/workers/models/segment_anything/demo/src/components/helpers/scaleHelper.tsx similarity index 100% rename from swarms/agents/workers/models/segment_anything/demo/src/components/helpers/scaleHelper.tsx rename to swarms/workers/models/segment_anything/demo/src/components/helpers/scaleHelper.tsx diff --git a/swarms/agents/workers/models/segment_anything/demo/src/components/hooks/context.tsx b/swarms/workers/models/segment_anything/demo/src/components/hooks/context.tsx similarity index 100% rename from swarms/agents/workers/models/segment_anything/demo/src/components/hooks/context.tsx rename to swarms/workers/models/segment_anything/demo/src/components/hooks/context.tsx diff --git a/swarms/agents/workers/models/segment_anything/demo/src/components/hooks/createContext.tsx b/swarms/workers/models/segment_anything/demo/src/components/hooks/createContext.tsx similarity index 100% rename from swarms/agents/workers/models/segment_anything/demo/src/components/hooks/createContext.tsx rename to swarms/workers/models/segment_anything/demo/src/components/hooks/createContext.tsx diff --git a/swarms/agents/workers/models/segment_anything/demo/src/index.tsx b/swarms/workers/models/segment_anything/demo/src/index.tsx similarity index 100% rename from swarms/agents/workers/models/segment_anything/demo/src/index.tsx rename to swarms/workers/models/segment_anything/demo/src/index.tsx diff --git a/swarms/agents/workers/models/segment_anything/demo/tailwind.config.js b/swarms/workers/models/segment_anything/demo/tailwind.config.js similarity index 100% rename from swarms/agents/workers/models/segment_anything/demo/tailwind.config.js rename to swarms/workers/models/segment_anything/demo/tailwind.config.js diff --git a/swarms/agents/workers/models/segment_anything/demo/tsconfig.json b/swarms/workers/models/segment_anything/demo/tsconfig.json similarity index 100% rename from swarms/agents/workers/models/segment_anything/demo/tsconfig.json rename to swarms/workers/models/segment_anything/demo/tsconfig.json diff --git a/swarms/agents/workers/models/segment_anything/linter.sh b/swarms/workers/models/segment_anything/linter.sh similarity index 100% rename from swarms/agents/workers/models/segment_anything/linter.sh rename to swarms/workers/models/segment_anything/linter.sh diff --git a/swarms/agents/workers/models/segment_anything/notebooks/automatic_mask_generator_example.ipynb b/swarms/workers/models/segment_anything/notebooks/automatic_mask_generator_example.ipynb similarity index 100% rename from swarms/agents/workers/models/segment_anything/notebooks/automatic_mask_generator_example.ipynb rename to swarms/workers/models/segment_anything/notebooks/automatic_mask_generator_example.ipynb diff --git a/swarms/agents/workers/models/segment_anything/notebooks/images/dog.jpg b/swarms/workers/models/segment_anything/notebooks/images/dog.jpg similarity index 100% rename from swarms/agents/workers/models/segment_anything/notebooks/images/dog.jpg rename to swarms/workers/models/segment_anything/notebooks/images/dog.jpg diff --git a/swarms/agents/workers/models/segment_anything/notebooks/images/groceries.jpg b/swarms/workers/models/segment_anything/notebooks/images/groceries.jpg similarity index 100% rename from swarms/agents/workers/models/segment_anything/notebooks/images/groceries.jpg rename to swarms/workers/models/segment_anything/notebooks/images/groceries.jpg diff --git a/swarms/agents/workers/models/segment_anything/notebooks/images/truck.jpg b/swarms/workers/models/segment_anything/notebooks/images/truck.jpg similarity index 100% rename from swarms/agents/workers/models/segment_anything/notebooks/images/truck.jpg rename to swarms/workers/models/segment_anything/notebooks/images/truck.jpg diff --git a/swarms/agents/workers/models/segment_anything/notebooks/onnx_model_example.ipynb b/swarms/workers/models/segment_anything/notebooks/onnx_model_example.ipynb similarity index 100% rename from swarms/agents/workers/models/segment_anything/notebooks/onnx_model_example.ipynb rename to swarms/workers/models/segment_anything/notebooks/onnx_model_example.ipynb diff --git a/swarms/agents/workers/models/segment_anything/notebooks/predictor_example.ipynb b/swarms/workers/models/segment_anything/notebooks/predictor_example.ipynb similarity index 100% rename from swarms/agents/workers/models/segment_anything/notebooks/predictor_example.ipynb rename to swarms/workers/models/segment_anything/notebooks/predictor_example.ipynb diff --git a/swarms/agents/workers/models/segment_anything/scripts/amg.py b/swarms/workers/models/segment_anything/scripts/amg.py similarity index 100% rename from swarms/agents/workers/models/segment_anything/scripts/amg.py rename to swarms/workers/models/segment_anything/scripts/amg.py diff --git a/swarms/agents/workers/models/segment_anything/scripts/export_onnx_model.py b/swarms/workers/models/segment_anything/scripts/export_onnx_model.py similarity index 100% rename from swarms/agents/workers/models/segment_anything/scripts/export_onnx_model.py rename to swarms/workers/models/segment_anything/scripts/export_onnx_model.py diff --git a/swarms/agents/workers/models/segment_anything/segment_anything/__init__.py b/swarms/workers/models/segment_anything/segment_anything/__init__.py similarity index 100% rename from swarms/agents/workers/models/segment_anything/segment_anything/__init__.py rename to swarms/workers/models/segment_anything/segment_anything/__init__.py diff --git a/swarms/agents/workers/models/segment_anything/segment_anything/automatic_mask_generator.py b/swarms/workers/models/segment_anything/segment_anything/automatic_mask_generator.py similarity index 100% rename from swarms/agents/workers/models/segment_anything/segment_anything/automatic_mask_generator.py rename to swarms/workers/models/segment_anything/segment_anything/automatic_mask_generator.py diff --git a/swarms/agents/workers/models/segment_anything/segment_anything/build_sam.py b/swarms/workers/models/segment_anything/segment_anything/build_sam.py similarity index 100% rename from swarms/agents/workers/models/segment_anything/segment_anything/build_sam.py rename to swarms/workers/models/segment_anything/segment_anything/build_sam.py diff --git a/swarms/agents/workers/models/segment_anything/segment_anything/modeling/__init__.py b/swarms/workers/models/segment_anything/segment_anything/modeling/__init__.py similarity index 100% rename from swarms/agents/workers/models/segment_anything/segment_anything/modeling/__init__.py rename to swarms/workers/models/segment_anything/segment_anything/modeling/__init__.py diff --git a/swarms/agents/workers/models/segment_anything/segment_anything/modeling/common.py b/swarms/workers/models/segment_anything/segment_anything/modeling/common.py similarity index 100% rename from swarms/agents/workers/models/segment_anything/segment_anything/modeling/common.py rename to swarms/workers/models/segment_anything/segment_anything/modeling/common.py diff --git a/swarms/agents/workers/models/segment_anything/segment_anything/modeling/image_encoder.py b/swarms/workers/models/segment_anything/segment_anything/modeling/image_encoder.py similarity index 100% rename from swarms/agents/workers/models/segment_anything/segment_anything/modeling/image_encoder.py rename to swarms/workers/models/segment_anything/segment_anything/modeling/image_encoder.py diff --git a/swarms/agents/workers/models/segment_anything/segment_anything/modeling/mask_decoder.py b/swarms/workers/models/segment_anything/segment_anything/modeling/mask_decoder.py similarity index 100% rename from swarms/agents/workers/models/segment_anything/segment_anything/modeling/mask_decoder.py rename to swarms/workers/models/segment_anything/segment_anything/modeling/mask_decoder.py diff --git a/swarms/agents/workers/models/segment_anything/segment_anything/modeling/prompt_encoder.py b/swarms/workers/models/segment_anything/segment_anything/modeling/prompt_encoder.py similarity index 100% rename from swarms/agents/workers/models/segment_anything/segment_anything/modeling/prompt_encoder.py rename to swarms/workers/models/segment_anything/segment_anything/modeling/prompt_encoder.py diff --git a/swarms/agents/workers/models/segment_anything/segment_anything/modeling/sam.py b/swarms/workers/models/segment_anything/segment_anything/modeling/sam.py similarity index 100% rename from swarms/agents/workers/models/segment_anything/segment_anything/modeling/sam.py rename to swarms/workers/models/segment_anything/segment_anything/modeling/sam.py diff --git a/swarms/agents/workers/models/segment_anything/segment_anything/modeling/transformer.py b/swarms/workers/models/segment_anything/segment_anything/modeling/transformer.py similarity index 100% rename from swarms/agents/workers/models/segment_anything/segment_anything/modeling/transformer.py rename to swarms/workers/models/segment_anything/segment_anything/modeling/transformer.py diff --git a/swarms/agents/workers/models/segment_anything/segment_anything/predictor.py b/swarms/workers/models/segment_anything/segment_anything/predictor.py similarity index 100% rename from swarms/agents/workers/models/segment_anything/segment_anything/predictor.py rename to swarms/workers/models/segment_anything/segment_anything/predictor.py diff --git a/swarms/agents/workers/models/segment_anything/segment_anything/utils/__init__.py b/swarms/workers/models/segment_anything/segment_anything/utils/__init__.py similarity index 100% rename from swarms/agents/workers/models/segment_anything/segment_anything/utils/__init__.py rename to swarms/workers/models/segment_anything/segment_anything/utils/__init__.py diff --git a/swarms/agents/workers/models/segment_anything/segment_anything/utils/amg.py b/swarms/workers/models/segment_anything/segment_anything/utils/amg.py similarity index 100% rename from swarms/agents/workers/models/segment_anything/segment_anything/utils/amg.py rename to swarms/workers/models/segment_anything/segment_anything/utils/amg.py diff --git a/swarms/agents/workers/models/segment_anything/segment_anything/utils/onnx.py b/swarms/workers/models/segment_anything/segment_anything/utils/onnx.py similarity index 100% rename from swarms/agents/workers/models/segment_anything/segment_anything/utils/onnx.py rename to swarms/workers/models/segment_anything/segment_anything/utils/onnx.py diff --git a/swarms/agents/workers/models/segment_anything/segment_anything/utils/transforms.py b/swarms/workers/models/segment_anything/segment_anything/utils/transforms.py similarity index 100% rename from swarms/agents/workers/models/segment_anything/segment_anything/utils/transforms.py rename to swarms/workers/models/segment_anything/segment_anything/utils/transforms.py diff --git a/swarms/agents/workers/models/segment_anything/setup.cfg b/swarms/workers/models/segment_anything/setup.cfg similarity index 100% rename from swarms/agents/workers/models/segment_anything/setup.cfg rename to swarms/workers/models/segment_anything/setup.cfg diff --git a/swarms/agents/workers/models/segment_anything/setup.py b/swarms/workers/models/segment_anything/setup.py similarity index 100% rename from swarms/agents/workers/models/segment_anything/setup.py rename to swarms/workers/models/segment_anything/setup.py diff --git a/swarms/agents/workers/MultiModalVisualAgentTool.py b/swarms/workers/multi_modal_worker.py similarity index 73% rename from swarms/agents/workers/MultiModalVisualAgentTool.py rename to swarms/workers/multi_modal_worker.py index c4a74e32..fc6d36b9 100644 --- a/swarms/agents/workers/MultiModalVisualAgentTool.py +++ b/swarms/workers/multi_modal_worker.py @@ -1,4 +1,5 @@ -from swarms.agents.workers.multi_modal_workers.multi_modal_agent import MultiModalVisualAgent +# from swarms.workers.multi_modal_workers.multi_modal_agent import MultiModalVisualAgent +from swarms.workers.multi_modal_workers.multi_modal_agent import MultiModalVisualAgent from langchain.tools import BaseTool class MultiModalVisualAgentTool(BaseTool): diff --git a/swarms/workers/multi_modal_workers/__init__.py b/swarms/workers/multi_modal_workers/__init__.py new file mode 100644 index 00000000..81c50366 --- /dev/null +++ b/swarms/workers/multi_modal_workers/__init__.py @@ -0,0 +1 @@ +from swarms.workers.multi_modal_workers.omni_agent.omni_chat import chat_huggingface \ No newline at end of file diff --git a/swarms/agents/workers/multi_modal_workers/multi_modal_agent.py b/swarms/workers/multi_modal_workers/multi_modal_agent.py similarity index 99% rename from swarms/agents/workers/multi_modal_workers/multi_modal_agent.py rename to swarms/workers/multi_modal_workers/multi_modal_agent.py index 9440403d..8b863b74 100644 --- a/swarms/agents/workers/multi_modal_workers/multi_modal_agent.py +++ b/swarms/workers/multi_modal_workers/multi_modal_agent.py @@ -30,7 +30,7 @@ from langchain.llms.openai import OpenAI # Grounding DINO # import groundingdino.datasets.transforms as T -from swarms.agents.workers.models import ( +from swarms.workers.models import ( Compose, Normalize, ToTensor, @@ -48,12 +48,12 @@ from swarms.agents.workers.models import ( RandomSelect ) -from swarms.agents.workers.models import build_model -from swarms.agents.workers.models import box_ops -from swarms.agents.workers.models import SLConfig -from swarms.agents.workers.models import clean_state_dict, get_phrases_from_posmap +from swarms.workers.models import build_model +from swarms.workers.models import box_ops +from swarms.workers.models import SLConfig +from swarms.workers.models import clean_state_dict, get_phrases_from_posmap -from swarms.agents.workers.models.segment_anything import build_sam, SamPredictor, SamAutomaticMaskGenerator +from swarms.workers.models.segment_anything import build_sam, SamPredictor, SamAutomaticMaskGenerator import cv2 import numpy as np import matplotlib.pyplot as plt diff --git a/swarms/workers/multi_modal_workers/omni_agent/__init__.py b/swarms/workers/multi_modal_workers/omni_agent/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/swarms/agents/workers/multi_modal_workers/omni_agent/config.yml b/swarms/workers/multi_modal_workers/omni_agent/config.yml similarity index 100% rename from swarms/agents/workers/multi_modal_workers/omni_agent/config.yml rename to swarms/workers/multi_modal_workers/omni_agent/config.yml diff --git a/swarms/agents/workers/multi_modal_workers/omni_agent/get_token_ids.py b/swarms/workers/multi_modal_workers/omni_agent/get_token_ids.py similarity index 100% rename from swarms/agents/workers/multi_modal_workers/omni_agent/get_token_ids.py rename to swarms/workers/multi_modal_workers/omni_agent/get_token_ids.py diff --git a/swarms/agents/workers/multi_modal_workers/omni_agent/model_server.py b/swarms/workers/multi_modal_workers/omni_agent/model_server.py similarity index 100% rename from swarms/agents/workers/multi_modal_workers/omni_agent/model_server.py rename to swarms/workers/multi_modal_workers/omni_agent/model_server.py diff --git a/swarms/agents/workers/multi_modal_workers/omni_agent/omni_chat.py b/swarms/workers/multi_modal_workers/omni_agent/omni_chat.py similarity index 99% rename from swarms/agents/workers/multi_modal_workers/omni_agent/omni_chat.py rename to swarms/workers/multi_modal_workers/omni_agent/omni_chat.py index 5d4356ad..4395e8ea 100644 --- a/swarms/agents/workers/multi_modal_workers/omni_agent/omni_chat.py +++ b/swarms/workers/multi_modal_workers/omni_agent/omni_chat.py @@ -22,7 +22,7 @@ from queue import Queue # from flask import request, jsonify import waitress # from flask_cors import CORS, cross_origin -from swarms.agents.workers.multi_modal_workers.omni_agent.get_token_ids import get_token_ids_for_task_parsing, get_token_ids_for_choose_model, count_tokens, get_max_context_length +from swarms.workers.multi_modal_workers.omni_agent.get_token_ids import get_token_ids_for_task_parsing, get_token_ids_for_choose_model, count_tokens, get_max_context_length from huggingface_hub.inference_api import InferenceApi from huggingface_hub.inference_api import ALL_TASKS diff --git a/swarms/agents/workers/OmniWorkerAgent.py b/swarms/workers/omni_worker.py similarity index 84% rename from swarms/agents/workers/OmniWorkerAgent.py rename to swarms/workers/omni_worker.py index 394e27a9..f19ea42f 100644 --- a/swarms/agents/workers/OmniWorkerAgent.py +++ b/swarms/workers/omni_worker.py @@ -1,6 +1,7 @@ #boss node -> worker agent -> omni agent [worker of the worker] from langchain.tools import tool -from swarms.agents.workers.multi_modal_workers.omni_agent.omni_chat import chat_huggingface +# from swarms.workers.multi_modal_workers.omni_agent.omni_chat import chat_huggingface +from swarms.workers.multi_modal_workers.omni_agent.omni_chat import chat_huggingface class OmniWorkerAgent: def __init__(self, api_key, api_endpoint, api_type): diff --git a/swarms/agents/workers/worker_agent_ultra.py b/swarms/workers/worker_agent_ultra.py similarity index 100% rename from swarms/agents/workers/worker_agent_ultra.py rename to swarms/workers/worker_agent_ultra.py diff --git a/swarms/agents/workers/worker_ultra_node.py b/swarms/workers/worker_ultra_node.py similarity index 100% rename from swarms/agents/workers/worker_ultra_node.py rename to swarms/workers/worker_ultra_node.py diff --git a/tests/swarms.py b/tests/swarms.py index 291aad08..fa3b2ec6 100644 --- a/tests/swarms.py +++ b/tests/swarms.py @@ -1,7 +1,7 @@ import unittest import swarms -from swarms.agents.workers.WorkerNode import WorkerNode -from swarms.agents.boss.BossNode import BossNode +from swarms.workers.WorkerNode import WorkerNode +from swarms.boss.BossNode import BossNode class TestSwarms(unittest.TestCase): def setUp(self):