Former-commit-id: 175923ec1a
group-chat
Kye 1 year ago
parent 71d206028d
commit e31a55377b

@ -1,11 +1,23 @@
from swarms import Worker
# from swarms import Worker
node = Worker(
openai_api_key="",
ai_name="Optimus Prime",
# node = Worker(
# openai_api_key="",
# ai_name="Optimus Prime",
)
# )
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)
# 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)
from swarms import Workflow
from swarms.tools.autogpt import ChatOpenAI
workflow = Workflow(ChatOpenAI)
workflow.add("What's the weather in miami")
workflow.add("Provide detauls for {{ parent_output }}")
workflow.add("Summarize the above information: {{ parent_output}}")
workflow.run()

@ -1,21 +1,21 @@
from __future__ import annotations
from typing import Any, Dict, List, Optional, Union
import concurrent.futures
from typing import Any, Dict, List, Optional
from swarms.artifacts.error_artifacts import ErrorArtifact
from swarms.artifacts.error_artifact import ErrorArtifact
from swarms.structs.task import BaseTask
import concurrent.futures
from dataclasses import dataclass
@dataclass
class StringTask(BaseTask):
def __init__(
self,
task
):
super().__init__()
self.task = task
task: str
def execute(self) -> Any:
prompt = self.task_string.replace("{{ parent_input }}", self.parents[0].output if self.parents else "")
prompt = self.task_string.replace(
"{{ parent_input }}", self.parents[0].output if self.parents else ""
)
response = self.structure.llm.run(prompt)
self.output = response
return response
@ -24,7 +24,8 @@ class StringTask(BaseTask):
class Workflow:
"""
Workflows are ideal for prescriptive processes that need to be executed sequentially.
Workflows are ideal for prescriptive processes that need to be executed
sequentially.
They string together multiple tasks of varying types, and can use Short-Term Memory
or pass specific arguments downstream.

Loading…
Cancel
Save