Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -109,7 +109,25 @@ def respond(message, history):
|
|
| 109 |
|
| 110 |
str_recipes_chunk = "\n".join([str(chunk) for chunk in best_recipes_chunk])
|
| 111 |
|
| 112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
|
| 114 |
if history:
|
| 115 |
messages.extend(history)
|
|
|
|
| 109 |
|
| 110 |
str_recipes_chunk = "\n".join([str(chunk) for chunk in best_recipes_chunk])
|
| 111 |
|
| 112 |
+
messages = [
|
| 113 |
+
{
|
| 114 |
+
"role": "system",
|
| 115 |
+
"content": (
|
| 116 |
+
"""
|
| 117 |
+
You are a friendly chatbot that gives recipes based on the user's question and needs.
|
| 118 |
+
Base your answer on the provided context. Do not get information from anywhere else besides the provided text file.
|
| 119 |
+
If the user's needs don't match a recipe in the text file, tell the user to give different requirements.
|
| 120 |
+
Keep answers below 75 words.
|
| 121 |
+
"""
|
| 122 |
+
)
|
| 123 |
+
},
|
| 124 |
+
{
|
| 125 |
+
"role": "user",
|
| 126 |
+
"content": (
|
| 127 |
+
f"Context:\n{best_recipes_chunk}\n\n"
|
| 128 |
+
f"Question: {message}"
|
| 129 |
+
)
|
| 130 |
+
}]
|
| 131 |
|
| 132 |
if history:
|
| 133 |
messages.extend(history)
|