Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions cogs/ashwin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import discord
from discord.ext import commands
from util.llmrequest import run


class AshwinCog(commands.Cog):
def __init__(self, bot):
self.bot = bot

@commands.command()
async def orca(self, ctx):
await ctx.send("Generating message")
result = run("this is an orca prompt")

await ctx.send(result)



def setup(bot):
bot.add_cog(AshwinCog(bot))
7 changes: 3 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import discord
from discord.ext import commands
from dotenv import load_dotenv
from cogs.ashwin import AshwinCog
from cogs.greeting import ExampleCog

# Load the env file
Expand All @@ -16,10 +17,8 @@

@bot.event
async def on_ready():
print(f"We have logged in as {bot.user}")
for filename in os.listdir("./cogs"):
if filename.endswith(".py"):
await bot.add_cog(ExampleCog(bot))
await bot.add_cog(ExampleCog(bot));
await bot.add_cog(AshwinCog(bot));


bot.run(os.getenv("DISCORD_TOKEN"))
12 changes: 7 additions & 5 deletions util/llm-request.py → util/llmrequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
import json

# For local streaming, the websockets are hosted without ssl - http://
HOST = "codeapi.forest-anderson.ca"
# HOST = "generalapi.forest-anderson.ca"
#HOST = "codeapi.forest-anderson.ca"
HOST = "generalapi.forest-anderson.ca"
URI = f"https://{HOST}/api/v1/generate"



def run(prompt):
request = {
'prompt': prompt,
Expand Down Expand Up @@ -57,7 +58,8 @@ def run(prompt):
result = response.json()['results'][0]['text']
print(prompt + result)

return result;

if __name__ == '__main__':
prompt = "In order to make homemade bread, follow these steps:\n1)"
run(prompt)
if __name__ == '__main__':
prompt = "In order to make homemade bread, follow these steps:\n1)"
run(prompt)