Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discord endpoint #133

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Discord endpoint #133

wants to merge 6 commits into from

Conversation

sand194
Copy link
Member

@sand194 sand194 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.

@sand194 sand194 self-assigned this Apr 16, 2024
@sand194 sand194 added the discord Bot related thing label Apr 16, 2024

def query_llm(prompt, stop_signs):
"""Returns llm's response."""
url = "http://llm:9000/v1/completions"
Copy link
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 ;)

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

# Create your tests here.
Copy link
Member

Choose a reason for hiding this comment

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

nitpick: ;)

Comment on lines 60 to 63

respose_status_code = 200

if response.status_code == respose_status_code:
Copy link
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

"""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
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 join this conversation on GitHub. Already have an account? Sign in to comment
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