Former-commit-id: 7fd7ebd9da
discord-bot-framework
Kye 1 year ago
parent 16f05381b5
commit 84a66bc981

@ -52,6 +52,7 @@ termcolor = "*"
black = "*"
dalle3 = "*"
torchvision = "*"
rich = "*"
[tool.poetry.dev-dependencies]

@ -53,6 +53,7 @@ yapf
autopep8
dalle3
torchvision
rich
mkdocs

@ -110,7 +110,7 @@ node = Worker(
)
# Specify task
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."
task = "Create a neural network using the interpreter tool"
# Run the node on the task
response = node.run(task)

@ -2,3 +2,5 @@
# from swarms.utils.logger import logger
# from swarms.utils.utils import FileType, AbstractUploader, StaticUploader, BaseHandler, FileHandler, CsvToDataframe
"""Swarms utils"""
from swarms.utils.display_markdown import display_markdown_message
from swarms.utils.futures import execute_futures_dict

@ -0,0 +1,22 @@
from rich import print as rich_print
from rich.markdown import Markdown
from rich.rule import Rule
def display_markdown_message(message):
"""
Display markdown message. Works with multiline strings with lots of indentation.
Will automatically make single line > tags beautiful.
"""
for line in message.split("\n"):
line = line.strip()
if line == "":
print("")
elif line == "---":
rich_print(Rule(style="white"))
else:
rich_print(Markdown(line))
if "\n" not in message and message.startswith(">"):
# Aesthetic choice. For these tags, they need a space below them
print("")

@ -180,7 +180,7 @@ class Worker:
except Exception as error:
raise RuntimeError(f"Error setting up agent: {error}")
@log_decorator
# @log_decorator
@error_decorator
@timing_decorator
def run(self, task: str = None):
@ -199,7 +199,7 @@ class Worker:
except Exception as error:
raise RuntimeError(f"Error while running agent: {error}")
@log_decorator
# @log_decorator
@error_decorator
@timing_decorator
def __call__(self, task: str = None):
@ -221,7 +221,7 @@ class Worker:
def health_check(self):
pass
@log_decorator
# @log_decorator
@error_decorator
@timing_decorator
def chat(self, msg: str = None, streaming: bool = False):

Loading…
Cancel
Save