diff --git a/block.py b/block.py deleted file mode 100644 index 93894245..00000000 --- a/block.py +++ /dev/null @@ -1,97 +0,0 @@ -import os - -from dotenv import load_dotenv -from transformers import AutoModelForCausalLM, AutoTokenizer - -# Import the models, structs, and telemetry modules -from swarms import ( - Gemini, - GPT4VisionAPI, - Mixtral, - OpenAI, - ToolAgent, - BlocksList, -) - -# Load the environment variables -load_dotenv() - -# Get the environment variables -openai_api_key = os.getenv("OPENAI_API_KEY") -gemini_api_key = os.getenv("GEMINI_API_KEY") - -# Tool Agent -model = AutoModelForCausalLM.from_pretrained( - "databricks/dolly-v2-12b" -) -tokenizer = AutoTokenizer.from_pretrained("databricks/dolly-v2-12b") -json_schema = { - "type": "object", - "properties": { - "name": {"type": "string"}, - "age": {"type": "number"}, - "is_student": {"type": "boolean"}, - "courses": {"type": "array", "items": {"type": "string"}}, - }, -} -toolagent = ToolAgent( - model=model, tokenizer=tokenizer, json_schema=json_schema -) - -# Blocks List which enables you to build custom swarms by adding classes or functions -swarm = BlocksList( - "SocialMediaSwarm", - "A swarm of social media agents", - [ - OpenAI(openai_api_key=openai_api_key), - Mixtral(), - GPT4VisionAPI(openai_api_key=openai_api_key), - Gemini(gemini_api_key=gemini_api_key), - ], -) - - -# Add the new block to the swarm -swarm.add(toolagent) - -# Remove a block from the swarm -swarm.remove(toolagent) - -# Update a block in the swarm -swarm.update(toolagent) - -# Get a block at a specific index -block_at_index = swarm.get(0) - -# Get all blocks in the swarm -all_blocks = swarm.get_all() - -# Get blocks by name -openai_blocks = swarm.get_by_name("OpenAI") - -# Get blocks by type -gpt4_blocks = swarm.get_by_type("GPT4VisionAPI") - -# Get blocks by ID -block_by_id = swarm.get_by_id(toolagent.id) - -# Get blocks by parent -blocks_by_parent = swarm.get_by_parent(swarm) - -# Get blocks by parent ID -blocks_by_parent_id = swarm.get_by_parent_id(swarm.id) - -# Get blocks by parent name -blocks_by_parent_name = swarm.get_by_parent_name(swarm.name) - -# Get blocks by parent type -blocks_by_parent_type = swarm.get_by_parent_type(type(swarm).__name__) - -# Get blocks by parent description -blocks_by_parent_description = swarm.get_by_parent_description( - swarm.description -) - -# Run the block in the swarm -inference = swarm.run_block(toolagent, "Hello World") -print(inference) diff --git a/multi_modal_auto_agent.py b/playground/agents/multi_modal_auto_agent.py similarity index 100% rename from multi_modal_auto_agent.py rename to playground/agents/multi_modal_auto_agent.py diff --git a/simple_agent.py b/playground/agents/simple_agent.py similarity index 100% rename from simple_agent.py rename to playground/agents/simple_agent.py diff --git a/concurrent_workflow.py b/playground/structs/concurrent_workflow.py similarity index 100% rename from concurrent_workflow.py rename to playground/structs/concurrent_workflow.py diff --git a/recursive_example.py b/playground/structs/recursive_example.py similarity index 100% rename from recursive_example.py rename to playground/structs/recursive_example.py diff --git a/sequential_workflow_example.py b/playground/structs/sequential_workflow_example.py similarity index 100% rename from sequential_workflow_example.py rename to playground/structs/sequential_workflow_example.py diff --git a/swarm_network.py b/playground/structs/swarm_network.py similarity index 100% rename from swarm_network.py rename to playground/structs/swarm_network.py diff --git a/task.py b/playground/structs/task.py similarity index 100% rename from task.py rename to playground/structs/task.py diff --git a/pyproject.toml b/pyproject.toml index fb6cc323..505bcafb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "swarms" -version = "3.4.2" +version = "3.4.4" description = "Swarms - Pytorch" license = "MIT" authors = ["Kye Gomez "] diff --git a/swarms/models/huggingface.py b/swarms/models/huggingface.py index cdfa9de3..0c97e734 100644 --- a/swarms/models/huggingface.py +++ b/swarms/models/huggingface.py @@ -175,7 +175,7 @@ class HuggingfaceLLM(AbstractLLM): self.tokenizer = AutoTokenizer.from_pretrained( self.model_id - ).to(self.device) + ) if quantize: self.model = AutoModelForCausalLM.from_pretrained(