Update example.py

pull/382/head
pliny 10 months ago committed by GitHub
parent 0c50b7e1eb
commit 75356d45c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,28 +1,8 @@
import os from swarms import Agent, OpenAIChat
from dotenv import load_dotenv
# Import the OpenAIChat model and the Agent struct
from swarms.models import OpenAIChat
from swarms.structs import Agent
# Load the environment variables
load_dotenv()
# Get the API key from the environment
api_key = os.environ.get("OPENAI_API_KEY")
# Initialize the language model
llm = OpenAIChat(
temperature=0.5,
model_name="gpt-4",
openai_api_key=api_key,
max_tokens=1000,
)
## Initialize the workflow ## Initialize the workflow
agent = Agent( agent = Agent(
llm=llm, llm=OpenAIChat(),
max_loops=1, max_loops=1,
autosave=True, autosave=True,
dashboard=False, dashboard=False,
@ -31,4 +11,4 @@ agent = Agent(
) )
# Run the workflow on a task # Run the workflow on a task
agent.run("Generate a 10,000 word blog on health and wellness.") agent("Find a chick fil a equivalent in hayes valley")

Loading…
Cancel
Save