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

Conversation

@piasekj
Copy link
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

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 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