Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.

Discord endpoint#133

Open
piasekj wants to merge 6 commits intomainfrom
dc_endpoint
Open

Discord endpoint#133
piasekj wants to merge 6 commits intomainfrom
dc_endpoint

Conversation

@piasekj
Copy link
Copy Markdown
Member

@piasekj piasekj commented Apr 16, 2024

Endpoint to ask LLM a question through Discord and support for (native) slash commands.

Disclaimer: I couldn't find a way to change function show into slash command (at least not yet) because native commands do not return more than 1 message, at least not in the way it is coded here.

@github-actions github-actions Bot requested a review from TheJimmyNowak April 16, 2024 19:56
@piasekj piasekj self-assigned this Apr 16, 2024
@piasekj piasekj added the discord Bot related thing label Apr 16, 2024
Comment thread discord_bot/discord_bot/bot.py Outdated

def query_llm(prompt, stop_signs):
"""Returns llm's response."""
url = "http://llm:9000/v1/completions"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should query our api when will be ready ;)

Comment thread api/bot/tests.py Outdated
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: ;)

Comment thread discord_bot/discord_bot/bot.py Outdated
Comment on lines +60 to +63

respose_status_code = 200

if response.status_code == respose_status_code:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: use HTTPStatus as you did in views.py

Comment thread discord_bot/discord_bot/bot.py Outdated
"""Passes the prompt to the llm and returns the answer."""
await interaction.response.defer()

query = "\n\n### Instructions:\n" + prompt + "\n\n### Response:\n"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: f-strings are significantly faster

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

discord Bot related thing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EP dla discorda aby zadać pytanie Wsparcie dla natywnych (slash) commands na discordzie.

3 participants