Skip to content

Commit

Permalink
Drop user name directive, tweak error prompt.
Browse files Browse the repository at this point in the history
  • Loading branch information
dannon committed Oct 23, 2024
1 parent 89cc0c5 commit 5ec8033
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions lib/galaxy/webapps/galaxy/api/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 5ec8033

Please sign in to comment.