Spaces:
Sleeping
Sleeping
whymath
commited on
Commit
·
0981b86
1
Parent(s):
28c6dc3
Switch Assistant back to LangChain
Browse files- Dockerfile +1 -1
- app.py +15 -5
Dockerfile
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
FROM python:3.
|
| 2 |
RUN useradd -m -u 1000 user
|
| 3 |
USER user
|
| 4 |
ENV HOME=/home/user \
|
|
|
|
| 1 |
+
FROM python:3.9
|
| 2 |
RUN useradd -m -u 1000 user
|
| 3 |
USER user
|
| 4 |
ENV HOME=/home/user \
|
app.py
CHANGED
|
@@ -23,8 +23,13 @@ instructions = "You are a virtual student being taught by the user. You can ask
|
|
| 23 |
assistant = OpenAIAssistantRunnable.create_assistant(
|
| 24 |
name="T2L Virtual Student",
|
| 25 |
instructions=instructions,
|
|
|
|
| 26 |
tools=[{"type": "code_interpreter"}],
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
)
|
| 29 |
print("assistant =", assistant)
|
| 30 |
# thread = client.beta.threads.create()
|
|
@@ -55,10 +60,10 @@ async def start_chat():
|
|
| 55 |
cl.user_session.set("settings", settings)
|
| 56 |
|
| 57 |
# Send a welcome message with an action button
|
| 58 |
-
actions = [
|
| 59 |
-
|
| 60 |
-
]
|
| 61 |
-
await cl.Message(content=start_msg, actions=actions).send()
|
| 62 |
|
| 63 |
|
| 64 |
@cl.on_message
|
|
@@ -113,6 +118,11 @@ async def main(message: cl.Message):
|
|
| 113 |
|
| 114 |
query_response = assistant.invoke({"content": user_query})
|
| 115 |
query_answer = query_response["response"].content
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
|
| 117 |
# Create and send the message stream
|
| 118 |
print('query_answer =', query_answer)
|
|
|
|
| 23 |
assistant = OpenAIAssistantRunnable.create_assistant(
|
| 24 |
name="T2L Virtual Student",
|
| 25 |
instructions=instructions,
|
| 26 |
+
model="gpt-3.5-turbo",
|
| 27 |
tools=[{"type": "code_interpreter"}],
|
| 28 |
+
tool_resources={
|
| 29 |
+
"code_interpreter": {
|
| 30 |
+
"file_ids": ["file-OKohewH4QI0GidqqJzxrkwpj"]
|
| 31 |
+
}
|
| 32 |
+
}
|
| 33 |
)
|
| 34 |
print("assistant =", assistant)
|
| 35 |
# thread = client.beta.threads.create()
|
|
|
|
| 60 |
cl.user_session.set("settings", settings)
|
| 61 |
|
| 62 |
# Send a welcome message with an action button
|
| 63 |
+
# actions = [
|
| 64 |
+
# cl.Action(name="upload_pdf", value="upload_pdf_value", label="Upload a PDF", description="Upload a PDF")
|
| 65 |
+
# ]
|
| 66 |
+
# await cl.Message(content=start_msg, actions=actions).send()
|
| 67 |
|
| 68 |
|
| 69 |
@cl.on_message
|
|
|
|
| 118 |
|
| 119 |
query_response = assistant.invoke({"content": user_query})
|
| 120 |
query_answer = query_response["response"].content
|
| 121 |
+
|
| 122 |
+
# run = client.beta.threads.runs.create(
|
| 123 |
+
# thread_id=thread.id,
|
| 124 |
+
# assistant_id=assistant.id
|
| 125 |
+
# )
|
| 126 |
|
| 127 |
# Create and send the message stream
|
| 128 |
print('query_answer =', query_answer)
|