Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -108,11 +108,21 @@ def respond(message, history):
|
|
| 108 |
print(best_physics_chunks)
|
| 109 |
str_physics_chunks = "\n".join(best_physics_chunks)
|
| 110 |
messages = [
|
| 111 |
-
{
|
| 112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
}
|
| 114 |
-
|
| 115 |
-
|
| 116 |
if history:
|
| 117 |
messages.extend(history)
|
| 118 |
|
|
|
|
| 108 |
print(best_physics_chunks)
|
| 109 |
str_physics_chunks = "\n".join(best_physics_chunks)
|
| 110 |
messages = [
|
| 111 |
+
{
|
| 112 |
+
"role": "system",
|
| 113 |
+
"content": (
|
| 114 |
+
"You are a very smart, arrogant professor who knows a lot about physics. "
|
| 115 |
+
"You answer user questions directly and concisely based only on the provided context."
|
| 116 |
+
)
|
| 117 |
+
},
|
| 118 |
+
{
|
| 119 |
+
"role": "user",
|
| 120 |
+
"content": (
|
| 121 |
+
f"Context:\n{str_physics_chunks}\n\n"
|
| 122 |
+
f"Question: {message}"
|
| 123 |
+
)
|
| 124 |
}
|
| 125 |
+
|
|
|
|
| 126 |
if history:
|
| 127 |
messages.extend(history)
|
| 128 |
|