From 0a3aeee01c96dcef92317ba4f6df485853aaf7ad Mon Sep 17 00:00:00 2001 From: ultralapse <136134023+ultralapse@users.noreply.github.com> Date: Sun, 9 Jun 2024 18:56:11 -0400 Subject: [PATCH 1/3] chore: return after llm statement to avoid necessary responses --- src/app/main.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/app/main.py b/src/app/main.py index ff7be32b..961c1f4f 100644 --- a/src/app/main.py +++ b/src/app/main.py @@ -6,10 +6,6 @@ from mangum import Mangum from asgiref.wsgi import WsgiToAsgi from discord_interactions import verify_key_decorator -import threading -import json -import boto3 - DISCORD_PUBLIC_KEY = os.environ.get("DISCORD_PUBLIC_KEY") @@ -68,7 +64,8 @@ def interact(raw_request): response = requests.post(url, json=callback_data) original_message = data["options"][0]["value"] llm.invoke_llm(original_message, token) - message_content = f"Token {token} \n ID: {id}" + return + # message_content = f"Token {token} \n ID: {id}" # Command /weather [arg1: city] # Gets the weather in just Lowell for now. Ignores the argument for city From 6d0d435a9217de81d3194c7a91d47a5fdc926c9c Mon Sep 17 00:00:00 2001 From: ultralapse <136134023+ultralapse@users.noreply.github.com> Date: Sun, 9 Jun 2024 20:23:27 -0400 Subject: [PATCH 2/3] chore: print out response of LLM in logs. --- src/app/llm.py | 2 ++ src/app/main.py | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/llm.py b/src/app/llm.py index 123416c2..39b986ae 100644 --- a/src/app/llm.py +++ b/src/app/llm.py @@ -35,6 +35,8 @@ def invoke_llm(input, token): print(token) + print(outputText) + id = os.environ.get("ID") url = f"https://discord.com/api/webhooks/{id}/{token}/messages/@original" diff --git a/src/app/main.py b/src/app/main.py index 961c1f4f..29e92afd 100644 --- a/src/app/main.py +++ b/src/app/main.py @@ -64,8 +64,7 @@ def interact(raw_request): response = requests.post(url, json=callback_data) original_message = data["options"][0]["value"] llm.invoke_llm(original_message, token) - return - # message_content = f"Token {token} \n ID: {id}" + message_content = "none" # Command /weather [arg1: city] # Gets the weather in just Lowell for now. Ignores the argument for city From 45e44308b1b56925de6caf16de7480e54118bcfc Mon Sep 17 00:00:00 2001 From: ultralapse <136134023+ultralapse@users.noreply.github.com> Date: Sun, 9 Jun 2024 20:26:11 -0400 Subject: [PATCH 3/3] chore: get rid of unnecessary imports. --- src/app/llm.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/app/llm.py b/src/app/llm.py index 39b986ae..823e5078 100644 --- a/src/app/llm.py +++ b/src/app/llm.py @@ -1,11 +1,8 @@ import boto3 import json -# from dotenv import load_dotenv import os import requests -# load_dotenv() - def invoke_llm(input, token): bedrock = boto3.client( service_name='bedrock-runtime',