From 5ec803397aa597710bb555ab74d60392459964a8 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Tue, 13 Jun 2023 09:00:44 -0400 Subject: [PATCH] Drop user name directive, tweak error prompt. --- lib/galaxy/webapps/galaxy/api/chat.py | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/lib/galaxy/webapps/galaxy/api/chat.py b/lib/galaxy/webapps/galaxy/api/chat.py index 3f78dfecb9e6..333662c167b8 100644 --- a/lib/galaxy/webapps/galaxy/api/chat.py +++ b/lib/galaxy/webapps/galaxy/api/chat.py @@ -44,24 +44,15 @@ def query(self, query: ChatPayload, trans: ProvidesUserContext = DependsOnTrans) else: openai.api_key = self.config.openai_api_key - messages=[ + messages = [ {"role": "system", "content": PROMPT}, {"role": "user", "content": query.query}, ] - if query.context == "username": - user = trans.user - if user is not None: - log.debug(f"CHATGPTuser: {user.username}") - msg = f"You will address the user as {user.username}" - else: - msg = f"You will address the user as Anonymous User" + if query.context == "tool_error": + msg = "The user will provide you a Galaxy tool error, and you will try to explain the error and provide a solution." messages.append({"role": "system", "content": msg}) - elif query.context == "tool_error": - msg = "The user will provide you a Galaxy tool error, and you will try to debug and explain what happened" - messages.append({"role": "system", "content": msg}) - - log.debug(f"CHATGPTmessages: {messages}") + response = openai.ChatCompletion.create( model="gpt-3.5-turbo",