You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
swarms/examples/demos/optimize_llm_stack/vortex_example.py

36 lines
581 B

import os
from dotenv import load_dotenv
from swarm_models import OpenAIChat
from swarms.structs import Agent
# import modal
load_dotenv()
# Model
llm = OpenAIChat(
openai_api_key=os.getenv("OPENAI_API_KEY"),
model_name="gpt-4",
max_tokens=1000,
)
# Modal
# stub = modal.Stub(name="swarms")
# Agent
# @stub.function(gpu="any")
agent = Agent(
llm=llm,
max_loops=2,
autosave=True,
dashboard=True,
)
out = agent.run(
"Generate a 5,000 word blog on how swarms of autonomous agents"
" can be used to solve the world's problems."
)
print(out)