Update app.py
Browse files
app.py
CHANGED
|
@@ -14,7 +14,7 @@ def respond(message, history):
|
|
| 14 |
top_results = get_top_chunks( message , chunk_embeddings, cleaned_chunks) # Complete this line
|
| 15 |
# Print the top results
|
| 16 |
print(top_results)
|
| 17 |
-
messages
|
| 18 |
|
| 19 |
if history:
|
| 20 |
messages.extend(history)
|
|
@@ -26,8 +26,8 @@ def respond(message, history):
|
|
| 26 |
max_tokens = 1000,
|
| 27 |
temperature = 0.5
|
| 28 |
)
|
| 29 |
-
|
| 30 |
-
return response[
|
| 31 |
|
| 32 |
chatbot = gr.ChatInterface(respond, type="messages")
|
| 33 |
cleaned_chunks = []
|
|
|
|
| 14 |
top_results = get_top_chunks( message , chunk_embeddings, cleaned_chunks) # Complete this line
|
| 15 |
# Print the top results
|
| 16 |
print(top_results)
|
| 17 |
+
messages = [{ "role": "system", "content": f"You are a chatbot that encourage people to live more sustainably. Base your response on the following action {top_results}" }]
|
| 18 |
|
| 19 |
if history:
|
| 20 |
messages.extend(history)
|
|
|
|
| 26 |
max_tokens = 1000,
|
| 27 |
temperature = 0.5
|
| 28 |
)
|
| 29 |
+
print(response)
|
| 30 |
+
return response["choices"][0]["message"]["content"].strip()
|
| 31 |
|
| 32 |
chatbot = gr.ChatInterface(respond, type="messages")
|
| 33 |
cleaned_chunks = []
|