worker example

Former-commit-id: 3d8fab880fb5117251af8b303d30a4c8d386f567
pull/160/head
Kye 2 years ago
parent c98e098fc0
commit 9c247307c6

@ -9,9 +9,7 @@ The server is served on localhost:8000.
Users should be able to write text input as 'query' and url array as 'files', and check the response. Users should be able to write text input as 'query' and url array as 'files', and check the response.
Users input form should be delivered in JSON format. Users input form should be delivered in JSON format.
I want it to have neumorphism-style. Serve it on port 4500. I want it to have neumorphism-style. Serve it on port 4500.
""" """
node = WorkerUltraUltraNode(objective) node = WorkerUltraUltraNode(objective)
result = node.execute() result = node.execute()

@ -0,0 +1,21 @@
from langchain.models import OpenAIChat
from swarms import Worker
llm = OpenAIChat(
model_name='gpt-4',
openai_api_key="api-key",
temperature=0.5
)
node = Worker(
llm=llm,
ai_name="Optimus Prime",
ai_role="Worker in a swarm",
external_tools = None,
human_in_the_loop = False,
temperature = 0.5,
)
task = "What were the winning boston marathon times for the past 5 years (ending in 2022)? Generate a table of the year, name, country of origin, and times."
response = node.run(task)
print(response)
Loading…
Cancel
Save