[Examples][Together]

pull/362/head
Kye 1 year ago
parent 3267611499
commit 28f7558417

@ -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.")
model.run(
"Generate a blog post about the best way to make money online."
)

@ -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 <kye@apac.ai>"]

@ -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)

Loading…
Cancel
Save