From 95b349b1d839a4e580112e4f9189ff2ea19a7a56 Mon Sep 17 00:00:00 2001 From: Kye Date: Thu, 5 Oct 2023 11:19:04 -0400 Subject: [PATCH] discord Former-commit-id: 9d98fffc3700cbf80a65456c05073506dd1bb12f --- apps/discord.py | 39 +++++++++++++++++++++++++++++++++++ omni_ui.py => apps/omni_ui.py | 0 omnimodal_agent_example.py | 2 -- 3 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 apps/discord.py rename omni_ui.py => apps/omni_ui.py (100%) diff --git a/apps/discord.py b/apps/discord.py new file mode 100644 index 00000000..4e0a9ec2 --- /dev/null +++ b/apps/discord.py @@ -0,0 +1,39 @@ +import discord +from discord.ext import commands +from langchain.llms import OpenAIChat +from swarms.agents import OmniModalAgent + +# Setup +TOKEN = 'YOUR_DISCORD_BOT_TOKEN' +bot = commands.Bot(command_prefix='!') + +# Initialize the OmniModalAgent +llm = OpenAIChat(model_name="gpt-4") +agent = OmniModalAgent(llm) + +@bot.event +async def on_ready(): + print(f'We have logged in as {bot.user}') + +@bot.command() +async def greet(ctx): + """Greets the user.""" + await ctx.send(f'Hello, {ctx.author.name}!') + +@bot.command() +async def generate_video(ctx, *, description: str): + """Generates a video based on the given description.""" + response = agent.run(description) # Assuming the response provides information or a link to the generated video + await ctx.send(response) + +@bot.command() +async def help_me(ctx): + """Provides a list of commands and their descriptions.""" + help_text = """ + - `!greet`: Greets you. + - `!generate_video [description]`: Generates a video based on the given description. + - `!help_me`: Provides this list of commands and their descriptions. + """ + await ctx.send(help_text) + +bot.run(TOKEN) diff --git a/omni_ui.py b/apps/omni_ui.py similarity index 100% rename from omni_ui.py rename to apps/omni_ui.py diff --git a/omnimodal_agent_example.py b/omnimodal_agent_example.py index 904d9e9e..bb921fc3 100644 --- a/omnimodal_agent_example.py +++ b/omnimodal_agent_example.py @@ -3,7 +3,5 @@ from swarms.agents import OmniModalAgent llm = OpenAIChat(model_name="gpt-4") - agent = OmniModalAgent(llm) - agent.run("Create a video of a swarm of fish") \ No newline at end of file