Skip to content

Commit

Permalink
Migration adjustments, api tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
dannon committed Oct 23, 2024
1 parent 5ec8033 commit e8adbe1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2023-06-05 13:23:42.050738
"""

# from alembic import op
# import sqlalchemy as sa

Expand All @@ -13,6 +14,7 @@
DateTime,
Integer,
Text,
ForeignKey,
)

from galaxy.model.migrations.util import (
Expand All @@ -21,26 +23,28 @@
)

# revision identifiers, used by Alembic.
revision = 'cbc46035eba0'
down_revision = 'e0561d5fc8c7'
revision = "cbc46035eba0"
down_revision = "eee9229a9765"
branch_labels = None
depends_on = None


def upgrade():
create_table(
"chat_exchange",
Column("id", Integer, primary_key=True),
Column("user_id", Integer, index=True),
Column("user_id", Integer, ForeignKey("galaxy_user.id")),
)

create_table(
"chat_exchange_message",
Column("id", Integer, primary_key=True),
Column("chat_exchange_id", Integer, index=True),
Column("chat_exchange_id", Integer, ForeignKey("chat_exchange.id")),
Column("create_time", DateTime),
Column("message", Text),
)


def downgrade():
drop_table("chat_exchange_message")
drop_table("chat_exchange")
17 changes: 9 additions & 8 deletions lib/galaxy/webapps/galaxy/api/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,17 @@
from galaxy.webapps.galaxy.api import (
depends,
DependsOnTrans,
Router,
)
from galaxy.exceptions import ConfigurationError
from galaxy.schema.schema import ChatPayload
from . import (
depends,
Router,
)

log = logging.getLogger(__name__)

router = Router(tags=["chat"])

PROMPT = """
You are a highly intelligent question answering agent, expert on the Galaxy analysis platform and in the fields of computer science, bioinformatics, and genomics.
You are a juestion answering agent, expert on the Galaxy analysis platform and in the fields of computer science, bioinformatics, and genomics.
You will try to answer questions about Galaxy, and if you don't know the answer, you will ask the user to rephrase the question.
"""

Expand All @@ -53,12 +50,16 @@ def query(self, query: ChatPayload, trans: ProvidesUserContext = DependsOnTrans)
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})

client = OpenAI(
organization='org-gO14XNCI5fwciPOYeic5Kq14',
project='$PROJECT_ID',
)


response = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
response = client.create_chat(
model="gpt-4o",
messages=messages,
temperature=0,
)

answer = response["choices"][0]["message"]["content"]
return answer

0 comments on commit e8adbe1

Please sign in to comment.