Spaces:
Sleeping
Sleeping
fixing nesting errors
Browse files
app.py
CHANGED
|
@@ -43,29 +43,29 @@ def respond(message, history):
|
|
| 43 |
if history:
|
| 44 |
messages.extend(history)
|
| 45 |
|
| 46 |
-
|
| 47 |
-
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
| 51 |
|
| 52 |
-
|
| 53 |
"content": message})
|
| 54 |
|
| 55 |
-
|
| 56 |
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
|
| 67 |
chatbot = gr.ChatInterface(respond, title = "Student Formula Bot 🔬",
|
| 68 |
-
description = "Welcome to the core component of
|
| 69 |
|
| 70 |
chatbot.launch()
|
| 71 |
|
|
|
|
| 43 |
if history:
|
| 44 |
messages.extend(history)
|
| 45 |
|
| 46 |
+
# topResults = getTopChunks(message, chunkEmbeddings, cleanedChunks)
|
| 47 |
+
# context = "\n\n".join(topResults)
|
| 48 |
|
| 49 |
+
# messages.append({"role": "system",
|
| 50 |
+
# "content": context})
|
| 51 |
|
| 52 |
+
messages.append({"role": "user",
|
| 53 |
"content": message})
|
| 54 |
|
| 55 |
+
response = ""
|
| 56 |
|
| 57 |
+
responseStream = client.chat_completion(
|
| 58 |
+
messages, stream = True, max_tokens = 1024, temperature = 0.4
|
| 59 |
+
)
|
| 60 |
|
| 61 |
+
for segment in responseStream:
|
| 62 |
+
token = segment.choices[0].delta.content
|
| 63 |
+
if token is not None:
|
| 64 |
+
response += token
|
| 65 |
+
yield response
|
| 66 |
|
| 67 |
chatbot = gr.ChatInterface(respond, title = "Student Formula Bot 🔬",
|
| 68 |
+
description = "Welcome to the core component of "The Student Formula": the RAG chatbot! With the ability to act as a finance tutor, accountability buddy, and goal-setting partner all in one, it's designed to best suit your needs on the way to productivity and success. To get started, ask about the basic principles of creating a budget!")
|
| 69 |
|
| 70 |
chatbot.launch()
|
| 71 |
|