parent
171809a135
commit
b06d1e1fdb
@ -1,31 +1,13 @@
|
|||||||
from swarms import Swarms
|
from swarms import Swarms
|
||||||
|
|
||||||
# Retrieve your API key from the environment or replace with your actual key
|
# Retrieve your API key from the environment or replace with your actual key
|
||||||
api_key = os.getenv("OPENAI_API_KEY")
|
api_key = "api"
|
||||||
|
|
||||||
# Initialize Swarms with your API key
|
# Initialize Swarms with your API key
|
||||||
swarm = Swarms(api_key)
|
swarm = Swarms(openai_api_key=api_key)
|
||||||
|
|
||||||
# Initialize lower level models and tools
|
|
||||||
llm = swarm.initialize_llm()
|
|
||||||
tools = swarm.initialize_tools(llm)
|
|
||||||
|
|
||||||
# Initialize vector store
|
|
||||||
vectorstore = swarm.initialize_vectorstore()
|
|
||||||
|
|
||||||
# Initialize the worker node
|
|
||||||
worker_node = swarm.initialize_worker_node(llm, tools, vectorstore)
|
|
||||||
worker_node.create_agent("AI Assistant", "Assistant", True, {})
|
|
||||||
|
|
||||||
# Define an objective
|
# Define an objective
|
||||||
objective = "Find 20 potential customers for a Swarms based AI Agent automation infrastructure"
|
objective = "Find 20 potential customers for a Swarms based AI Agent automation infrastructure"
|
||||||
|
|
||||||
# Initialize the boss node
|
# Run Swarms
|
||||||
boss_node = swarm.initialize_boss_node(llm, vectorstore, agent_executor)
|
swarm.run_swarms(objective)
|
||||||
|
|
||||||
# Create and execute a task
|
|
||||||
task = boss_node.create_task(objective)
|
|
||||||
boss_node.execute_task(task)
|
|
||||||
|
|
||||||
# Use the worker agent to perform a task
|
|
||||||
worker_node.run_agent(objective)
|
|
Loading…
Reference in new issue