From 28f7558417407a7b7927902292daf46af959c109 Mon Sep 17 00:00:00 2001 From: Kye Date: Mon, 15 Jan 2024 10:40:10 -0500 Subject: [PATCH] [Examples][Together] --- playground/models/together.py | 6 ++++-- pyproject.toml | 2 +- swarms/structs/concurrent_workflow.py | 19 ++++++++++++++++++- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/playground/models/together.py b/playground/models/together.py index f791247d..890bcd6d 100644 --- a/playground/models/together.py +++ b/playground/models/together.py @@ -2,9 +2,11 @@ from swarms import TogetherModel # Initialize the model with your parameters model = TogetherModel( - model_name = "mistralai/Mixtral-8x7B-Instruct-v0.1", + model_name="mistralai/Mixtral-8x7B-Instruct-v0.1", max_tokens=1000, ) # Run the model -model.run("Generate a blog post about the best way to make money online.") \ No newline at end of file +model.run( + "Generate a blog post about the best way to make money online." +) diff --git a/pyproject.toml b/pyproject.toml index b3afd523..ace542a5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "swarms" -version = "3.5.6" +version = "3.5.8" description = "Swarms - Pytorch" license = "MIT" authors = ["Kye Gomez "] diff --git a/swarms/structs/concurrent_workflow.py b/swarms/structs/concurrent_workflow.py index 620f7db2..7e1a6439 100644 --- a/swarms/structs/concurrent_workflow.py +++ b/swarms/structs/concurrent_workflow.py @@ -5,6 +5,8 @@ from typing import Dict, List, Optional from swarms.structs.base import BaseStructure from swarms.structs.task import Task +from swarms.utils.logger import logger + @dataclass class ConcurrentWorkflow(BaseStructure): @@ -51,11 +53,17 @@ class ConcurrentWorkflow(BaseStructure): if tasks: for task in tasks: self.task_pool.append(task) + logger.info( + f"Added task {task} to ConcurrentWorkflow." + ) else: if task: self.task_pool.append(task) + logger.info( + f"Added task {task} to ConcurrentWorkflow." + ) except Exception as error: - print(f"[ERROR][ConcurrentWorkflow] {error}") + logger.warning(f"[ERROR][ConcurrentWorkflow] {error}") raise error def run(self): @@ -90,3 +98,12 @@ class ConcurrentWorkflow(BaseStructure): print(f"Task {task} generated an exception: {e}") return results if self.return_results else None + + def list_tasks(self): + """Prints a list of the tasks in the workflow.""" + for task in self.task_pool: + logger.info(task) + + def save(self): + """Saves the state of the workflow to a file.""" + self.save_state(self.saved_state_filepath)