pull/541/head
Kye Gomez 6 months ago
parent 38a75493f1
commit a811a81b9b

@ -3,9 +3,6 @@ from queue import Queue
from typing import List from typing import List
from swarms.structs.agent import Agent from swarms.structs.agent import Agent
from swarms.utils.loguru_logger import logger from swarms.utils.loguru_logger import logger
from dotenv import load_dotenv
import os
from swarms.models.popular_llms import OpenAIChat
class ConcurrentWorkflow: class ConcurrentWorkflow:
@ -91,25 +88,25 @@ class ConcurrentWorkflow:
return None return None
# Load the environment variables # # Load the environment variables
load_dotenv() # load_dotenv()
# Get the API key from the environment # # Get the API key from the environment
api_key = os.environ.get("OPENAI_API_KEY") # api_key = os.environ.get("OPENAI_API_KEY")
# Initialize the language model (assuming this should be done outside the class and passed to it) # # Initialize the language model (assuming this should be done outside the class and passed to it)
llm = OpenAIChat(temperature=0.5, openai_api_key=api_key, max_tokens=4000) # llm = OpenAIChat(temperature=0.5, openai_api_key=api_key, max_tokens=4000)
# Initialize agents # # Initialize agents
agents = [ # agents = [
Agent(llm=llm, max_loops=1, autosave=True, dashboard=True) # Agent(llm=llm, max_loops=1, autosave=True, dashboard=True)
for _ in range(1) # for _ in range(1)
] # ]
# Task to be executed by each agent # # Task to be executed by each agent
task = "Generate a 10,000 word blog on health and wellness." # task = "Generate a 10,000 word blog on health and wellness."
# Initialize and run the ConcurrentWorkflow # # Initialize and run the ConcurrentWorkflow
workflow = ConcurrentWorkflow(agents=agents, max_loops=1) # workflow = ConcurrentWorkflow(agents=agents, max_loops=1)
result = workflow.run(task) # result = workflow.run(task)
logger.info(f"Final result: {result}") # logger.info(f"Final result: {result}")

Loading…
Cancel
Save